Ignore corrupted tags when writing DICOM file

3 views (last 30 days)
We have a pipeline which reads in DICOM files, applies an image mask, and writes them back out. Occasionally, DICOM files have erased or changed VR for which which are irrelevant to us - for example, (0040,9210) LUT Label. The DICOMs are read fine, but when saving back out with the header, this causes an error:
Cannot write dicom ROIs for report. Attribute (0040,9210) has wrong data type.
Deleting this tag would solve the problem, but across different cases we see a variety of tags with apparently corrupted VR's. Is there a general way to ignore this error? Since dicomread has no problem injesting the data, dicomwrite should be able to write it 'as is'.
Bogdan Dzyubak
Bogdan Dzyubak on 27 Jan 2022
I have not modified the specific tag that is causing a problem. It is included inside an SQ structure tag which was likely added by someone in post processing. Since Matlab does not crash trying to dicomread this structure, it seems like it should be able to dicomwrite it as well.

Sign in to comment.

Answers (0)


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!