Clear Filters
Clear Filters

Is there a bug in the dicomwrite function, can I work around it?

2 views (last 30 days)
I have MR-DICOM images und i want to change pixel values of the DICOM-Images while maintaining the same Header of the images. I have tried with dicomread und write and info, But it has not worked. In particular, the dicomwrite program messes up the header. Presumably, one can use load dicom headers using:
info_in = dicominfo('infile');
load the data using: data = dicomread('infile');
and then write using: dicomwrite(data,'outfile',info_in,'CreateMode', 'copy');
However, the header field 'LargestImagePixelValue' gets' changed from 4000+ to 255! As far as I can tell, there is no way to avoid this flaw in the writer. Then, no dicom reader's can correctly show the data because the header is wrong. I tried leaving off the 'CreateMode', 'copy' flags in the write command... that didn't help. For all practical purposes, it seems like MATLAB has no useful dicom support
  1 Comment
Sean de Wolski
Sean de Wolski on 10 Sep 2012
What does the info_in struct look like? Is it full, empty? Does it contain the 'LargestImagePixelValue' property? It looks like somewhere something non-uint8 is being converted to uint8 but it's kind of hard to tell without being able to see it.
Also, take a peak at: FEX:dicom-toolbox

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!