In Orthanc, each patient, study, series and instance is assigned with an unique identifier that is derived from the DICOM identifiers. Contrarily to the identifiers of the DICOM standard, the Orthanc identifiers are formatted as a SHA-1 hash with a fixed length, so as to be more Web-friendly. More specifically:
Because the DICOM standard guarantees the StudyInstanceUID, SeriesInstanceUID and SOPInstanceUID tags to be globally unique, the Orthanc identifiers for studies, series and instances are also globally unique (provided no hash collision occurs, which is highly improbable).
The patient-level identifiers are not guaranteed to be globally unique, and might collide between different hospitals. For this reason, you should always do queries at the study level as soon as you deal with an application that handles patients from different hospitals.
The actual implementation of the hashing is carried on by the DicomInstanceHasher class.
If you use an old version of Orthanc (< 0.7.4) and you receive the “Exception while storing DICOM: Inexistent tag” error while storing a DICOM instance into Orthanc, please make sure that all the 4 following tags do exist in the DICOM file:
These tags are all used to index the incoming DICOM instances. The error message is more explicit starting with Orthanc 0.7.4.