Reputation: 1797
I am looking for an application, either inside or outside Python, that will allow me to take an existing DICOM file, subsequently add some markers to the medical image (e.g. coloured points) and then save the coordinates of these markers and the final image. Is this something that can be done in e.g. PyDicom or another program? any thoughts welcome.
Upvotes: 2
Views: 3223
Reputation: 12506
You should never edit an existing DICOM instance. Long story short, DICOM stores what is called a unique identifier called Unique Instance UID
. What this means is that if you edit the file, add a post-modality Overlay and then send it back to the PACS system it will be discarded (by design!).
So instead the usual approach is to create another DICOM instance, in this case I would suggest a simple Grayscale Softcopy Presentation State IOD, and then simply reference the existing DICOM image. You can have as many Grayscale Softcopy Presentation State instances as you want, making it much more flexible than a crude in-place editing of an existing DICOM instance.
Upvotes: 5
Reputation: 2298
Let me extend @malat's answer a bit.
You can use the pydicom library to write new DICOM files from scratch. In your case, you will want to look through the Grayscale Softcopy Presentation State CIOD, and for each module marked "M" for mandatory, fill in all of the attributes marked "1" (for required), or "1C" (for conditionally required). You should also fill in any marked "2" or "2C" (for required if known).
A lot of the DICOM tags you will be able to copy from the image that you are annotating. E.g. the Type of Patient ID is required and is in a mandatory module, so you could copy its value over from the original image.
Most of the new data that you would be generating would go into the Overlay Plane module.
Upvotes: 2