Clear Filters
Clear Filters

Converting 4D-double image into DICOM format

8 views (last 30 days)
Yasser Alzamil
Yasser Alzamil on 17 Feb 2017
Commented: Rik on 21 Feb 2017
Hi there, I run a simulation generates 4D-double image, I can display by using the function 'imshow4' available in this link: https://uk.mathworks.com/matlabcentral/fileexchange/47188-imshow4
my question is how to convert the 4D image into DICOM or Analyze format for further analysis.
Regards

Answers (1)

Rik
Rik on 17 Feb 2017
Check if this works for your data:
%generate dummy data
X=rand(100,100,3,14);
%remap [0 1] double to the [min max] of 8 bit data (wich dicomwrite prefers)
X_uint8=uint8(X*double(uint8(inf)));
%write out
dicomwrite(X_uint8,'test.dcm')
Dicom is generally quite picky, so you may have to add dicominfo or save the data slice by slice.
  4 Comments
Rik
Rik on 21 Feb 2017
Hmm. The degraded images looks to me like it is displayed as [0 1], instead of [0 255]. This points to the nature of the error: I found this page, which gives the options. I would suggest you set this parameter manually, so Matlab doesn't have to guess it (I would go for MONOCHROME1, but that is a guess).
info_struct.PhotometricInterpretation='MONOCHROME1';
dicomwrite(X_uint8,'test.dcm',info_struct)

Sign in to comment.

Categories

Find more on DICOM Format in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!