write a dicom image with input that is not dicom

13 views (last 30 days)
Hi fellows,
Before showing the link, I have already read the documentation for dicomwrite. It turns out that it works in the instance of an input image already being a dicom image.
I want to create a dicom file using an image that is an object in matlab environment.
I understand that the metadata structure go nuts, because there is no info in the structure (as the input is not derived from a dicom file).
When I try to create the dicom image, I get the following 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 51)
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 276)
[attrs, status] = dicom_create_IOD(SOP_UID, X, map, ...
Error in dicomwrite (line 212)
[status, options] = write_message(X, filename, map, metadata,
options);
How can I surpass this issue?
Thanks in advance
  3 Comments
drummer
drummer on 11 Dec 2019
my input is the volumetric minc file from brainweb. I wonder it has not any metadata structure embedded.
Rik
Rik on 11 Dec 2019
You are trying to call dicomwrite. What is your exact input? Either give exact code to reproduce your variables, or attach a mat file.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 11 Dec 2019
I recommend that you find an existing dicom file that has the same properties you want, and use dicominfo() to read the meta-data. (You could store the metadata somewhere so that you did not need to keep the base image around.)
Then when you use dicomwrite() pass the saved metadata before any name/value pairs. dicomwrite() knows enough to override the information about the number of pixels, but will retain (most of?) the other information. You would want to do some testing to ensure it does not accidentally duplicate UUIDs specific to the patient.

More Answers (0)

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!