Modify DICOM elements without modifying PixelData
8 次查看(过去 30 天)
显示 更早的评论
I am writing a program that reads in DICOM images, modifies elements of the header so they will be regrouped in our PACS, and writes that back out as a new file. The problem I am encountering is that the writing of the new file causes the pixel data to be recompressed, resulting in a difference from the original. Here's a simple example:
metadata = dicominfo('MyDICOM.dcm');
X = dicomread(metadata);
% Maybe modify some header elements here
dicomwrite(X, 'MyDICOM_new.dcm', metadata, 'createmode', 'copy', 'WritePrivate', true);
X2 = dicomread('MyDICOM_new.dcm');
imshowpair(X, X2, 'diff');
I was expecting the two images to be identical, but they are different (I believe they are JPEG compression differences).
I also tried the dicomanon() function, but it also seems to recompress the image data. In my code I played with changing the new file format to be uncompressed by using a different TransferSyntax, but my multi-frame images exploded in size.
How can I modify DICOM header elements without causing the pixel data to change?
Thank you.
2 个评论
Yoichi Watanabe
2019-6-29
Scott,
you posted your question a long time. Have you found an answer to your question? If so, I want to know the solution. I am having the same issue. I am trying to anonymize Dicom CT data written in 12 bits. thanks.
回答(2 个)
John
2014-7-29
Hi Scott,
MATLAB's Image Processing Toolbox has a superbly decked out DICOM handling component.
I do not have any DICOMs on hand but have had this issue before and found out that using 'dicomwrite' with the 'CompressionMode' name-value pair setting with one of the lossless compression settings worked. The documentation for 2014a has this name-value pair, I am not sure about the earlier releases though.
These days though, with GBs costing pennies, consider using no compression at all :-).
John
2014-7-30
You could use the Grass roots dicom tools (GDCM). It is a well documented collection of tools.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!