Resize image but dicom info missing

1 次查看(过去 30 天)
Hi all, I have 4D images,
>>spect130 = dicomread('khadijahkalai.dcm');
>>size(spect130)
ans =
130 130 1 90
Then I want resize it to 128x128, I wrote this code below
scale = 128/130;
spect128 = imresize(spect130, scale);
dicomwrite(spect128, 'spect128x128.dcm');
the problem is, the new spect128x128.dcm is missing dicominfo like SliceThickness.
Anyone know how to solve it?

采纳的回答

Image Analyst
Image Analyst 2021-12-28
I believe that would resize all dimensions by that, including the 90, which obvisouly you don't want. I think you need to do it one slice at a time.
imageSize = size(spect130);
spect128 = zeros(128, 128, 1, imageSize(4), class(spect130))
for slice = 1 : imageSize(4)
thisSlice = spect130(:, :, 1, slice);
spect128(:, :, 1, slice) = imresize(thisSlice, [128, 128]);
end
As far as writing the new metadata to the output file, I don't know. You'd have to look into the dicomwrite() documentation.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Biomedical Imaging 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by