Resize image but dicom info missing

1 view (last 30 days)
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?

Accepted Answer

Image Analyst
Image Analyst on 28 Dec 2021
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.

More Answers (0)

Categories

Find more on Biomedical Imaging in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!