Skip to content

Commit 83bb92e

Browse files
committed
add test CP3 time+channels
1 parent 59d2580 commit 83bb92e

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

src/test/java/fiji/plugin/appose/cellpose/TestCellPoseAppose.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,41 @@ public void runCP3_Image3DMultiChannels() throws Exception
144144
throw e;
145145
}
146146
}
147+
148+
@Test
149+
public void runCP3_ImageTimeMultiChannels() throws Exception
150+
{
151+
try
152+
{
153+
final ImagePlus stack = IJ.openImage( "https://imagej.net/images/mitosis.tif" );
154+
// Keep only one slice
155+
ImagePlus imp = new Duplicator().run(
156+
stack,
157+
1, stack.getNChannels(),
158+
3, 3,
159+
1, stack.getNFrames()
160+
);
161+
// Get all default parameters
162+
final Cellpose3Parameters paramsCP3 = Cellpose3Parameters.builder()
163+
.channels(1, null)
164+
.build();
165+
// Run it
166+
final ImagePlus[] outputCP3 = Cellpose.cellpose3( imp, paramsCP3 );
167+
// Get the label image results
168+
final ImagePlus labelsCP3 = outputCP3[ 0 ];
169+
// Check the label image dimensions
170+
assertEquals( imp.getWidth(), labelsCP3.getWidth(), "CP3, time+chan image: labels image dimension (width) is uncorrect" );
171+
assertEquals( imp.getHeight(), labelsCP3.getHeight(), "CP3, time+chan image: labels image dimension (height) is uncorrect" );
172+
173+
// Check the image statistics if it looks like a successfull run
174+
labelsCP3.setSlice(2);
175+
ImageStatistics stats = labelsCP3.getStatistics();
176+
assertFalse( stats.max <= 0, "CP3: No labels were found in test image, with default parameters" );
177+
assertTrue( stats.max > 2, "CP3: Not enough labels were found in test image, with default parameters" );
178+
}
179+
catch (Exception e)
180+
{
181+
throw e;
182+
}
183+
}
147184
}

0 commit comments

Comments
 (0)