From 68e68cad7f6089b921faf32a77049ba41c748605 Mon Sep 17 00:00:00 2001 From: carlosuc3m <100329787@alumnos.uc3m.es> Date: Sat, 30 Nov 2024 19:38:01 +0100 Subject: [PATCH] change dtype and add flexibility to batch prompts --- src/main/java/ai/nets/samj/gui/MainGUI.java | 7 ++++--- src/main/java/ai/nets/samj/ui/ConsumerInterface.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/ai/nets/samj/gui/MainGUI.java b/src/main/java/ai/nets/samj/gui/MainGUI.java index dfbd2a4..28b0d0c 100644 --- a/src/main/java/ai/nets/samj/gui/MainGUI.java +++ b/src/main/java/ai/nets/samj/gui/MainGUI.java @@ -437,12 +437,13 @@ private void toggleDrawer() { private < T extends RealType< T > & NativeType< T > > void batchSAMize() throws IOException, RuntimeException, InterruptedException { RandomAccessibleInterval rai = this.consumer.getFocusedImageAsRai(); - List prompts = new ArrayList(); - if (prompts.size() == 0 && !(rai.getType() instanceof IntegerType)){ + List pointPrompts = this.consumer.getPointRoisOnFocusImage(); + List rectPrompts = this.consumer.getRectRoisOnFocusImage(); + if (pointPrompts.size() == 0 && rectPrompts.size() == 0 && !(rai.getType() instanceof IntegerType)){ // TODO add label that is displayed when there are no prompts selected return; } - this.consumer.addPolygonsFromGUI(this.cmbModels.getSelectedModel().fetch2dSegmentationFromMask(rai)); + this.consumer.addPolygonsFromGUI(this.cmbModels.getSelectedModel().processBatchOfPrompts(pointPrompts, rectPrompts, rai)); } private void createListeners() { diff --git a/src/main/java/ai/nets/samj/ui/ConsumerInterface.java b/src/main/java/ai/nets/samj/ui/ConsumerInterface.java index bb5c62d..66936a2 100644 --- a/src/main/java/ai/nets/samj/ui/ConsumerInterface.java +++ b/src/main/java/ai/nets/samj/ui/ConsumerInterface.java @@ -74,7 +74,7 @@ public abstract class ConsumerInterface { public abstract < T extends RealType< T > & NativeType< T > > RandomAccessibleInterval getFocusedImageAsRai(); - public abstract List getPointRoisOnFocusImage(); + public abstract List getPointRoisOnFocusImage(); public abstract List getRectRoisOnFocusImage();