Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
markemus opened this issue Dec 21, 2020 · 1 comment

Comments

@markemus
Copy link

markemus commented Dec 21, 2020

Traceback (most recent call last):
  File "/home/markemus/dev/pix2pix/stardist_imagej_script.py", line 52, in <module>
    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

@imagejan
Copy link
Member

imagejan commented Jan 7, 2021

@markemus can you try using the --ij2 flag, and the language-agnostic --run instead of --jython?

./ImageJ-linux64 --ij2 --headless --run ~/dev/pix2pix/stardist_imagej_script.py

See also https://imagej.net/Scripting_Headless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants