Slice order in dicom loader

Hi,
I wanted to confirm the mechanism with which Slicer orders dicom slices. I need the slice order (basically z-coordinate value) with filenames to write to csv for my application use and I found that the examineFiles function in DICOMScalarVolumePlugin.py uses getSortedImageFiles function DICOMUtils.py to order them.
I wanted to know whether is this the Slicer’s backend for showing ordered slices in Slicer viewer so I can call this examineFiles function to get array of sorted files and index them accordingly to write to csv. Also I wanted to know the epsilon and where does this function gets epsilon from. Thanks

1 Like

Yes, that is the right method that determines the order of the dicom instances. If you load the data and need to know the mapping from volume slices to dicom instances, you can use the DICOM.instanceUIDs attribute of the node.

As for epsilon, it’s set to 0.01mm by default as a practical compromise based on medical imaging technologies where slice spacing may vary a bit due to rounding error or limitations of the device while still forming usable volumes.

1 Like

@pieper Thanks for confirming it, I will proceed to using this for my application.

Regards