Skip to content

Commit

Permalink
Make the omnipose settings extensible and add --omnipose to cmd line.
Browse files Browse the repository at this point in the history
Normally the omnipose executable does it but let's make double
sure.
  • Loading branch information
tinevez committed Nov 6, 2023
1 parent fff69e8 commit b2952b1
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/main/java/fiji/plugin/trackmate/omnipose/OmniposeSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
*/
package fiji.plugin.trackmate.omnipose;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import fiji.plugin.trackmate.cellpose.AbstractCellposeSettings;

public class OmniposeSettings extends AbstractCellposeSettings
Expand All @@ -39,6 +43,15 @@ public OmniposeSettings(
super( omniposePythonPath, model, customModelPath, chan, chan2, diameter, useGPU, simplifyContours );
}

@Override
public List< String > toCmdLine( final String imagesDir )
{
final List< String > cmd = new ArrayList<>( super.toCmdLine( imagesDir ) );
// omnipose executable adds it anyway, but let's make sure.
cmd.add( "--omni" );
return Collections.unmodifiableList( cmd );
}

@Override
public String getExecutableName()
{
Expand All @@ -50,24 +63,24 @@ public static Builder create()
return new Builder();
}

public static final class Builder
public static class Builder
{

private String omniposePythonPath = "/opt/anaconda3/envs/omnipose/bin/python";
protected String omniposePythonPath = "/opt/anaconda3/envs/omnipose/bin/python";

private int chan = 0;
protected int chan = 0;

private int chan2 = -1;
protected int chan2 = -1;

private PretrainedModelOmnipose model = PretrainedModelOmnipose.BACT_PHASE;
protected PretrainedModelOmnipose model = PretrainedModelOmnipose.BACT_PHASE;

private double diameter = 30.;
protected double diameter = 30.;

private boolean useGPU = true;
protected boolean useGPU = true;

private boolean simplifyContours = true;
protected boolean simplifyContours = true;

private String customModelPath = "";
protected String customModelPath = "";

public Builder channel1( final int ch )
{
Expand Down

0 comments on commit b2952b1

Please sign in to comment.