Sequence of instance numbers in ZIP and DIRCOM archives downloaded from Orthanc

Hello,

Doing some tests with DICOM teaching files stored on Orthanc, I noticed that the files downloaded from Orthanc as ZIP-archive or DICOMDIR-archive are not numbered in the same order as the DICOM instance numbers (tag 0020, 0013).

The following figure shows the sequence of my small DICOM study uploaded with the REST API.

As expected, the images are displayed in the same order in the Orthanc Webviewer.

The next figure shows the sequence of the study downloaded as ZIP-archive from Orthanc.

The differences in the sequence are visible.

The twenty DICOM instances are listed as follows in the ZIP- and DICOMDIR-archives :

2, 3, 1, 4, 6, 5, 7, 8, 9, 10, 12, 11, 13, 14, 15, 16, 17, 18, 19, 20

I explored the available documentation, but I was not able to deduct if this behavior of Orthanc is standard or a bug ?

best regards,

Marco Barnig

Dear Marco,

The DICOM standard does not say anything about how the DICOM files should be named or ordered within a DICOMDIR, so this is not a bug in Orthanc.

As always, a contributed plugin could be developed so as to order the files following your wishes:
http://book.orthanc-server.com/developers/creating-plugins.html

Regards,
Sébastien-

Dear Sébastien,

thank you for your quick answer.

In my current RadioLogic Javascript implementation, I am loading the JSON data returned by the Orthanc REST API in arrays, without sorting them. It’s only recently that I dicovered that the results are not always in sequence and therefore I did the tests with the ZIP and DICOMDIR archives.

I just started now to modify my javascript code to sort the arrays based on the InstanceNumber.

Your suggestion to develop a plugin is a good idea. Even if I don’t need the ZIP and DICOMDIR archives to progress with my project, such a plugin is a project with a limited scope which will be useful to get a first experience with C++ and Orthanc plugins.

It’s now on my short term ToDo list.

best regards,

Marco Barnig

complimentary info:

I got good inspirations from the Orthanc explorer.js code.

Marco Barnig

Great! Let us know once you make progress :slight_smile:

FYI, the “/series/{…}/ordered-slices” URI in the REST API of Orthanc implements the sorting of the instances of the given series. This URI will notably sort the slices of a 3D volume, using the physical location of the individual slices.

Cheers,
Sébastien-