Skip to content

Commit

Permalink
Merge branch 'main' of github.com:qupath/qupath-extension-instanseg
Browse files Browse the repository at this point in the history
  • Loading branch information
alanocallaghan committed Aug 6, 2024
2 parents 52f1b5b + 3b30495 commit 959639d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
3 changes: 0 additions & 3 deletions src/main/java/qupath/ext/instanseg/core/InstanSeg.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package qupath.ext.instanseg.core;

import ai.djl.Device;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import qupath.lib.images.ImageData;
import qupath.lib.images.servers.ColorTransforms;
import qupath.lib.objects.PathAnnotationObject;
Expand All @@ -23,7 +21,6 @@
import java.util.stream.IntStream;

public class InstanSeg {
private static final Logger logger = LoggerFactory.getLogger(InstanSeg.class);

private final int tileDims;
private final double downsample;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/qupath/ext/instanseg/core/MatTranslator.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MatTranslator implements Translator<Mat, Mat> {

private final String inputLayoutNd;
private final String outputLayoutNd;
private boolean nucleiOnly = false;
private final boolean firstChannelOnly;

/**
* Create a translator from InstanSeg input to output.
Expand All @@ -24,7 +24,7 @@ class MatTranslator implements Translator<Mat, Mat> {
MatTranslator(String inputLayoutNd, String outputLayoutNd, boolean firstChannelOnly) {
this.inputLayoutNd = inputLayoutNd;
this.outputLayoutNd = outputLayoutNd;
this.nucleiOnly = firstChannelOnly;
this.firstChannelOnly = firstChannelOnly;
}

/**
Expand All @@ -37,7 +37,7 @@ public NDList processInput(TranslatorContext ctx, Mat input) {
var manager = ctx.getNDManager();
var ndarray = DjlTools.matToNDArray(manager, input, inputLayoutNd);
var out = new NDList(ndarray);
if (nucleiOnly) {
if (firstChannelOnly) {
var inds = new int[]{1, 0};
var array = manager.create(inds, new Shape(2));
var arrayCPU = array.toDevice(Device.cpu(), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static Collection<String> getAvailableDevices() {
}

/**
* Query if the PyTorch engine is already available, without a need to downlaod.
* Query if the PyTorch engine is already available, without a need to download.
* @return
*/
public static boolean hasPyTorchEngine() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ private static String getCheckComboBoxText(CheckComboBox<ChannelSelectItem> comb
.toList()
.size();
if (n == 0)
return "No channels selected!";
return resources.getString("ui.options.noChannelSelected");
if (n == 1)
return "1 channel selected";
return n + " channels selected";
return resources.getString("ui.options.oneChannelSelected");
return String.format(resources.getString("ui.options.nChannelSelected"), n);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/qupath/ext/instanseg/ui/strings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ ui.options.tilesize = Tile Size:
ui.options.tilesize.tooltip = Define the approximate tile size
ui.options.channel = Channels:
ui.options.channel.tooltip = Define the set of channels to be used in inference
ui.options.noChannelSelected = No channels selected!
ui.options.oneChannelSelected = 1 channel selected
ui.options.nChannelSelected = %d channels selected
ui.options.directory = Downloaded model directory:
ui.options.directory.tooltip = Choose the directory where models should be stored

Expand Down

0 comments on commit 959639d

Please sign in to comment.