Resize image but dicom info missing

1 Ansicht (letzte 30 Tage)
mohd akmal masud
mohd akmal masud am 28 Dez. 2021
Kommentiert: mohd akmal masud am 28 Dez. 2021
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?

Akzeptierte Antwort

Image Analyst
Image Analyst am 28 Dez. 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.

Weitere Antworten (0)

Kategorien

Mehr zu Biomedical Imaging finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by