Hello,
Following up from my github post here.
@zivy thanks so much for your helpful responses on the github thread. Pasting that below for reference
Always use
ImageSeriesReader_GetGDCMSeriesFileNames
as it returns the list of files sorted along the z direction so that the series reader can create the volume correctly. The series reader just receives a list of images, looks at the distance between the first two along the z direction and assumes that this is the spacing in z for all images.In a generic setup reading DICOM isnât trivial as volume slices can reside in different directories or more commonly you have files from multiple series (volumes and other non volume images) in the same directory.
To get a good handle on DICOM reading, please skim the following:
- The Jupyter notebook illustrating image reading.
- DICOM handling examples showing basic reading-writing, which is what you want, and more advanced reading-modifying-writing.
- Script that deals with a general directory structure, relevant functions are
inspect_single_series
andinspect_series
.
I completely understand the need for reading images based on spatial coordinates. I am dealing with a large amount of diverse data so I am precomputing the slice order using z-position (and/or x, y position) based on the type of data.
Does ImageSeriesReader_GetGDCMSeriesFileNames always assume data is axial, i,e. using the z position for sort?
In addition to sorting, are there any other benefits that GetGDCMSeriesFileNames provies?
Thanks for any input on this!