How do I edit a DICOM image (e.g. overlaying a black box) while maintaining the DICOM file format?

 Accepted Answer

There currently is no image processing function to directly add features to a DICOM image. Instead, use the following workflow to edit the desired image and rewrite to a DICOM file:
1) Read in and display DICOM image
img = dicomread('FILENAME.dcm');
imshow(img,'DisplayRange',[]);
2) Plot desired features onto the image (e.g. 'rectangle')
3) Get image data array for updated figure
img = getframe();
4) Write image data to new DICOM file
dicomwrite(img.cdata,'FILENAME_REDACTED.dcm')
If you would like to maintain the metadata from the original file, store it using 'dicominfo' and pass the resulting struct as an argument to 'dicomwrite'.

More Answers (0)

Categories

Products

Release

R2019a

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!