dicomwrite error: Cannot determine photometric interpretation
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I wrote the following code, derived from the dicomwrite sample on the documentation:
clear; close all;
load seg_result_240steps;
%take the info of the original dicom image
info = dicominfo('TumorSimOutput2_discrete_enh_truth.dcm');
imdata = dicomread(info);
info.SeriesInstanceUID;
%You need a newUID to write the modified image as a new series.
%dicomuid is guaranteed to generate a unique UID
uid = dicomuid;
info.SeriesInstanceUID = uid;
info.PhotometricInterpretation= 'MONOCHROME2';
%specify the modified metadata structure info as argument.
status=dicomwrite(seg_result, 'seg_result.dcm', info);
I get this awful bunch of errors:
Error using dicom_prep_ImagePixel>getPhotometricInterp (line 116)
Cannot determine photometric interpretation.
Error in dicom_prep_ImagePixel (line 10)
metadata.(dicom_name_lookup('0028', '0004', dictionary)) = getPhotometricInterp(X, map, txfr);
Error in dicom_prep_metadata (line 70)
metadata = dicom_prep_ImagePixel(metadata, X, map, txfr, dictionary);
Error in dicom_create_IOD (line 27)
metadata = dicom_prep_metadata(IOD_UID, metadata, X, map, options.txfr, dictionary);
Error in dicomwrite>write_message (line 263)
[attrs, status] = dicom_create_IOD(SOP_UID, X, map, ...
Error in dicomwrite (line 200)
[status, options] = write_message(X, filename, map, metadata, options);
Error in test_dicomwrite (line 27)
result=dicomwrite(seg_result, 'seg_result.dcm', info);
I suspect the error derives from the fact that I do a squeeze operation that reduces the original 4D data array to 3D, but when looking at the parameters (in info), I don't know what to change, the number of frames seems correct (181).
0 Kommentare
Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!