Modification of DICOM tags without changing UUID.

724 views
Skip to first unread message

İhsan Töre

unread,
Oct 22, 2018, 10:44:01 AM10/22/18
to Orthanc Users
Hi all,

When I use rest api to modify dicom tags (/modify), orthanc gives me a new modified copy of the file.
Therefore the UUID's change, which means WADO links too. 
I have to send the WADO links to a remote entity.
So when operators make errors, I update the tags but the link already sent becomes invalid.
I can not update the WADO link sent. 
In my use case, I have to modify the tags in the original dicom file. Is that possible?

Thanks in advance for your interest.
IVT.

Sébastien Jodogne

unread,
Oct 23, 2018, 11:08:48 AM10/23/18
to Orthanc Users
You should never have the same value of the "SOP Instance UID" tag (0x0008,0x0018) in two DICOM files that encode a different information. This would break medical traceability.

If you *really* know what you are doing, you can use the "Force" option when modifying one single DICOM instance:

For example:

# curl http://localhost:8042/instances/5eb2dd5f-3fca21a8-fa7565fd-63e112ae-344830a4/modify -d '{"Replace":{"PatientName":"HELLO","SOPInstanceUID":"1.2.276.0.7230010.3.1.4.8323329.23447.1540306866.600531"},"Force":true}' > modified.dcm

Setting the "OverwriteInstances" configuration option of Orthanc to "true" will allow you to re-upload this modified file into Orthanc, replacing the previous one:

HTH

İhsan Töre

unread,
Oct 24, 2018, 12:30:21 PM10/24/18
to Orthanc Users
Dear Sébastien,

What I want to do is : 
Correction of user input mistakes in DICOM data at Patient or Study levels without changing Patient/ Study / Series / SOPInstance UID's  

What /modify does:
At Patient level it generates a COPY of each instance belonging to Patient, modify it (Studies/Series/Instance) while assigning new UID's at every level.
At Study   level it generates a COPY of each instance belonging to Study, modify it (Series/Instance) while assigning new UID's at every level.

What I want:
At Patient level, modify each instance IN PLACE belonging to Patient (Studies/Series/Instances)  WITHOUT assigning new UID's.
At Study   level, modify each instance IN PLACE belonging to Study   (Series/instances)               WITHOUT assigning new UID's.

The workarounds I've found could be described only with the word : Pathetic :D;
IF At Patient level get All Patient data out of orthanc and delete originals.
IF At Study   level get All Study   data out of orthanc and delete originals.  
Modify with a DCMTK tool .
Send back to orthanc.
This is a killer time consumer.
Thanks.
IVT.

Benjamin Winkler

unread,
Oct 25, 2018, 6:19:11 AM10/25/18
to Orthanc Users
I have the very same problem here: i want to add a private DICOM Tag  to each instance after it has been stored by Orthanc. 

The only solution i have found so far is the mentioned "modify >> delete original >> create new instance with old UID"-way.

A simple way to modify (or add) tags of an existing Instance/Series/Study would be much appreciated! :)

Sébastien Jodogne

unread,
Oct 26, 2018, 2:16:32 AM10/26/18
to Orthanc Users
Hello,

This feature can readily be added to Orthanc by implementing a third-party plugin:

This plugin would:
On startup, this plugin could also check whether the aforementioned option "OverwriteInstances" is set to true in the configuration of Orthanc, that can be retrieved with "OrthancPluginGetConfiguration()":

Always remember that Orthanc is free and open-source project, and that you should give back to it:

Regards,
Sébastien-

Stacy Loesch

unread,
Jun 10, 2020, 5:10:13 PM6/10/20
to Orthanc Users
I have tried implementing this plugin as you describe below.  I believe I have sucessfully completed these steps as evidenced by the fact I can see all of the instances for the patient now have the new PatientName in the DICOM tag 0010, 0010.   However the Orthanc explorer still displays the old name.  I have confirmed this is the case by using sqlite browser to manually edit the MainDicomTag table for the appropriate resource of the patient.  But I don't see how I can do this operation from my plugin that I have written. 

And the documentation for the existing modify operation says you simply cannot edit the name without editing PatientID (which I don't want to do).

Any suggestions?

Sébastien Jodogne

unread,
Jun 12, 2020, 1:45:41 AM6/12/20
to Orthanc Users
Once a patient/study/series is created in Orthanc, an excerpt of its so-called "main DICOM tags" is extracted and stored into the database (SQLite/PostgreSQL/MySQL). This is this set of tags that is displayed by Orthanc Explorer.

To ensure consistency and performance, this information is never automatically changed, as long as the patient/study/series is not deleted. 

You can ask Orthanc to refresh its index by calling the "/{patients|studies|series|instances}/.../reconstruct" route in the REST API (it is a POST without a body).

For instance, in your case, after modifying some instance with Orthanc identifier "{id}" and uploading it back, you could POST to "/instances/{id}/reconstruct" in order to update the main DICOM tags.

HTH

Stacy Loesch

unread,
Jun 12, 2020, 9:12:52 AM6/12/20
to Orthanc Users
Aha!!   Now I have success.   Thanks very much.

Stacy.

Daniel Drucker

unread,
Dec 21, 2020, 12:49:08 PM12/21/20
to Orthanc Users
Stacy,

Would you be willing to share this plugin? I'm also very interested in being able to do in-place modification of DICOM tags!

Thanks!

Juan Nicolau

unread,
Feb 9, 2022, 7:01:19 AM2/9/22
to Orthanc Users
Hi, I'm also very interested in in-place modification of dicom tags of an instance. It would be great if Stacy can share it.

On the other hand , Is there any tutorial to start a plugin in python or c++?
Thanks
Reply all
Reply to author
Forward
0 new messages