@@ -64,24 +64,24 @@ def create_image(data, filename):
64
64
@pytest .mark .parametrize (
65
65
"affine, data, roi_index, error, err_message" ,
66
66
[
67
- (np .eye (4 ), np .zeros ((2 , 2 , 2 , 2 ), dtype = int ), [1 , 0 ], None , None ),
67
+ (np .eye (4 ), np .zeros ((2 , 2 , 2 , 2 ), dtype = np . uint16 ), [1 , 0 ], None , None ),
68
68
(
69
69
np .eye (4 ),
70
- np .zeros ((2 , 2 , 3 , 2 ), dtype = int ),
70
+ np .zeros ((2 , 2 , 3 , 2 ), dtype = np . uint16 ),
71
71
[1 , 0 ],
72
72
True ,
73
73
"Mismatch in image shape" ,
74
74
),
75
75
(
76
76
bad_affine ,
77
- np .zeros ((2 , 2 , 2 , 2 ), dtype = int ),
77
+ np .zeros ((2 , 2 , 2 , 2 ), dtype = np . uint16 ),
78
78
[1 , 0 ],
79
79
True ,
80
80
"Mismatch in affine" ,
81
81
),
82
82
(
83
83
np .eye (4 ),
84
- np .zeros ((2 , 2 , 2 , 2 ), dtype = int ),
84
+ np .zeros ((2 , 2 , 2 , 2 ), dtype = np . uint16 ),
85
85
[0 , 0 , 0 ],
86
86
True ,
87
87
"Overlapping ROIs" ,
@@ -90,8 +90,8 @@ def create_image(data, filename):
90
90
)
91
91
def test_merge_rois (tmpdir , create_roi , affine , data , roi_index , error , err_message ):
92
92
tmpdir .chdir ()
93
- roi0 = create_roi (np .eye (4 ), np .zeros ((2 , 2 , 2 , 2 ), dtype = int ), [0 , 0 ])
94
- roi1 = create_roi (np .eye (4 ), np .zeros ((2 , 2 , 2 , 2 ), dtype = int ), [0 , 1 ])
93
+ roi0 = create_roi (np .eye (4 ), np .zeros ((2 , 2 , 2 , 2 ), dtype = np . uint16 ), [0 , 0 ])
94
+ roi1 = create_roi (np .eye (4 ), np .zeros ((2 , 2 , 2 , 2 ), dtype = np . uint16 ), [0 , 1 ])
95
95
test_roi = create_roi (affine , data , roi_index )
96
96
97
97
merge = MergeROIs (in_files = [roi0 , roi1 , test_roi ])
@@ -236,7 +236,7 @@ def test_MergeSeries_affines(tmp_path):
236
236
os .chdir (str (tmp_path ))
237
237
238
238
files = ['img0.nii.gz' , 'img1.nii.gz' ]
239
- data = np .ones ((10 , 10 , 10 ), dtype = int )
239
+ data = np .ones ((10 , 10 , 10 ), dtype = np . uint16 )
240
240
aff = np .eye (4 )
241
241
nb .Nifti1Image (data , aff , None ).to_filename (files [0 ])
242
242
# slightly alter affine
@@ -251,7 +251,7 @@ def test_MergeSeries_affines(tmp_path):
251
251
252
252
253
253
LABEL_MAPPINGS = {5 : 1 , 6 : 1 , 7 : 2 }
254
- LABEL_INPUT = np .arange (8 ).reshape (2 , 2 , 2 )
254
+ LABEL_INPUT = np .arange (8 , dtype = np . uint16 ).reshape (2 , 2 , 2 )
255
255
LABEL_OUTPUT = np .asarray ([0 , 1 , 2 , 3 , 4 , 1 , 1 , 2 ]).reshape (2 , 2 , 2 )
256
256
257
257
0 commit comments