@@ -427,13 +427,6 @@ def fake_shape_dependents(
427427 generate ipp values so slice location is negatively correlated with slice index
428428 """
429429
430- class PrintBase :
431- def __repr__ (self ):
432- attr_strs = [
433- f'{ attr } ={ getattr (self , attr )} ' for attr in dir (self ) if attr [0 ].isupper ()
434- ]
435- return f"{ self .__class__ .__name__ } ({ ', ' .join (attr_strs )} )"
436-
437430 class DimIdxSeqElem (pydicom .Dataset ):
438431 def __init__ (self , dip = (0 , 0 ), fgp = None ):
439432 super ().__init__ ()
@@ -444,8 +437,8 @@ def __init__(self, dip=(0, 0), fgp=None):
444437 class FrmContSeqElem (pydicom .Dataset ):
445438 def __init__ (self , div , sid ):
446439 super ().__init__ ()
447- self .DimensionIndexValues = div
448- self .StackID = sid
440+ self .DimensionIndexValues = list ( div )
441+ self .StackID = str ( sid )
449442
450443 class PlnPosSeqElem (pydicom .Dataset ):
451444 def __init__ (self , ipp ):
@@ -545,17 +538,28 @@ def test_shape(self):
545538 with pytest .raises (didw .WrapperError ):
546539 dw .image_shape
547540 fake_mf .Rows = 32
548- # No frame data raises WrapperError
541+ # Single frame doesn't need dimension index values
542+ assert dw .image_shape == (32 , 64 )
543+ assert len (dw .frame_order ) == 1
544+ assert dw .frame_order [0 ] == 0
545+ # Multiple frames do require dimension index values
546+ fake_mf .PerFrameFunctionalGroupsSequence = [pydicom .Dataset (), pydicom .Dataset ()]
549547 with pytest .raises (didw .WrapperError ):
550- dw .image_shape
548+ MFW ( fake_mf ) .image_shape
551549 # check 2D shape with StackID index is 0
552550 div_seq = ((1 , 1 ),)
553551 fake_mf .update (fake_shape_dependents (div_seq , sid_dim = 0 ))
554- assert MFW (fake_mf ).image_shape == (32 , 64 )
552+ dw = MFW (fake_mf )
553+ assert dw .image_shape == (32 , 64 )
554+ assert len (dw .frame_order ) == 1
555+ assert dw .frame_order [0 ] == 0
555556 # Check 2D shape with extraneous extra indices
556557 div_seq = ((1 , 1 , 2 ),)
557558 fake_mf .update (fake_shape_dependents (div_seq , sid_dim = 0 ))
558- assert MFW (fake_mf ).image_shape == (32 , 64 )
559+ dw = MFW (fake_mf )
560+ assert dw .image_shape == (32 , 64 )
561+ assert len (dw .frame_order ) == 1
562+ assert dw .frame_order [0 ] == 0
559563 # Check 2D plus time
560564 div_seq = ((1 , 1 , 1 ), (1 , 1 , 2 ), (1 , 1 , 3 ))
561565 fake_mf .update (fake_shape_dependents (div_seq , sid_dim = 0 ))
@@ -569,7 +573,7 @@ def test_shape(self):
569573 fake_mf .update (fake_shape_dependents (div_seq , sid_dim = 0 ))
570574 with pytest .warns (
571575 UserWarning ,
572- match = 'A multi-stack file was passed without an explicit filter, just using lowest StackID ' ,
576+ match = 'A multi-stack file was passed without an explicit filter,' ,
573577 ):
574578 assert MFW (fake_mf ).image_shape == (32 , 64 , 3 )
575579 # No warning if we expclitly select that StackID to keep
@@ -581,7 +585,7 @@ def test_shape(self):
581585 fake_mf .update (fake_shape_dependents (div_seq , sid_seq = sid_seq ))
582586 with pytest .warns (
583587 UserWarning ,
584- match = 'A multi-stack file was passed without an explicit filter, just using lowest StackID ' ,
588+ match = 'A multi-stack file was passed without an explicit filter,' ,
585589 ):
586590 assert MFW (fake_mf ).image_shape == (32 , 64 , 3 )
587591 # No warning if we expclitly select that StackID to keep
@@ -599,7 +603,7 @@ def test_shape(self):
599603 fake_mf .update (fake_shape_dependents (div_seq , sid_dim = 0 ))
600604 with pytest .warns (
601605 UserWarning ,
602- match = 'A multi-stack file was passed without an explicit filter, just using lowest StackID ' ,
606+ match = 'A multi-stack file was passed without an explicit filter,' ,
603607 ):
604608 with pytest .raises (didw .WrapperError ):
605609 MFW (fake_mf ).image_shape
@@ -638,7 +642,7 @@ def test_shape(self):
638642 fake_mf .update (fake_shape_dependents (div_seq , sid_seq = sid_seq ))
639643 with pytest .warns (
640644 UserWarning ,
641- match = 'A multi-stack file was passed without an explicit filter, just using lowest StackID ' ,
645+ match = 'A multi-stack file was passed without an explicit filter,' ,
642646 ):
643647 with pytest .raises (didw .WrapperError ):
644648 MFW (fake_mf ).image_shape
@@ -651,7 +655,7 @@ def test_shape(self):
651655 fake_mf .update (fake_shape_dependents (div_seq , sid_dim = 1 ))
652656 with pytest .warns (
653657 UserWarning ,
654- match = 'A multi-stack file was passed without an explicit filter, just using lowest StackID ' ,
658+ match = 'A multi-stack file was passed without an explicit filter,' ,
655659 ):
656660 assert MFW (fake_mf ).image_shape == (32 , 64 , 3 )
657661 # Make some fake frame data for 4D when StackID index is 1
0 commit comments