@@ -83,19 +83,6 @@ class TestNifti1PairHeader(tana.TestAnalyzeHeader, tspm.HeaderScalingMixin):
83
83
np .longcomplex ))
84
84
tana .add_intp (supported_np_types )
85
85
86
- def setUp (self ):
87
- # Add warning filters for duration of test case
88
- self ._wctx = warnings .catch_warnings ()
89
- self ._wctx .__enter__ ()
90
- warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
91
- warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
92
- warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
93
- UserWarning )
94
-
95
- def tearDown (self ):
96
- # Restore warning filters
97
- self ._wctx .__exit__ ()
98
-
99
86
def test_empty (self ):
100
87
tana .TestAnalyzeHeader .test_empty (self )
101
88
hdr = self .header_class ()
@@ -731,6 +718,30 @@ def test_recoded_fields(self):
731
718
hdr ['slice_code' ] = 4 # alternating decreasing
732
719
assert hdr .get_value_label ('slice_code' ) == 'alternating decreasing'
733
720
721
+ def test_general_init (self ):
722
+ with clear_and_catch_warnings () as warns :
723
+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
724
+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
725
+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
726
+ UserWarning )
727
+ super (TestNifti1PairHeader , self ).test_general_init ()
728
+
729
+ def test_from_header (self ):
730
+ with clear_and_catch_warnings () as warns :
731
+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
732
+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
733
+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
734
+ UserWarning )
735
+ super (TestNifti1PairHeader , self ).test_from_header ()
736
+
737
+ def test_data_shape_zooms_affine (self ):
738
+ with clear_and_catch_warnings () as warns :
739
+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
740
+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
741
+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
742
+ UserWarning )
743
+ super (TestNifti1PairHeader , self ).test_data_shape_zooms_affine ()
744
+
734
745
735
746
def unshear_44 (affine ):
736
747
RZS = affine [:3 , :3 ]
@@ -778,19 +789,6 @@ class TestNifti1Pair(tana.TestAnalyzeImage, tspm.ImageScalingMixin):
778
789
image_class = Nifti1Pair
779
790
supported_np_types = TestNifti1PairHeader .supported_np_types
780
791
781
- def setUp (self ):
782
- # Add warning filters for duration of test case
783
- self ._wctx = warnings .catch_warnings ()
784
- self ._wctx .__enter__ ()
785
- warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
786
- warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
787
- warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
788
- UserWarning )
789
-
790
- def tearDown (self ):
791
- # Restore warning filters
792
- self ._wctx .__exit__ ()
793
-
794
792
def test_int64_warning (self ):
795
793
# Verify that initializing with (u)int64 data and no
796
794
# header/dtype info produces a warning
@@ -1311,6 +1309,14 @@ def test_zooms_edge_cases(self):
1311
1309
assert_raises (ValueError , img .header .set_zooms , (3 , 3 , 3 , 3.5 ),
1312
1310
units = 'badparam' )
1313
1311
1312
+ def test_no_finite_values (self ):
1313
+ with clear_and_catch_warnings () as warns :
1314
+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
1315
+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
1316
+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
1317
+ UserWarning )
1318
+ super (TestNifti1Pair , self ).test_no_finite_values ()
1319
+
1314
1320
1315
1321
class TestNifti1Image (TestNifti1Pair ):
1316
1322
# Run analyze-flavor spatialimage tests
0 commit comments