Skip to content

Commit

Permalink
Set current image data (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanocallaghan authored Aug 6, 2024
1 parent d0f39e3 commit 4aea00b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/main/java/qupath/ext/instanseg/core/InstanSeg.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import qupath.lib.objects.PathObject;
import qupath.lib.plugins.TaskRunner;
import qupath.lib.plugins.TaskRunnerUtils;
import qupath.lib.scripting.QP;

import java.awt.image.BufferedImage;
import java.io.IOException;
Expand Down Expand Up @@ -158,6 +159,16 @@ public Builder imageData(ImageData<BufferedImage> imageData) {
return this;
}

/**
* Set the imageData to be used as the current image data.
* @return A modified builder
*/
public Builder currentImageData() {
this.imageData = QP.getCurrentImageData();
return this;
}


/**
* Set the channels to be used in inference
* @param channels A collection of channels to be used in inference
Expand Down Expand Up @@ -369,10 +380,10 @@ public Builder outputAnnotations() {
*/
public InstanSeg build() {
if (imageData == null) {
throw new IllegalStateException("imageData cannot be null!");
// assignment is just to suppress IDE suggestion for void return
var tmp = currentImageData();
}
if (channels == null) {
// assignment is just to suppress IDE suggestion for void return
var tmp = allChannels();
}
if (outputClasses == null) {
Expand Down

0 comments on commit 4aea00b

Please sign in to comment.