imagej / imagej/imagej2

"NameError: name 'command' is not defined" when running ImageJ jython script headless

Open
#275 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
350
PR merge metrics
No merged PRs in 30d

Description

```
Traceback (most recent call last):
File "/home/markemus/dev/pix2pix/stardist_imagej_script.py", line 52, in
res = command.run(StarDist2D, False, "input", imp, "modelChoice", "Versatile (H&E nuclei)",).get()
NameError: name 'command' is not defined
```
The script includes the services:
```
#@ DatasetIOService io
#@ CommandService command
```
and runs successfully when it's run from the ImageJ gui. Do services not work in headless mode? Is there an alternative to using `command` to run StarDist2D, or another way to import it?

EDIT: The command I'm calling is: `./ImageJ-linux64 --headless --jython ~/dev/pix2pix/stardist_imagej_script.py`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with stardist_imagej_script.py at line 52 and reproduce the documented ./ImageJ-linux64 --headless --jython invocation. Compare how the @ CommandService command is injected in the GUI and headless modes, then verify that the headless script can invoke StarDist2D without the NameError.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, python
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.