@@ -82,19 +82,6 @@ class TestNifti1PairHeader(tana.TestAnalyzeHeader, tspm.HeaderScalingMixin):
82
82
np .longcomplex ))
83
83
tana .add_intp (supported_np_types )
84
84
85
- def setUp (self ):
86
- # Add warning filters for duration of test case
87
- self ._wctx = warnings .catch_warnings ()
88
- self ._wctx .__enter__ ()
89
- warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
90
- warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
91
- warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
92
- UserWarning )
93
-
94
- def tearDown (self ):
95
- # Restore warning filters
96
- self ._wctx .__exit__ ()
97
-
98
85
def test_empty (self ):
99
86
tana .TestAnalyzeHeader .test_empty (self )
100
87
hdr = self .header_class ()
@@ -720,6 +707,30 @@ def test_recoded_fields(self):
720
707
assert_equal (hdr .get_value_label ('slice_code' ),
721
708
'alternating decreasing' )
722
709
710
+ def test_general_init (self ):
711
+ with clear_and_catch_warnings () as warns :
712
+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
713
+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
714
+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
715
+ UserWarning )
716
+ super (TestNifti1PairHeader , self ).test_general_init ()
717
+
718
+ def test_from_header (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_from_header ()
725
+
726
+ def test_data_shape_zooms_affine (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_data_shape_zooms_affine ()
733
+
723
734
724
735
def unshear_44 (affine ):
725
736
RZS = affine [:3 , :3 ]
@@ -766,19 +777,6 @@ class TestNifti1Pair(tana.TestAnalyzeImage, tspm.ImageScalingMixin):
766
777
image_class = Nifti1Pair
767
778
supported_np_types = TestNifti1PairHeader .supported_np_types
768
779
769
- def setUp (self ):
770
- # Add warning filters for duration of test case
771
- self ._wctx = warnings .catch_warnings ()
772
- self ._wctx .__enter__ ()
773
- warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
774
- warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
775
- warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
776
- UserWarning )
777
-
778
- def tearDown (self ):
779
- # Restore warning filters
780
- self ._wctx .__exit__ ()
781
-
782
780
def test_none_qsform (self ):
783
781
# Check that affine gets set to q/sform if header is None
784
782
img_klass = self .image_class
@@ -1222,6 +1220,14 @@ def test_zooms_edge_cases(self):
1222
1220
assert_raises (ValueError , img .header .set_zooms , (3 , 3 , 3 , 3.5 ),
1223
1221
units = 'badparam' )
1224
1222
1223
+ def test_no_finite_values (self ):
1224
+ with clear_and_catch_warnings () as warns :
1225
+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
1226
+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
1227
+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
1228
+ UserWarning )
1229
+ super (TestNifti1Pair , self ).test_no_finite_values ()
1230
+
1225
1231
1226
1232
class TestNifti1Image (TestNifti1Pair ):
1227
1233
# Run analyze-flavor spatialimage tests
0 commit comments