I’ve operated under the assumption that it is not possible to target DICOM tags in sequences for remove/keep/modify operations - except by reconstructing entire sequences.
For example, I often replace the image UID in ReferencedImageSequence with anonymized UID so that my anonymized series consistently refer to each other after anonymization. I find I have to construct the entire ReferencedImageSequence with my changes and use a modify with ‘Replace’ in the JSON - RATHER than being able to target the specific tag in the ReferencedImageSequence I want to replace.
works: ‘Replace’ = entire sequence including parts I don’t need to modify
does not work: ‘Replace’ = just the part of the sequence I want to change
Is that correct? Is there a way I can construct the Remove/Modify JSON in such a way to eliminate/replace a particular tag within a sequence (ex. a UID within ReferencedImageSequence) while still keeping the rest of the sequence?
Thanks,
John.
As of Orthanc 1.9.3, it is not possible to selectively replace/insert/remove tags in nested sequences, and I have added an item on our roadmap:
https://hg.orthanc-server.com/orthanc/rev/3badc205cb4c
Such a feature is definitely not straightforward, as a new syntax must be defined. Typically the kind of features for which a support from the industry would be necessary.
In the meantime, you could use a Python plugin that either calls the “dcmodify” command-line tool or that uses pydicom to modify the DICOM instances:
https://book.orthanc-server.com/plugins/python.html
An external script that uses the REST API of Orthanc could be envisioned as well.
Sébastien-
Thanks, Sebastien. I’ll probably explore the pydicom approach at some point when I convert my scripts from Lua to Python.
By the way, it seems like a nested tree like structure can represent the DICOM tags. I mean, it all gets stuffed into a JSON when using the REST api anyway.
So what makes it difficult to modify a particular leaf in the nested tree without having to replace the whole branch? Are there some sort of binary offset pointers behind the scenes that all need to be updated?
John.
“So what makes it difficult to modify a particular leaf”
=> The difficulty is that I don’t have an infinite bandwidth to implement by myself each and every request. Any new feature must be carefully designed, implemented, documented, tested, released and maintained, which takes much time. This is why plugins have been introduced in Orthanc: To allow you to implement the features you need before they are possibly introduced in the mainline of Orthanc.
I understand. Your diligence has produced a very dependable system. I’m still amazed you have time to answer questions here. When I post questions to forums, I usually expect to hear mostly from fellow users and seldom from the developers.
Thanks for all your work and responses.
John.
As a followup to this message, Orthanc 1.9.4 implements target Remove/Keep/Modify of nested tags in sequences, as mentioned in the following message on another of your threads:
https://groups.google.com/g/orthanc-users/c/l1mcYCC2u-k/m/pSp_h83kAQAJ
Sébastien-