extract rescale slope value
10 ビュー (過去 30 日間)
古いコメントを表示
mohd akmal masud
2018 年 2 月 19 日
コメント済み: mohd akmal masud
2019 年 3 月 24 日
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???
採用された回答
Walter Roberson
2018 年 2 月 19 日
for K = 135 : -1 : 1
petname = sprintf('PET_I1001_PT%03d.dcm', K);
info(K) = dicominfo(petname);
end
rescale_slopes = [info.RescaleSlope];
If, for some reason you need to find the non-zero entries, then
slice_idx = find(rescale_slopes);
Note: the above code has a limitation that the dicominfo returned by each slice must have exactly the same set of fields. If that assumption is violated then the info(K) assignment will give you an error about assignment between dissimilar structures.
14 件のコメント
Walter Roberson
2018 年 11 月 2 日
If you have read in all of the values, then
rescale_slopes(20:31)
If for some reason you only want to read in a subset of the slices, then
slices_to_read = 20:31;
num_slices = length(slices_to_read);
for slice_idx = num_slices: -1 : 1
slice_number = slices_to_read(slice_idx);
petname = sprintf('PET_I1001_PT%03d.dcm', slice_number);
info(slice_idx) = dicominfo(petname);
if ~isfield(info(slice_idx), 'RescaleSlope') || isempty(info(slice_idx).RescaleSlope)
info(slice_idx).RescaleSlope = 1;
end
end
The looping from the last backwards towards the first is done for efficiency: it forces the last info() entry to be assigned to first, so afterwards it is not necessary to expand the info() struct the way it would be if you had not pre-allocated the info struct and you were looping forwards.
その他の回答 (1 件)
mohd akmal masud
2018 年 11 月 8 日
5 件のコメント
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.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!