Working with private tags

Hello, friends

In working in a polling/routing solution, I came accross the concept of private tags/dictionary and I thought it would be a good idea.

But is there a 100% Orthanc solution to go about tagging instances with custom private tags? Any pointers?

I believe a starting point is the OrthancPluginRegisterPrivateDictionaryTag function.

http://sdk.orthanc-server.com/group__Toolbox.html#ga1dd60845d992d4cbff29fc8615de1db8

Then again, how do I actually tag an image in a plugin?

Thanks!

When you’re defining your own private dictionary, you actually simply define “aliases”.
Your private tag name will be displayed in the …/tags output and you can use your tag name in other routes like /modify.

If you want to add a DICOM tag to an instance, the only thing you can do is to modify that instance by calling the rest API from the plugin (http://book.orthanc-server.com/users/anonymization.html?highlight=modify)

Hi Alain!

Thaks for your answer. I’ve got a couple of questions:

  1. The use of the /modify URL as per the link you mentioined, does it mean the instance will be anonimized? Or can I use it to just change the value of a tag (be it private or otherwise)?
  2. Though I could mess with Institution name, I want to create a new private/custom tag. For that I undnerstand I must use the OrthancPluginRegisterDictionaryTag function. Is that correct? If so, then how do I go about selecting a proper group/element id without clashing with other private tags that might exist already?
  3. (2 complement) If not, can I just tag replacing for a non-existing tag and will it be inserted?

I read it now and it souds a little confusing to me. In case it really is, please let me know and I’ll rewrite whatever needs to be rewritten.

Luiz

Hello,

I am unsure to understand your needs.

The “DICOM private tags” are non-standardized tags that are embedded inside the DICOM files, and that are specific to one given manufacturer. I’m really not sure this is what you are looking for, as you are dealing with DICOM automation, which implies your workflow should not modify the DICOM files.

If you are trying to associate some user-defined value with some DICOM instance in the Orthanc database (without modifying the DICOM file itself), you are actually looking for “metadata”. Please carefully review this section of the Orthanc Book:
http://book.orthanc-server.com/faq/features.html#metadata-attachments

In a plugin, you can tag a DICOM instance with some metadata using the REST API, through the “OrthancPluginRestApiPut()” function:
http://book.orthanc-server.com/faq/features.html#accessing-metadata

http://sdk.orthanc-server.com/group__Orthanc.html#gaca16bb1e111518263d68fe0f4d37add4

HTH,
Sébastien-

Hi Sebastien!

I’d like to tag a DICOM instance because I’d like a certain information to be embedded in the file itself. Let me try and explain why.

Images will be routed back and forth. Eventually an OsiriX instance will feed the system a new series based on pre-existing instances. Because of this, the Origin of the image must be preserved.

This is why I’d like to tag the image. So the relevant information goes within it and, more importantly, is still within it when OsiriX sends back the exported new series.

Metadata is not enough because it stays within Orthanc while Osirix generates new SopInstanceUID’s. This information must reach OsiriX so it preserves it when exporting.

I will also check with our customer if we can lock the study itself to any given hospital. This way we can register the study origin on a central server we’re working on. Personally I believe this is suboptimal since it represents a single point of failure on a cluster’ish scenario. But I digress.

PS: I apoligize for the other thread. I felt it was a necro’ing and I didn’t want to just “bump it”.

Thanks!
Luiz

Dear Luiz,

Since yesterday, it is possible to use the “/{patients|studies|series|instances}/{id}/modify” route of the REST API to inject private DICOM tags. This is a direct consequence of solving this issue:
https://bitbucket.org/sjodogne/orthanc/issues/140

You can find a working example in the “test_bitbucket_issue_140” integration test:
https://bitbucket.org/sjodogne/orthanc-tests/src/default/Tests/Tests.py

Note that for this process to work, private tags must be declared in the “Dictionary” configuration option of Orthanc. Here is the configuration that corresponds to the integration test above:

{
[…]
“Dictionary” : {
“4321,1012” : [ “LO”, “RadioButton3”, 1, 1, “RadioLogic” ]
}
}

Note the private creator that is set to “RadioLogic”, which must also be provided to the “…/modify” route in the POST body through the new “PrivateCreator” argument.

HTH,
Sébastien-