imagej / pyimagej

Use ImageJ from Python
https://pyimagej.readthedocs.io/
Other
467 stars 81 forks source link

Suppress ImageJ GUI? #102

Closed ma-sadeghi closed 3 years ago

ma-sadeghi commented 3 years ago

Is there a way to force pyimagej not to show the GUI while processing?

imagejan commented 3 years ago

By default, it should initialize without a GUI, unless you specify headless=False, see Initialization.md.

How are you running pyimagej when you see the GUI being shown? What operating system? Which version?

ma-sadeghi commented 3 years ago

@imagejan Thanks. I'm using it on Windows (v1.0.0). Let me back up, I'm interested to run plugins headless, for instance the following code snippet (take from your docs):

import imagej
ij = imagej.init('sc.fiji:fiji:2.0.0-pre-10')
ij.py.run_macro("""run("Blobs (25K)");""")
blobs = ij.py.active_image_plus()
ij.py.show(blobs)

plugin = 'Mean'
args = {
    'block_radius_x': 10,
    'block_radius_y': 10            
}
ij.py.run_plugin(plugin, args)
imp = ij.py.active_image_plus()
ij.py.show(imp)
ctrueden commented 3 years ago

@ma-sadeghi The code snippet you posted works for me, after changing 2.0.0-pre-10 to 2.1.1 (the latest release of Fiji). Is it working on your system?

ma-sadeghi commented 3 years ago

@ctrueden Yep, it does work, but I want it to run in headless mode. Sorry if my question seems very basic. I was just introduced to pyimagej.