Converting 4D-double image into DICOM format

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

回答 (1 件)

Rik
Rik 2017 年 2 月 17 日

0 投票

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 件のコメント

Yasser Alzamil
Yasser Alzamil 2017 年 2 月 21 日
Hi Rik, Thanks for your response. I tried that and works for the remap but couldn't write that to the dicom and got this error message;
Error using dicom_prep_ImagePixel>getPhotometricInterp (line 134) Cannot determine photometric interpretation.
Error in dicom_prep_ImagePixel (line 9) metadata.(dicom_name_lookup('0028', '0004', dictionary)) = getPhotometricInterp(metadata, X, map, txfr, dictionary);
Error in dicom_prep_metadata (line 69) metadata = dicom_prep_ImagePixel(metadata, X, map, txfr, useMetadataBitDepths, dictionary);
Error in dicom_create_IOD (line 26) metadata = dicom_prep_metadata(IOD_UID, metadata, X, map, options.txfr, options.usemetadatabitdepths, dictionary);
Error in dicomwrite>write_message (line 272) [attrs, status] = dicom_create_IOD(SOP_UID, X, map, ...
Error in dicomwrite (line 208) [status, options] = write_message(X, filename, map, metadata, options);
Yasser Alzamil
Yasser Alzamil 2017 年 2 月 21 日
plus I noticed the quality of images going less than before remapping!! please have a look for the attached 2 images </matlabcentral/answers/uploaded_files/70455/FBP4D%20before%20remap.jpg>
Yasser Alzamil
Yasser Alzamil 2017 年 2 月 21 日
Rik
Rik 2017 年 2 月 21 日
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)

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

製品

質問済み:

2017 年 2 月 17 日

コメント済み:

Rik
2017 年 2 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by