Skip to content

get_polygons_from_binary_mask issue #47

@LPUoO

Description

@LPUoO

Hi @carlosuc3m,

When running SAMJ from the GUI using the preset prompts mode (ROIs - rectangular selections) it stops prematurely before processing all ROIs (after ~50 ROIs).

When running run("SAMJ Annotator", "model=[SAM2 Large] export=true"); , also using rectangular selections in ROI manager. It also stops prematurely.

I get the error below:

(Fiji Is Just) ImageJ 2.16.0/1.54p; Java 1.8.0_172 [64-bit]; Windows 10 10.0; 308MB of 48873MB (<1%)
 
java.lang.RuntimeException: Traceback (most recent call last):
  File "E:\Fiji.app\appose_x86_64\envs\sam2\Lib\site-packages\appose\python_worker.py", line 123, in execute_script
    exec(compile(block, "<string>", mode="exec"))
  File "<string>", line 81, in <module>
  File "<string>", line 138, in get_polygons_from_binary_mask
ValueError: attempt to get argmax of an empty sequence

	at ai.nets.samj.models.AbstractSamJ.processAndRetrieveContours(AbstractSamJ.java:423)
	at ai.nets.samj.models.AbstractSamJ.processBatchOfPrompts(AbstractSamJ.java:540)
	at ai.nets.samj.communication.model.SAMModel.processBatchOfPrompts(SAMModel.java:195)
	at ai.nets.samj.ij.SAMJ_Annotator.macroRunSAMJ(SAMJ_Annotator.java:411)
	at ai.nets.samj.ij.SAMJ_Annotator.runMacro(SAMJ_Annotator.java:378)
	at ai.nets.samj.ij.SAMJ_Annotator.run(SAMJ_Annotator.java:186)
	at ij.IJ.runUserPlugIn(IJ.java:244)
	at ij.IJ.runPlugIn(IJ.java:210)
	at ij.Executer.runCommand(Executer.java:152)
	at ij.Executer.run(Executer.java:70)
	at ij.IJ.run(IJ.java:326)
	at ij.IJ.run(IJ.java:337)
	at ij.macro.Functions.doRun(Functions.java:703)
	at ij.macro.Functions.doFunction(Functions.java:99)
	at ij.macro.Interpreter.doStatement(Interpreter.java:280)
	at ij.macro.Interpreter.doStatements(Interpreter.java:266)
	at ij.macro.Interpreter.run(Interpreter.java:162)
	at ij.macro.Interpreter.run(Interpreter.java:92)
	at ij.macro.Interpreter.run(Interpreter.java:106)
	at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:164)
	at ij.IJ.runMacro(IJ.java:165)
	at ij.IJ.runMacro(IJ.java:154)
	at net.imagej.legacy.IJ1Helper$2.call(IJ1Helper.java:1185)
	at net.imagej.legacy.IJ1Helper$2.call(IJ1Helper.java:1181)
	at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:1132)
	at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:1181)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:145)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:173)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:165)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:125)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:64)
	at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:247)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Is there a limit ROI count in preset-prompts mode?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions