How can I display a 3D image of a DICOM stack without it being squished?

7 ビュー (過去 30 日間)
Alyssa Moreno
Alyssa Moreno 2023 年 7 月 12 日
コメント済み: Alyssa Moreno 2023 年 10 月 26 日
Hello, I have tried using the volshow function from this page about displaying a 3D view of a dicom stack, the only problem is that the image is squished. (Like the first example from the dicomreadVolume page)
One solution was to incorporate the line "V = dicomreadVolume(sourcetable,"s3",MakeIsotropic=true);" but I very quickly noticed that matlab's example dicom images have a dicom tag called "SpacingBetweenSlices" , something other dicom stacks, like ones from Slicer, do not have. I have tried adding the tag to the metadata of my own dicom images in order to make the line above work. Problem is the dicomwrite function does not actually save that tag to any of the images in the file explorer. (Two attempts of how I tried this shown below, both run without spitting out errors)
1st Try:
for i = 1:sourcetable.Frames
metadata = dicominfo(fullfile(name, fileList(i).name), 'UseDictionaryVR', true);
metadata.spacingBetweenSlices = 3.3000; % This value is pulled from the metadata of matlabs dicom example
dicomwrite(dicomread(fullfile(name, fileList(i).name)), ...
fullfile(name, fileList(i).name), metadata);
end
2nd Try:
for i = 1:numel(fileList)
% Read DICOM metadata for the current file
metadata = dicominfo(fullfile(inputFolderPath, fileList(i).name));
% Add the new DICOM tag, this is pulled from matlabs example dicom metadata
metadata.(dicomlookup('0018','0088')) = struct('VR', 'DS', 'Value', 3.3);
% New file name for the modified DICOM image
[~, fileName, fileExt] = fileparts(fileList(i).name);
newFileName = strcat(fileName, '_modified', fileExt);
outputFilePath = fullfile(newDir, newFileName);
% Write the modified DICOM image with updated metadata to the new file
dicomwrite(dicomread(fullfile(inputFolderPath, fileList(i).name)), outputFilePath, metadata);
end
I have tried other 3d viewing functions, however, I really like the volshow function as I am able to rotate the image around without any lag. Does anyone has any tips or suggestions on how they display their dicom image stack without it being squished?
  2 件のコメント
Rik
Rik 2023 年 7 月 12 日
In my own 3D viewer I used the image function to deal with anisotropic voxels.
You can calculate the slice increment by subtracting the z value of two subsequent slices. If you want I can look up the correct dicom tag for that property. (but it is probably quicker to Google it yourself)
Walter Roberson
Walter Roberson 2023 年 9 月 15 日
Most DICOM modalities do not record the position of each slide independently. In most of them, the position of individual slices is implied.
See https://stackoverflow.com/questions/14930222/how-to-calculate-space-between-dicom-slices-for-mpr for some of the details about complications in calculating slice thickness.

サインインしてコメントする。

採用された回答

Tim Jackman
Tim Jackman 2023 年 9 月 15 日
編集済み: Walter Roberson 2023 年 9 月 15 日
The volshow documentation now has an example that shows how to use the Transformation property to set the correct spatial referencing and avoid the squished volume effect:
Also, the medicalVolume object from the Medical Imaging Toolbox will handle this for you:
  2 件のコメント
Walter Roberson
Walter Roberson 2023 年 9 月 15 日
Ah, I was looking for a way to do something like this about 3 weeks ago..
Alyssa Moreno
Alyssa Moreno 2023 年 10 月 26 日
Thank you both for the help :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDICOM Format についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by