@@ -80,19 +80,6 @@ class TestNifti1PairHeader(tana.TestAnalyzeHeader, tspm.HeaderScalingMixin):
80
80
np .longcomplex ))
81
81
tana .add_intp (supported_np_types )
82
82
83
- def setUp (self ):
84
- # Add warning filters for duration of test case
85
- self ._wctx = warnings .catch_warnings ()
86
- self ._wctx .__enter__ ()
87
- warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
88
- warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
89
- warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
90
- UserWarning )
91
-
92
- def tearDown (self ):
93
- # Restore warning filters
94
- self ._wctx .__exit__ ()
95
-
96
83
def test_empty (self ):
97
84
tana .TestAnalyzeHeader .test_empty (self )
98
85
hdr = self .header_class ()
@@ -728,6 +715,30 @@ def test_recoded_fields(self):
728
715
hdr ['slice_code' ] = 4 # alternating decreasing
729
716
assert hdr .get_value_label ('slice_code' ) == 'alternating decreasing'
730
717
718
+ def test_general_init (self ):
719
+ with clear_and_catch_warnings () as warns :
720
+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
721
+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
722
+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
723
+ UserWarning )
724
+ super (TestNifti1PairHeader , self ).test_general_init ()
725
+
726
+ def test_from_header (self ):
727
+ with clear_and_catch_warnings () as warns :
728
+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
729
+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
730
+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
731
+ UserWarning )
732
+ super (TestNifti1PairHeader , self ).test_from_header ()
733
+
734
+ def test_data_shape_zooms_affine (self ):
735
+ with clear_and_catch_warnings () as warns :
736
+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
737
+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
738
+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
739
+ UserWarning )
740
+ super (TestNifti1PairHeader , self ).test_data_shape_zooms_affine ()
741
+
731
742
732
743
def unshear_44 (affine ):
733
744
RZS = affine [:3 , :3 ]
@@ -775,19 +786,6 @@ class TestNifti1Pair(tana.TestAnalyzeImage, tspm.ImageScalingMixin):
775
786
image_class = Nifti1Pair
776
787
supported_np_types = TestNifti1PairHeader .supported_np_types
777
788
778
- def setUp (self ):
779
- # Add warning filters for duration of test case
780
- self ._wctx = warnings .catch_warnings ()
781
- self ._wctx .__enter__ ()
782
- warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
783
- warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
784
- warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
785
- UserWarning )
786
-
787
- def tearDown (self ):
788
- # Restore warning filters
789
- self ._wctx .__exit__ ()
790
-
791
789
def test_none_qsform (self ):
792
790
# Check that affine gets set to q/sform if header is None
793
791
img_klass = self .image_class
@@ -1234,6 +1232,14 @@ def test_zooms_edge_cases(self):
1234
1232
assert_raises (ValueError , img .header .set_zooms , (3 , 3 , 3 , 3.5 ),
1235
1233
units = 'badparam' )
1236
1234
1235
+ def test_no_finite_values (self ):
1236
+ with clear_and_catch_warnings () as warns :
1237
+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
1238
+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
1239
+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
1240
+ UserWarning )
1241
+ super (TestNifti1Pair , self ).test_no_finite_values ()
1242
+
1237
1243
1238
1244
class TestNifti1Image (TestNifti1Pair ):
1239
1245
# Run analyze-flavor spatialimage tests
0 commit comments