Private Tag Questions

I’m using the Docker distribution of Orthanc 1.12.10 with a custom modality that contains private tags, and I see that they are registered in the dictionary at startup in the server logs. I also see that the tag names show up in Orthanc Explorer, so I assume I’ve registered them correctly:

  • 1949,0010 (PrivateCreator): SNL
  • 1949,1000 (Description): Stuff.
  • 1949,1002 (Location): Denver
  • 1949,1004 (Tags): foo\bar\baz

With that in mind, I wanted to confirm that the behavior I see using the /tools/find endpoint from Python is expected:

First, I can search using private tags with exact match:

>>> query = {"Level": "Instance", "Query": {"Modality": "TrainingMeta", "Location": "Denver"}}
>>> requests.post(f"{orthanc}/tools/find", auth=auth, json=query).json()
['db8fdc31-4e415b58-07de552f-2a144a45-cac334d3']

… but wildcards are not allowed:

>>> query = {"Level": "Instance", "Query": {"Modality": "TrainingMeta", "Location": "Denver*"}}
>>> requests.post(f"{orthanc}/tools/find", auth=auth, json=query).json()
{'Details': 'Wildcards are not allowed on tag 1949,1002', 'HttpError': 'Bad Request', 'HttpStatus': 400, 'Message': 'Parameter out of range', 'Method': 'POST', 'OrthancError': 'Parameter out of range', 'OrthancStatus': 3, 'Uri': '/tools/find'}

Second, RequestedTags can retrieve private tags by name, but the results don’t use the private tag names:

>>> query = {"Level": "Instance", "Query": {"Modality": "TrainingMeta", "Location": "Denver"}, "RequestedTags": ["Location"], "Expand": True}
>>> requests.post(f"{orthanc}/tools/find", auth=auth, json=query).json()[0]["RequestedTags"]
{'Unknown Tag & Data': 'Denver'}

… which makes it impossible to return more than one private tag:

>>> query = {"Level": "Instance", "Query": {"Modality": "TrainingMeta", "Location": "Denver"}, "RequestedTags": ["Location", "Tags"], "Expand": True}
>>> requests.post(f"{orthanc}/tools/find", auth=auth, json=query).json()[0]["RequestedTags"]
{'Unknown Tag & Data': 'foo\\bar\\baz'}

… so the only usable way to return private tags from a query is by number:

>>> query = {"Level": "Instance", "Query": {"Modality": "TrainingMeta", "Location": "Denver"}, "RequestedTags": ["Location", "Tags"], "Expand": True, "Short": True}
>>> requests.post(f"{orthanc}/tools/find", auth=auth, json=query).json()[0]["RequestedTags"]
{'1949,1002': 'Denver', '1949,1004': 'foo\\bar\\baz'}

Third, when I retrieve an instance with Expand=True, there is no way to retrieve Orthanc ID of the parent study without an extra round trip to the server:

>>> query = {"Level": "Instance", "Query": {"Modality": "TrainingMeta", "Location": "Denver"}, "Expand": True}
>>> requests.post(f"{orthanc}/tools/find", auth=auth, json=query).json()
[{'FileSize': 822, 'FileUuid': '60a23e6e-b91c-413c-b180-a1cd60d80d22', 'ID': 'db8fdc31-4e415b58-07de552f-2a144a45-cac334d3', 'IndexInSeries': None, 'Labels': [], 'MainDicomTags': {'InstanceCreationDate': '20251003', 'InstanceCreationTime': '161542.643970', 'SOPInstanceUID': '1.2.826.0.1.3680043.8.498.62908489879635994875872666628857885306'}, 'ParentSeries': 'ff4c50fb-dd45257d-9ca86bce-6d175199-b329f4e8', 'RequestedTags': {'Unknown Tag & Data': 'Denver'}, 'Type': 'Instance'}]

… i.e. the results contain “ParentSeries” but no “ParentStudy”. ResponseContent doesn’t seem to have any relevant option for this.

Is that all correct? Are there any options I missed that would alter these behaviors?

Thanks in advance,
Tim

Hi Tim,

I do admit the Private Tags handling is not perfect and what you observe is not surprising me. Unfortunately, there’s probably not much you can do to improve what you see.

Private Tags are complex in general mainly because multiple providers can both register the same numerical values e.g: 1949,1002 can only be resolved when attached to its PrivateCreator tag which does not happen when it is part of a tools/find response (you might try to add the PrivateCreator to the list of RequestedTags as well - it might help for the “Unknown Tag & Data” (or not :wink: ). But, using them by numbers seems more reliable.

I confirm that there is no such thing as GrandParent in the ResponseContent

Best,

Alain

Alain:

Thanks for the suggestion, I tried adding PrivateCreator to RequestedTags, but it didn’t alter the outcome. In any case, it’s helpful to know that I didn’t miss anything obvious, and I have workarounds for the current behavior.

Many thanks,
Tim