Hi, I know that the itk::GDCMSeriesFileNames class allows you to generate an ordering sequence of filenames from a DICOM series. But if I have a series that should consist of, for example, 100 slices and some of those slices are missing, for example, slice 50 and 60 are missing, is it possible to determine that some slices are missing in the series?
It can be done. You could examine image position patient in each slice and check against previous and average distance between slices. While a simple case such as that can be done reliably, there are many ways in which a DICOM series can be inconsistent. Slicer implements some heuristics. Maybe @lassoan can point you to the code which does that? But you can already try it - load your data using Slicer’s DICOM module.
If you use “legacy” DICOM information objects (this is what most clinical software use today) then there is no way of knowing if files are missing because they were lost (e.g., somebody made a mistake when manually copying files) or they were just not acquired (e.g., image was acquired with variable spacing to reduce patient dose).
You can use ITK’s built-in slice spacing check mechanism to detect errors if you know that the image was acquired with uniform spacing and files were lost in the middle of the volume. If first or last slices are missing then that will not be detected as an error. If the image is acquired with variable spacing then ITK will detect that as an error and won’t be able to load the image, but you need to use a software that can resample the slices on a uniform grid, such as 3D Slicer.