Skip to content

Commit

Permalink
Use QP approach to selecting cores, and add selection to history (#107)
Browse files Browse the repository at this point in the history
Improve handling of missing and null grids, and add the selection of annotations/TMA cores to the workflow history
  • Loading branch information
alanocallaghan authored Nov 15, 2024
1 parent 697a618 commit 7611373
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/qupath/ext/instanseg/ui/InstanSegController.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
import qupath.lib.gui.tools.GuiTools;
import qupath.lib.gui.tools.WebViews;
import qupath.lib.images.ImageData;
import qupath.lib.objects.PathObjectTools;
import qupath.lib.plugins.workflow.DefaultScriptableWorkflowStep;

import java.awt.image.BufferedImage;
import java.beans.PropertyChangeEvent;
Expand Down Expand Up @@ -843,17 +845,16 @@ private void downloadPyTorch() {
private void selectAllAnnotations() {
var hierarchy = qupath.getImageData().getHierarchy();
hierarchy.getSelectionModel().setSelectedObjects(hierarchy.getAnnotationObjects(), null);
var step = new DefaultScriptableWorkflowStep("Select all annotations", "selectAnnotations()");
qupath.imageDataProperty().get().getHistoryWorkflow().addStep(step);
}

@FXML
private void selectAllTMACores() {
var hierarchy = qupath.getImageData().getHierarchy();
hierarchy.getSelectionModel().setSelectedObjects(
hierarchy
.getTMAGrid().getTMACoreList()
.stream().filter(core -> !core.isMissing())
.toList(),
null);
hierarchy.getSelectionModel().setSelectedObjects(PathObjectTools.getTMACoreObjects(hierarchy, false),null);
var step = new DefaultScriptableWorkflowStep("Select all TMA cores", "selectTMACores()");
qupath.imageDataProperty().get().getHistoryWorkflow().addStep(step);
}

private void promptToUpdateDirectory(StringProperty dirPath) {
Expand Down

0 comments on commit 7611373

Please sign in to comment.