Skip to content

Commit

Permalink
change dtype and add flexibility to batch prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Nov 30, 2024
1 parent 027ad06 commit 68e68ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/main/java/ai/nets/samj/gui/MainGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,13 @@ private void toggleDrawer() {

private < T extends RealType< T > & NativeType< T > > void batchSAMize() throws IOException, RuntimeException, InterruptedException {
RandomAccessibleInterval<T> rai = this.consumer.getFocusedImageAsRai();
List<Object> prompts = new ArrayList<Object>();
if (prompts.size() == 0 && !(rai.getType() instanceof IntegerType)){
List<int[]> pointPrompts = this.consumer.getPointRoisOnFocusImage();
List<Rectangle> 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() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ai/nets/samj/ui/ConsumerInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public abstract class ConsumerInterface {

public abstract < T extends RealType< T > & NativeType< T > > RandomAccessibleInterval<T> getFocusedImageAsRai();

public abstract List<long[]> getPointRoisOnFocusImage();
public abstract List<int[]> getPointRoisOnFocusImage();

public abstract List<Rectangle> getRectRoisOnFocusImage();

Expand Down

0 comments on commit 68e68ca

Please sign in to comment.