@@ -475,7 +475,7 @@ def image_shape(self):
475
475
for frame in self .frames ])
476
476
477
477
# Check that there is only one multiframe stack index
478
- stack_ids = set (frame .FrameContentSequence [0 ].get ( ' StackID' )
478
+ stack_ids = set (frame .FrameContentSequence [0 ].StackID
479
479
for frame in self .frames )
480
480
if len (stack_ids ) > 1 :
481
481
raise WrapperError ("File contains more than one StackID. "
@@ -484,15 +484,16 @@ def image_shape(self):
484
484
# Determine if one of the Dimension indices refers to the stack id
485
485
dim_seq = [(dim .DimensionIndexPointer , dim .FunctionalGroupPointer )
486
486
for dim in self .get ('DimensionIndexSequence' )]
487
- try :
488
- stack_dim_idx = dim_seq .index (((0x14 , 0x2369 ), (0x14 , 0x2397 )))
489
- except ValueError :
490
- stack_dim_idx = None
491
-
492
- # remove superfluous stack id index
493
- if stack_dim_idx is not None :
487
+ # the pointer pair (StackID tag, FrameContentSequence tag) that
488
+ # indicates that the dimension refers to the StackID
489
+ stack_id_dim_pointer = ((0x20 , 0x9056 ), (0x20 , 0x9111 ))
490
+ # remove superfluous stack id index if present
491
+ if stack_id_dim_pointer in dim_seq :
492
+ stack_dim_idx = dim_seq .index (stack_id_dim_pointer )
494
493
frame_indices = np .delete (frame_indices , stack_dim_idx , axis = 1 )
495
494
495
+ # account for the 2 additional dimensions (row and column) not included
496
+ # in the indices
496
497
n_dim = frame_indices .shape [1 ] + 2
497
498
# Store frame indices
498
499
self ._frame_indices = frame_indices
0 commit comments