The DICOM reader was not working properly for reading a single timepoint of a 4D scan. It would crash when the TemporalPositionIndex is 3 but the data of timepoints 1 and 2 are not present because we are not trying to read the entire 4D sequence but only one 3D image from the sequence. This PR changes the logic to counting the number of distinct TemporalPositionIndex values instead of using the maximum value.
The DICOM reader was not working properly for reading a single timepoint of a 4D scan. It would crash when the TemporalPositionIndex is 3 but the data of timepoints 1 and 2 are not present because we are not trying to read the entire 4D sequence but only one 3D image from the sequence. This PR changes the logic to counting the number of distinct TemporalPositionIndex values instead of using the maximum value.