Storing a 5D data in dicom files

조회 수: 4 (최근 30일)
Jast
Jast 2023년 11월 9일
편집: Cris LaPierre 2023년 11월 9일
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
Cris LaPierre
Cris LaPierre 2023년 11월 9일
Not super familiar with dicoms and dicomwrite, so I'll just comment on the size of your input.
From the doc for dicomwrite, your input image X can be a 2D, 3D, or 4D array, but not 5D:
X DICOM image
m-by-n matrix | m-by-n-by-3 array | 4-D array
DICOM image, specified as one of these options:
  • 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.
Cris LaPierre
Cris LaPierre 2023년 11월 9일
편집: Cris LaPierre 2023년 11월 9일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Cris LaPierre
Cris LaPierre 2023년 11월 9일
이동: Cris LaPierre 2023년 11월 9일
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).

카테고리

Help CenterFile Exchange에서 DICOM Format에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by