@@ -39,28 +39,25 @@ def clear_output(data_dir, image_names):
3939 os .remove (npy_output )
4040
4141
42- @pytest .mark .parametrize ('compute_masks, resample, diameter, flow3D_smooth ' ,
42+ @pytest .mark .parametrize ('compute_masks, resample, diameter' ,
4343 [
44- (True , True , 40 , None ),
45- (True , True , None , None ),
46- (False , True , None , None ),
47- (False , False , None , None ),
48- (True , False , None , None ),
49- (True , False , 40 , None ),
50- (False , True , None , 2 ),
51- (False , True , None , [2 , 0 , 0 ]),
52- (False , False , None , 2 ),
44+ (True , True , 40 ),
45+ (True , True , None ),
46+ (False , True , None ),
47+ (False , False , None ),
48+ (True , False , None ),
49+ (True , False , 40 ),
5350 ]
5451)
55- def test_class_2D_one_img (data_dir , image_names , cellposemodel_fixture_24layer , compute_masks , resample , diameter , flow3D_smooth ):
52+ def test_class_2D_one_img (data_dir , image_names , cellposemodel_fixture_24layer , compute_masks , resample , diameter ):
5653 clear_output (data_dir , image_names )
5754
5855 img_file = data_dir / '2D' / image_names [0 ]
5956
6057 img = io .imread_2D (img_file )
6158 # flowps = io.imread(img_file.parent / (img_file.stem + "_cp4_gt_flowps.tif"))
6259
63- masks_pred , _ , _ = cellposemodel_fixture_24layer .eval (img , normalize = True , compute_masks = compute_masks , resample = resample , diameter = diameter , flow3D_smooth = flow3D_smooth )
60+ masks_pred , _ , _ = cellposemodel_fixture_24layer .eval (img , normalize = True , compute_masks = compute_masks , resample = resample , diameter = diameter )
6461
6562 if not compute_masks :
6663 # not compute_masks won't return masks so can't check
@@ -175,13 +172,21 @@ def test_cli_3D_diam_anisotropy_shape(data_dir, image_names_3d, diam, aniso):
175172 compare_mask_shapes (data_dir , image_names_3d [0 ], "3D" )
176173 clear_output (data_dir , image_names_3d )
177174
178-
175+ @pytest .mark .parametrize ('flow3D_smooth' ,
176+ [None , 2 , [1. , 0. , 0. ]])
179177@pytest .mark .slow
180- def test_cli_3D_one_img (data_dir , image_names_3d ):
178+ def test_cli_3D_one_img (data_dir , image_names_3d , flow3D_smooth ):
181179 clear_output (data_dir , image_names_3d )
182180 use_gpu = torch .cuda .is_available () or torch .backends .mps .is_available ()
183181 gpu_string = "--use_gpu" if use_gpu else ""
184- cmd = f"python -m cellpose --image_path { str (data_dir / '3D' / image_names_3d [0 ])} --do_3D --save_tif { gpu_string } --verbose"
182+
183+ flow_string = ''
184+ if isinstance (flow3D_smooth , (float , int )):
185+ flow_string = f" --flow3D_smooth { flow3D_smooth } "
186+ elif isinstance (flow3D_smooth , list ):
187+ flow_string = f" --flow3D_smooth { ' ' .join ([str (f ) for f in flow3D_smooth ])} "
188+
189+ cmd = f"python -m cellpose --image_path { str (data_dir / '3D' / image_names_3d [0 ])} --do_3D --save_tif { gpu_string } --verbose{ flow_string } "
185190 print (cmd )
186191 try :
187192 cmd_stdout = check_output (cmd , stderr = STDOUT , shell = True ).decode ()
0 commit comments