Creating Custom Tags

Hi,

Good day!

I would like to inquire about the possibility of creating custom tags within Orthanc. Specifically, I’m interested in incorporating a “Room Number” attribute into our DICOM data storage system. After some consideration, I’m contemplating the option of utilizing metadata for this purpose.

However, before proceeding, I wanted to consult with you to explore alternative solutions or best practices. Given your expertise in this area, I would greatly appreciate any insights or suggestions you may have regarding the most effective way to implement custom tags in our Orthanc setup.

Thank you very much for your time and assistance.

Thanks,
Sijiem

Hello

I depends on the actual use case for this value. Is this something that you only need to query on Orthanc-stored instances, with REST calls? In that case, metadata are easy to use and effective : they will be stored in the DB and reading or writing them does not require reading or modifying actual DICOM instances.

If, on the other hand, you need these values to be stored in the DICOM file itself, so that you can send this DICOM to someone who will need to read this RoomNumber value, then you need to create a private DICOM tag.

Pay attention to the fact that private tags are not simply free slots that you can fill with arbitrary data: they require setting up a so-called creator tag in addition to the value tags themselves. For instance, here’s how you can set private tags with pydicom (useful in case you generate them along with the original DICOM data) :

Regardless of whether you’re using private tags or metadata, if you want to be able to access them by name, then you need to define these names in the Orthanc configuration file ("UserContentType" for metadata and "Dictionary" for private tags).

Please note that, if you use metadata and you need to migrate to another Orthanc instance, you need to write a script to migrate the metadata, for the usual migration methods only preserve the DICOM content and not the DB itself.

More info on the metadata in Orthanc can be found here

HTH

1 Like

Thank you Benjamin!