How does one set the PatientPosition and other spatial attributes when writing a dicom CT volume?

25 visualizaciones (últimos 30 días)
I am trying to write DICOMs of a CT volume in both single- and multi-file form. To check that the result is readable, I try reading the file(s) back in with dicomreadVolume(). Below is one such attempt.
info.StudyDescription = 'Description';
info.SOPClassUID = '1.2.840.10008.5.1.4.1.1.2';
info.PixelSpacing = [1,1]; % x & y voxel size
info.SliceThickness =1; % optional
info.SpacingBetweenSlices = 1;
info.ImageOrientationPatient = [1,0,0,0,-1,0];
info.PatientPosition='HFS';
status=dicomwrite(ones(250,250,1,250),'out.DCM', info,'CreateMode','copy','ObjectType',...
'CT Image Storage','MultiframeSingleFile',1);
Warning: The 'SOPClassUID' and 'ObjectType' parameters are ignored when 'CreateMode' is 'copy'.
info=dicominfo('out.DCM');
Clearly, the write operation produced a DICOM file containing a PatientPosition attribute because,
info.PatientPosition
ans = 'HFS'
Why then, does dicomreadVolume complain?
V=dicomreadVolume('out.DCM');
Error using images.internal.dicom.getSeriesDetails>throwMissingPatientPosition (line 140)
File "out.DCM" must contain the attribute 'PatientPosition'.

Error in images.internal.dicom.getSeriesDetails (line 29)
throwMissingPatientPosition(filename)

Error in dicomreadVolume (line 101)
[seriesFilenames, spatialInfo, sliceDim] = images.internal.dicom.getSeriesDetails(filenames);
  4 comentarios
Matt J
Matt J el 25 de En. de 2022
Editada: Matt J el 25 de En. de 2022
@Simon Chan the syntax dicomreadVolume(folder) also fails with the same error. I can read single file format with dicomread() and I can read multi-file format if I use dicomread() in a loop over the different files. But the benefit of dicomreadVolume(), I thought, was to handle all that in a unified way..
@Rik Which two attributes do you mean? What's the other attribute?
It's clear to me that some attribute is missing that allows dicomreadVolume to populate its second output argument (spatial), but it's obscure to me both what that attribute is (maybe ImagePositionPatient?), and what format it should take for dicomwrite() to handle it properly in both the single and multi-file cases.
Rik
Rik el 26 de En. de 2022
I just followed the execution to a few lines before the error is thrown. The code tries to determine these two values. I haven't googled them to see if they are actual DICOM attributes, or just internal Matlab ones. At any rate, those two are empty, leading to the error you see. The strange thing is that the object in the workspace of that function actually does contain the PatientPosition. So the error message is incorrect. I can't tell if this is a bug or not.

Iniciar sesión para comentar.

Respuestas (0)

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by