Hello ,
In my understanding, this is already built into Orthanc.
By default, duplicate instances with the same Orthanc ID will not be stored by Orthanc, unless you set OverwriteInstances
to true
.
Please note that this “no duplicate” rule is with respect to the Orthanc ID which, for an instance, depends upon PatientID
, StudyInstanceUID
, SeriesInstanceUID
and SOPInstanceUID
(reference).
So, if you write several instances with the same SOPInstanceUID
but where the other IDs are different, this can lead to duplicates.
The default makes sense because the DICOM model is supposed to be immutable : in order to change data, you need to generate new objects with new IDs, although in some cases (like development), it can be useful to replace instances.
If you are in this particular situation, you might find some inspiration in the replies to this question : Checking for Duplicated instances with same instance number - General - Orthanc Users
–B