How can I display a 3D image of a DICOM stack without it being squished?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alyssa Moreno
el 12 de Jul. de 2023
Comentada: Alyssa Moreno
el 26 de Oct. de 2023
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 comentarios
Rik
el 12 de Jul. de 2023
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
el 15 de Sept. de 2023
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.
Respuesta aceptada
Tim Jackman
el 15 de Sept. de 2023
Editada: Walter Roberson
el 15 de Sept. de 2023
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 comentarios
Walter Roberson
el 15 de Sept. de 2023
Ah, I was looking for a way to do something like this about 3 weeks ago..
Más respuestas (0)
Ver también
Categorías
Más información sobre DICOM Format en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!