extract rescale slope value
显示 更早的评论
Hi all,
I want to extract the RescaleSlope value from dicominfo for each slice. But I have 135 slice images. This is my code to extract RescaleSlope. But still failed.
P = zeros(256, 256, 135);
for K = 1 : 135
petname = sprintf('PET_I1001_PT%03d.dcm', K);
P(:,:,K) = dicominfo(petname);
end
info=dicominfo(P(:,:,K));
[r,c,slice] = findND (info.RescaleSlope);
Anyone who can help me solve this problem???
采纳的回答
更多回答(1 个)
mohd akmal masud
2018-11-8
5 个评论
mohd akmal masud
2019-3-8
Walter Roberson
2019-3-8
projectdir = 'I:\12. FIZIK NUKLEAR\Jadual Bulanan Kerja PSF 2018\75ct';
numslices = 75; %assume this
rawslices = cell(numslices, 1);
slices = cell(numslices, 1);
for K = numslices : -1 : 1
petname = fullfile(projectdir, sprintf('ct%d.dcm', K));
thisinfo = dicominfo(petname);
fn = fieldnames(thisinfo);
for N = 1 : length(fn)
thisfield = fn{N};
info(K).(thisfield) = thisinfo.(thisfield);
end
this_slice = dicomread(petname);
if ~isfield(info(K), 'RescaleSlope') || isempty(info(K).RescaleSlope)
info(K).RescaleSlope = 1;
end
if ~isfield(info(K), 'RescaleIntercept') || isempty(info(K).RescaleIntercept)
info(K).RescaleIntercept = 0;
end
rawslices{K} = this_slice;
slices{K} = double(this_slice) * info(K).RescaleSlope + info(K).RescaleIntercept;
end
Now rawslices is a cell array containing the data as read in from the file (probably int16 datatype), and slices is a cell array containing the data rescaled, as double datatype.
You do not need to do any of that post-processing to find empty values because it is already done inside the reading loop: the isempty() causes empty values to be replaced with known values.
mohd akmal masud
2019-3-9
Walter Roberson
2019-3-9
What extension does it have?
This is a Question about DICOM, dealing with the DICOM-specific matter of RescaleSlope and RescaleIntercept. If you are not using DICOM images then your question should have been posted separately and should have included detail of what you were trying to achieve.
mohd akmal masud
2019-3-24
类别
在 帮助中心 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!