2
votes

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.

3

3 Answers

4
votes

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).

0
votes

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

0
votes

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