attempt to deal with indices with not all combinations

I do have dicom files that have 4 indexes but some of which are not covered by all combinations.
example a fieldmap files with magnitude and computed fieldmap with four indices:
- stack
- in-stack position number
- one labelled 'Private Scanning Sequence' for values 'FFE'/'PCA' in a tag [0x2005,0x140f][0]x2005,0x106e]
- one labelled 'Private ImageTypeMR' for values 'M'/'P' in a tag [0x2005,0x140f][0][0x2005,0x1011] for magnitude and phase.

,the last two indices combinations possibles are then not fully covered, which make the current computation of image shape fail. I do not know if there are other cases possible, maybe for other mixed data types, such as SWI.
Here is an attempt to correct it by detecting "collinear" indices but it might not work for complex dataset with more data types stored.