33
44
55#################### 2D Tests ####################
6- @pytest .mark .slow
7- def test_shape_2D_grayscale (cellposemodel_fixture_2D ):
6+ def test_shape_2D_grayscale (cellposemodel_fixture_24layer ):
87 img = np .zeros ((224 , 224 ))
9- masks , _ , _ = cellposemodel_fixture_2D .eval (img )
8+ masks , _ , _ = cellposemodel_fixture_24layer .eval (img )
109 assert masks .shape == (224 , 224 )
1110
1211
13- def test_shape_2D_chan_first_diam_resize (cellposemodel_fixture_2D ):
12+ def test_shape_2D_chan_first_diam_resize (cellposemodel_fixture_24layer ):
1413 img = np .zeros ((1 , 224 , 224 ))
15- masks , flows , _ = cellposemodel_fixture_2D .eval (img , diameter = 50 )
14+ masks , flows , _ = cellposemodel_fixture_24layer .eval (img , diameter = 50 )
1615 assert masks .shape == (224 , 224 ), 'mask shape mismatch'
1716 assert flows [1 ].shape == (2 , 224 , 224 ), 'dP shape mismatch'
1817 assert flows [2 ].shape == (224 , 224 ), 'cellprob shape mismatch'
1918
2019
2120@pytest .mark .slow
22- def test_shape_2D_chan_diam_resize (cellposemodel_fixture_2D ):
21+ def test_shape_2D_chan_diam_resize (cellposemodel_fixture_24layer ):
2322 img = np .zeros ((1 , 224 , 224 ))
24- masks , _ , _ = cellposemodel_fixture_2D .eval (img , diameter = 50 )
23+ masks , _ , _ = cellposemodel_fixture_24layer .eval (img , diameter = 50 )
2524 assert masks .shape == (224 , 224 )
2625
2726
28- def test_shape_2D_chan_last (cellposemodel_fixture_2D ):
27+ def test_shape_2D_chan_last (cellposemodel_fixture_24layer ):
2928 img = np .zeros ((224 , 224 , 2 ))
30- masks , flows , _ = cellposemodel_fixture_2D .eval (img )
29+ masks , flows , _ = cellposemodel_fixture_24layer .eval (img )
3130 assert masks .shape == (224 , 224 ), 'mask shape mismatch'
3231 assert flows [1 ].shape == (2 , 224 , 224 ), 'dP shape mismatch'
3332 assert flows [2 ].shape == (224 , 224 ), 'cellprob shape mismatch'
3433
3534
3635
3736@pytest .mark .slow
38- def test_shape_2D_chan_specify (cellposemodel_fixture_2D ):
37+ def test_shape_2D_chan_specify (cellposemodel_fixture_24layer ):
3938 img = np .zeros ((224 , 224 , 2 ))
40- masks , _ , _ = cellposemodel_fixture_2D .eval (img , channel_axis = - 1 )
39+ masks , _ , _ = cellposemodel_fixture_24layer .eval (img , channel_axis = - 1 )
4140 assert masks .shape == (224 , 224 )
4241
4342
44- def test_shape_2D_2chan_specify (cellposemodel_fixture_2D ):
43+ def test_shape_2D_2chan_specify (cellposemodel_fixture_24layer ):
4544 img = np .zeros ((224 , 5 , 224 ))
46- masks , flows , _ = cellposemodel_fixture_2D .eval (img , channels = [2 , 1 ], channel_axis = 1 )
45+ masks , flows , _ = cellposemodel_fixture_24layer .eval (img , channels = [2 , 1 ], channel_axis = 1 )
4746 assert masks .shape == (224 , 224 ), 'mask shape mismatch'
4847 assert flows [1 ].shape == (2 , 224 , 224 ), 'dP shape mismatch'
4948 assert flows [2 ].shape == (224 , 224 ), 'cellprob shape mismatch'
5049
5150
5251#################### 3D Tests ####################
53- def test_shape_stitch (cellposemodel_fixture_3D ):
52+ def test_shape_stitch (cellposemodel_fixture_2layer ):
5453 img = np .zeros ((5 , 80 , 80 , 2 )) # 5 layer 3d input, 2 channels
55- masks , flows , _ = cellposemodel_fixture_3D .eval (img , channels = [0 , 0 ],
54+ masks , flows , _ = cellposemodel_fixture_2layer .eval (img , channels = [0 , 0 ],
5655 stitch_threshold = 0.9 ,
5756 channel_axis = 3 , z_axis = 0 ,
5857 do_3D = False )
@@ -63,52 +62,52 @@ def test_shape_stitch(cellposemodel_fixture_3D):
6362
6463
6564@pytest .mark .slow
66- def test_shape_3D (cellposemodel_fixture_3D ):
65+ def test_shape_3D (cellposemodel_fixture_2layer ):
6766 img = np .zeros ((80 , 80 , 5 , 1 ))
68- masks , _ , _ = cellposemodel_fixture_3D .eval (img , channel_axis = 3 , z_axis = 2 , do_3D = True )
67+ masks , _ , _ = cellposemodel_fixture_2layer .eval (img , channel_axis = 3 , z_axis = 2 , do_3D = True )
6968 assert masks .shape == (5 , 80 , 80 )
7069
7170
7271@pytest .mark .slow
73- def test_shape_3D_1ch (cellposemodel_fixture_3D ):
72+ def test_shape_3D_1ch (cellposemodel_fixture_2layer ):
7473 img = np .zeros ((5 , 80 , 80 , 1 ))
75- masks , _ , _ = cellposemodel_fixture_3D .eval (img , channel_axis = 3 , z_axis = 0 , do_3D = True )
74+ masks , _ , _ = cellposemodel_fixture_2layer .eval (img , channel_axis = 3 , z_axis = 0 , do_3D = True )
7675 assert masks .shape == (5 , 80 , 80 )
7776
7877
7978@pytest .mark .slow
80- def test_shape_3D_1ch_3ndim (cellposemodel_fixture_3D ):
79+ def test_shape_3D_1ch_3ndim (cellposemodel_fixture_2layer ):
8180 img = np .zeros ((5 , 80 , 80 ))
82- masks , _ , _ = cellposemodel_fixture_3D .eval (img , channel_axis = None , z_axis = 0 , do_3D = True )
81+ masks , _ , _ = cellposemodel_fixture_2layer .eval (img , channel_axis = None , z_axis = 0 , do_3D = True )
8382 assert masks .shape == (5 , 80 , 80 )
8483
8584
8685@pytest .mark .slow
87- def test_shape_3D_1ch_3ndim_diam (cellposemodel_fixture_3D ):
86+ def test_shape_3D_1ch_3ndim_diam (cellposemodel_fixture_2layer ):
8887 img = np .zeros ((5 , 80 , 80 ))
89- masks , _ , _ = cellposemodel_fixture_3D .eval (img , channel_axis = None , diameter = 50 , z_axis = 0 , do_3D = True )
88+ masks , _ , _ = cellposemodel_fixture_2layer .eval (img , channel_axis = None , diameter = 50 , z_axis = 0 , do_3D = True )
9089 assert masks .shape == (5 , 80 , 80 )
9190
9291
93- def test_shape_3D_2ch (cellposemodel_fixture_3D ):
92+ def test_shape_3D_2ch (cellposemodel_fixture_2layer ):
9493 img = np .zeros ((80 , 2 , 80 , 4 ))
9594
96- masks , flows , _ = cellposemodel_fixture_3D .eval (img , z_axis = - 1 , channel_axis = 1 , do_3D = True )
95+ masks , flows , _ = cellposemodel_fixture_2layer .eval (img , z_axis = - 1 , channel_axis = 1 , do_3D = True )
9796 assert masks .shape == (4 , 80 , 80 ), 'mask shape mismatch'
9897 assert flows [1 ].shape == (3 , 4 , 80 , 80 ), 'dP shape mismatch'
9998 assert flows [2 ].shape == (4 , 80 , 80 ), 'cellprob shape mismatch'
10099
101100
102101@pytest .mark .slow
103- def test_shape_3D_rgb_diam (cellposemodel_fixture_3D ):
102+ def test_shape_3D_rgb_diam (cellposemodel_fixture_2layer ):
104103 img = np .zeros ((5 , 80 , 80 , 3 ))
105- masks , _ , _ = cellposemodel_fixture_3D .eval (img , diameter = 50 , channels = [0 , 0 ],
104+ masks , _ , _ = cellposemodel_fixture_2layer .eval (img , diameter = 50 , channels = [0 , 0 ],
106105 channel_axis = 3 , z_axis = 0 , do_3D = True )
107106 assert masks .shape == (5 , 80 , 80 )
108107
109108@pytest .mark .slow
110- def test_shape_3D_rgb (cellposemodel_fixture_3D ):
109+ def test_shape_3D_rgb (cellposemodel_fixture_2layer ):
111110 img = np .zeros ((5 , 80 , 80 , 3 ))
112- masks , _ , _ = cellposemodel_fixture_3D .eval (img , channels = [0 , 0 ],
111+ masks , _ , _ = cellposemodel_fixture_2layer .eval (img , channels = [0 , 0 ],
113112 channel_axis = 3 , z_axis = 0 , do_3D = True )
114113 assert masks .shape == (5 , 80 , 80 )
0 commit comments