- An m-by-n matrix representing a single-frame grayscale image, or an indexed image.
- An m-by-n-by-3 array representing a single-frame truecolor (RGB) image.
- A 4-D array representing a multiframe image.
Storing a 5D data in dicom files
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I have a 5D data structure in matlab from an experimental ultrasound system. I have intensity values for X, Y, Z, Time and Frequency. I want to store this in a DICOM format for easy exchange with other applications. Ideally, I'd store the data in a 5D structure, and a DICOM viewer allows me to scrub through all the axes independently. But maybe I have to resort to 4D and separate files (X, Y, Z, T, and a file per frequency would be the natural ordering).
I struggle with getting dicomwrite to work. I tried various ways of setting the info struct of dicomwrite, but I still fail:
dicomtest = int16(rand( 256,256,2, 25));
info = dicominfo("CT-MONO2-16-ankle.dcm"); % Load a DICOM template file for metadata (you can create your own)
info.Rows = 256;
info.Columns = 256;
info.SamplesPerPixel = 2;
info.NumberOfFrames = 25;
dicomwrite( dicomtest, 'test.dcm', info )
I get the error
Error using images.internal.dicom.dicom_prep_ImagePixel>getPhotometricInterp
Cannot determine photometric interpretation.
Could anyone point me in the right direction on how to proceed? In the example given, I have voxel data of dimensions 256 in X, 256 in Y and 2 in Z, and 25 time frames. I have multiples of these 4D objects for various frequencies.
Thanks!
2 comentarios
Cris LaPierre
el 9 de Nov. de 2023
Not super familiar with dicoms and dicomwrite, so I'll just comment on the size of your input.
X — DICOM image
m-by-n matrix | m-by-n-by-3 array | 4-D array
DICOM image, specified as one of these options:
Cris LaPierre
el 9 de Nov. de 2023
Editada: Cris LaPierre
el 9 de Nov. de 2023
As for your example code, I see 2 issues.
1. An int16 has integer values ranging from 0 to 65535. rand creates random, non integer numbers between 0 and 1. Your text image will only have 0s and 1s, then. Consider using randi instead.
2. The error is caused by the Z dimension. You must either have an intensity image (dim = 1), or an rgb image (dim = 3). MATLAB does not know what to do when this dim = 2
dicomtest = int16(randi(65535, 256,256,3, 25));
info = dicominfo("CT-MONO2-16-ankle.dcm"); % Load a DICOM template file for metadata (you can create your own)
info.Rows = 256;
info.Columns = 256;
info.SamplesPerPixel = 3;
info.NumberOfFrames = 25;
dicomwrite( dicomtest, 'test.dcm', info )
I am not sure what the correct way is to capture and store SamplesPerPixel. Is that your 2 different frequencies? Might need to create a separate dicom for each frequency.
Respuestas (1)
Cris LaPierre
el 9 de Nov. de 2023
Movida: Cris LaPierre
el 9 de Nov. de 2023
It would appear that the DICOM standard specifies what values Samples Per Pixel can take. It appears that it can either be 1 (intensity images) or 3 (color images).
0 comentarios
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!