Skip to content

Commit

Permalink
adds support for cellpose 1.0 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
lacan authored Jan 31, 2022
1 parent 8c195c4 commit 5f1e6c3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ ext.moduleName = 'qupath.extension.cellpose'

description = 'QuPath extension to use Cellpose'

version = "0.3.1"
version = "0.3.2"

dependencies {
def qupathVersion = "0.3.0" // For now
def qupathVersion = "0.3.2" // For now

shadow "io.github.qupath:qupath-gui-fx:${qupathVersion}"
shadow "org.slf4j:slf4j-api:1.7.30"
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/qupath/ext/biop/cellpose/Cellpose2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,11 @@ private void runCellpose() throws IOException, InterruptedException {
}

if (!maskThreshold.isNaN()) {
if (cellposeSetup.getVersion().equals(CellposeSetup.CellposeVersion.OMNIPOSE))
if (!cellposeSetup.getVersion().equals(CellposeSetup.CellposeVersion.CELLPOSE))
cellposeArguments.add("--mask_threshold");
else cellposeArguments.add("--cellprob_threshold");


cellposeArguments.add("" + maskThreshold);
}

Expand All @@ -539,10 +540,14 @@ private void runCellpose() throws IOException, InterruptedException {

cellposeArguments.add("--no_npy");

cellposeArguments.add("--resample");
if (!cellposeSetup.getVersion().equals(CellposeSetup.CellposeVersion.CELLPOSE_1))
cellposeArguments.add("--resample");

if (useGPU) cellposeArguments.add("--use_gpu");

if (cellposeSetup.getVersion().equals(CellposeSetup.CellposeVersion.CELLPOSE_1))
cellposeArguments.add("--verbose");

veRunner.setArguments(cellposeArguments);

// Finally, we can run Cellpose
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/qupath/ext/biop/cellpose/CellposeExtension.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void installExtension(QuPathGUI qupath) {

// Create the options we need
ObjectProperty<EnvType> envType = PathPrefs.createPersistentPreference("cellposeEnvType", EnvType.CONDA, EnvType.class);
ObjectProperty<CellposeVersion> version = PathPrefs.createPersistentPreference("cellposeVersion",CellposeVersion.CELLPOSE, CellposeVersion.class);
ObjectProperty<CellposeVersion> version = PathPrefs.createPersistentPreference("cellposeVersion",CellposeVersion.CELLPOSE_1, CellposeVersion.class);
StringProperty envPath = PathPrefs.createPersistentPreference("cellposeEnvPath", "");

//Set options to current values
Expand Down Expand Up @@ -86,6 +86,6 @@ public Version getQuPathVersion() {

@Override
public Version getVersion() {
return Version.parse("0.3.1");
return Version.parse("0.3.2");
}
}
3 changes: 2 additions & 1 deletion src/main/java/qupath/ext/biop/cellpose/CellposeSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public class CellposeSetup {
private CellposeVersion version;
public enum CellposeVersion {
CELLPOSE("Cellpose before v0.7.0"),
OMNIPOSE("Omnipose after v0.7.2");
OMNIPOSE("Omnipose after v0.7.2"),
CELLPOSE_1("Cellpose Version 1.0");

private final String description;

Expand Down

0 comments on commit 5f1e6c3

Please sign in to comment.