Question about the execution order of file storage and database update.

I am preparing to develop a new storage plugin to change the default OrthancStorage behavior.

Here is my idea:

I wanna merge dicom files from one series into a big file. So I need to query which series publicid the dicom file belongs.

The only problem is that I am not sure the execution order of orthanc storage of dicom file and record update of db. If orthanc store the dicom file firstly and then update the database record, then I do not think my idea can work because I could not locate the series publicid!.

Could anyone offer me some help? Does orthan update attachedfiles table firstly and then store the file? Thx ;).

Actually, files are stored first and then, the db is updated. So, indeed, that would be impossible to get the series id at the time you write the file to disk.


Given three DICOM tags (namely PatientID, StudyInstanceUID and SeriesInstanceUID), you can compute the Orthanc identifiers of the series by yourself, as described on the following page:

So, you could implement a basic DICOM parser that retrieves these 3 tags, then deduce the series public ID. A beginning of such a parser can be e.g. found in the “Orthanc::DicomMap::ParseDicomMetaInformation()” method (or you could use a full-featured DICOM library such as odil, DCMTK or gdcm):