Skip to content

Commit 503b579

Browse files
committed
default with first channel selected
1 parent c9d5691 commit 503b579

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

src/main/java/fiji/plugin/appose/cellpose/cp3/CellposeAppose.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ public void initialize()
166166
final MutableModuleItem< String > cytoItem =
167167
getInfo().getMutableInput( "cyto_channel", String.class );
168168
cytoItem.setChoices( channelChoices );
169+
cytoItem.setDefaultValue( "1" ); // Default, cyto channel selected only
170+
setInput( "cyto_channel", channelChoices.get(0)) ;
169171

170172
final MutableModuleItem< String > nucItem =
171173
getInfo().getMutableInput( "nuclei_channel", String.class );

src/main/java/fiji/plugin/appose/cellpose/cp4/CellposeSAMAppose.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ public void initialize()
158158
final MutableModuleItem< String > c0Item =
159159
getInfo().getMutableInput( "chan0", String.class );
160160
c0Item.setChoices( channelChoices );
161+
c0Item.setDefaultValue( "1" ); // By default, only first channel selected
162+
setInput( "chan0", "1") ;
161163

162164
final MutableModuleItem< String > c1Item =
163165
getInfo().getMutableInput( "chan1", String.class );

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,31 @@ public void defaultRunCP3() throws Exception
106106
}
107107
}
108108

109+
@Test
110+
public void runCP3ModelNuclei() throws Exception
111+
{
112+
try
113+
{
114+
final ImagePlus imp = IJ.openImage( "http://imagej.net/images/blobs.gif" );
115+
// Get all default parameters
116+
final Cellpose3Parameters paramsCP3 = Cellpose3Parameters.builder()
117+
.model( Cellpose3BuiltinModels.NUCLEI )
118+
.build();
119+
// Run it
120+
final ImagePlus[] outputCP3 = Cellpose.cellpose3( imp, paramsCP3 );
121+
// Get the label image results
122+
final ImagePlus labelsCP3 = outputCP3[ 0 ];
123+
// Check the image statistics if it looks like a successfull run
124+
ImageStatistics stats = labelsCP3.getStatistics();
125+
assertFalse( stats.max <= 0, "CP3: No labels were found in blob image, with nuclei model" );
126+
assertTrue( stats.max > 50, "CP3: Not enough labels were found in blob image, with nuclei model" );
127+
}
128+
catch (Exception e)
129+
{
130+
throw e;
131+
}
132+
}
133+
109134
@Test
110135
public void runCP3_Image3DMultiChannels() throws Exception
111136
{
@@ -156,7 +181,7 @@ public void runCP3_ImageTimeMultiChannels() throws Exception
156181
stack,
157182
1, stack.getNChannels(),
158183
3, 3,
159-
1, stack.getNFrames()
184+
1, 6
160185
);
161186
// Get all default parameters
162187
final Cellpose3Parameters paramsCP3 = Cellpose3Parameters.builder()

0 commit comments

Comments
 (0)