How do I use dicomwrite to specify PhotometricInterpretation metadata?
4 views (last 30 days)
Show older comments
Hi,
I am attempting to write a dicom file with PhotometricInterpretation set to MONOCHROME1 instead of MONOCHROME2, but no matter how I try it always writes the tag with MONOCHROME2. I've tried editing the metadata, using CreateMode 'copy', inputting 'MONOCHROME1' as a parameter, and various combinations.
Is it impossible to edit this dicom tag while writing a dicom file with dicomwrite?
Thank you.
0 Comments
Answers (1)
UDAYA PEDDIRAJU
on 3 Jan 2025
Hi Felix,
To specify the "PhotometricInterpretation" metadata when using "dicomwrite", you can include it in the metadata structure that you pass to the function. Here's an example of how to set "PhotometricInterpretation" to "MONOCHROME1":
% Sample image data
imageData = rand(256, 256); % Example grayscale image
% Create metadata structure
metadata = struct();
metadata.PhotometricInterpretation = 'MONOCHROME1'; % Set to MONOCHROME1
% Write DICOM file
dicomwrite(imageData, 'output.dcm', metadata);
Make sure that the image data is compatible with the specified photometric interpretation. If the image is grayscale, "MONOCHROME1" and "MONOCHROME2" should be appropriate, but the actual pixel values should also reflect the intended interpretation.
If you continue to experience issues with "dicomwrite" defaulting to "MONOCHROME2", ensure that your image data and other metadata are correctly set up, as some "DICOM" viewers may interpret the data differently based on the pixel values.
0 Comments
See Also
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!