2

I am trying to create a new DICOM file from an existing DICOM file. So, the scenario is that I have a DICOM file and I do some image processing on it and produce a transformed/processed file and I would like to save it using the original file as a template.

The only things that change are

1: The pixel data

2: The rescale and offset tags.

Does anyone know how I can achieve this with DCMTK? I looked at various examples but most of them show how to save a JPG or BMP image into a new DICOM file.

Luca
  • 10,458
  • 24
  • 107
  • 234

3 Answers3

4

If you modify the image data (Pixel Data), you should save the new dataset with new Series Instance UID and SOP Instance UID. In addition, you should also update the first value of Image Type (0008, 0008) to “DERIVED” to reflect that image is not the original image. The second value Image Type tag can be “PRIMARY” or “SECONDARY” depending on the patient examination characteristics. You can also use Derivation Description (0008, 2111) and Derivation Code Sequence (0008,9215) to describe the way in which the image was derived. In addition, you can also reference the source image(s) used to create the Derived image by adding optional Source Image Sequence (0008,2112) which can hold a list of Referenced SOP Class UID (0008,1150)/ Referenced SOP Instance UID (0008,1150) pair(s).

LEADTOOLS Support
  • 2,755
  • 1
  • 12
  • 12
  • I ended up doing that. The link on the gdcm page was very useful: http://gdcm.sourceforge.net/wiki/index.php/Writing_DICOM#Derivation_Description – Luca Nov 21 '14 at 08:57
0

Kinldy check dcmodify executable and check the help in command, it has the option to modify the tags.

0

For anything but pixel data dcmodify is the tool of your choice.

For the pixel data you can use dcmdump to extract the pixel data to a RAW file, change it and use dump2dcm to re-integrate it into the DICOM file

Markus Sabin
  • 3,916
  • 14
  • 32
  • 1
    For (uncompressed) pixel data, you could also use dcmodify's option --modify-from-file (-mf) or --insert-from-file (-if), which I've added a few years ago: http://support.dcmtk.org/docs/dcmodify.html#processing_options – J. Riesmeier Mar 11 '16 at 16:46
  • @J.Riesmeier How do I modify the pixel data in the RAW file? Is there an example of, let's say, multiplying it by 2? – Daniel May 29 '17 at 15:15
  • @dangom When using the command line tools, such as dcmdump/dump2dcm/dcmodify, it is up to you to modify the pixel data in the raw file. You could do this with another command line tool (not part of the DCMTK) or some GUI application. – J. Riesmeier May 30 '17 at 08:06