@@ -42,9 +42,12 @@ def test_crop_masked(self) -> None:
4242 lab = np .zeros ((10 , 10 , 10 ), dtype = np .int32 )
4343 lab [2 :5 , 3 :6 , 4 :7 ] = 7
4444 bbox = {
45- "bbox_min_z" : 2 , "bbox_max_z" : 4 ,
46- "bbox_min_y" : 3 , "bbox_max_y" : 5 ,
47- "bbox_min_x" : 4 , "bbox_max_x" : 6 ,
45+ "bbox_min_z" : 2 ,
46+ "bbox_max_z" : 4 ,
47+ "bbox_min_y" : 3 ,
48+ "bbox_max_y" : 5 ,
49+ "bbox_min_x" : 4 ,
50+ "bbox_max_x" : 6 ,
4851 }
4952 masked , mask = crop_spot_cube (vol , lab , 7 , bbox , margin = 0 )
5053 self .assertTrue (np .all (masked [mask > 0 ] == 3.0 ))
@@ -55,9 +58,12 @@ def test_margin_clamps_to_boundary(self) -> None:
5558 labels = np .zeros ((10 , 10 , 10 ), dtype = int )
5659 labels [0 :2 , 0 :2 , 0 :2 ] = 1
5760 bbox = {
58- "bbox_min_z" : 0 , "bbox_max_z" : 1 ,
59- "bbox_min_y" : 0 , "bbox_max_y" : 1 ,
60- "bbox_min_x" : 0 , "bbox_max_x" : 1 ,
61+ "bbox_min_z" : 0 ,
62+ "bbox_max_z" : 1 ,
63+ "bbox_min_y" : 0 ,
64+ "bbox_max_y" : 1 ,
65+ "bbox_min_x" : 0 ,
66+ "bbox_max_x" : 1 ,
6167 }
6268 masked , mask = crop_spot_cube (volume , labels , label_id = 1 , bbox = bbox , margin = 5 )
6369 self .assertGreater (mask .sum (), 0 )
@@ -68,9 +74,12 @@ def test_other_labels_masked_out(self) -> None:
6874 labels [3 , 3 , 3 ] = 1
6975 labels [4 , 4 , 4 ] = 2
7076 bbox = {
71- "bbox_min_z" : 3 , "bbox_max_z" : 4 ,
72- "bbox_min_y" : 3 , "bbox_max_y" : 4 ,
73- "bbox_min_x" : 3 , "bbox_max_x" : 4 ,
77+ "bbox_min_z" : 3 ,
78+ "bbox_max_z" : 4 ,
79+ "bbox_min_y" : 3 ,
80+ "bbox_max_y" : 4 ,
81+ "bbox_min_x" : 3 ,
82+ "bbox_max_x" : 4 ,
7483 }
7584 masked , mask = crop_spot_cube (volume , labels , label_id = 1 , bbox = bbox , margin = 1 )
7685 self .assertEqual (float (mask [mask .shape [0 ] // 2 , mask .shape [1 ] // 2 , mask .shape [2 ] // 2 ]), 0.0 )
0 commit comments