@@ -94,7 +94,7 @@ class TestEcatSubHeader(ParametricTestCase):
94
94
hdr = header_class .from_fileobj (fid )
95
95
mlist = mlist_class (fid , hdr )
96
96
subhdr = subhdr_class (hdr , mlist , fid )
97
- fid . close ()
97
+
98
98
99
99
def test_subheader_size (self ):
100
100
yield assert_equal (self .subhdr_class ._subhdrdtype .itemsize , 242 )
@@ -105,5 +105,16 @@ def test_subheader(self):
105
105
yield assert_equal (self .subhdr .get_nframes (),
106
106
len (self .subhdr .subheaders ))
107
107
yield assert_equal (self .subhdr ._check_affines (), True )
108
- yield assert_array_equal (np .diag (self .subhdr .get_frame_affine ()),
109
- np .array ([ 2.20241979 , 2.20241979 , 3.125 , 1. ]))
108
+ yield assert_array_almost_equal (np .diag (self .subhdr .get_frame_affine ()),
109
+ np .array ([ 2.20241979 , 2.20241979 , 3.125 , 1. ]))
110
+ yield assert_equal (self .subhdr .get_zooms ()[0 ], 2.20241978764534 )
111
+ yield assert_equal (self .subhdr .get_zooms ()[2 ], 3.125 )
112
+ yield assert_equal (self .subhdr ._get_data_dtype (0 ),np .dtype ('ushort' ))
113
+ yield assert_equal (self .subhdr ._get_frame_offset (), 1536 )
114
+ dat = self .subhdr .raw_data_from_fileobj ()
115
+ yield assert_equal (dat .shape , self .subhdr .get_shape ())
116
+ scale_factor = self .subhdr .subheaders [0 ]['scale_factor' ]
117
+ ecat_calib_factor = self .hdr ['ecat_calibration_factor' ]
118
+ scaled_dat = self .subhdr .data_from_fileobj ()
119
+ yield assert_array_equal (dat * scale_factor * ecat_calib_factor ,
120
+ scaled_dat )
0 commit comments