Login  Register

Fiji/ImageJ Headless if not in path?

Posted by Adam Hughes on Apr 23, 2015; 8:32pm
URL: http://imagej.273.s1.nabble.com/Fiji-ImageJ-Headless-if-not-in-path-tp5012586.html

Hi,

I'm trying to run a fiji macro in headless mode through python.  I'm on
ubuntu, but also need to do this on a Mac.  I've downloaded fiji from
source, and can doubleclick the icon to launch the application fine.  The
icon refers to the file:

~/Fiji.app/ImageJ2.desktop

However, to use Fiji in headless mode, the guides imply that I want to do
this:

 ImageJ --headless -macro path-to-Macro.ijm

Or

 fiji --headless -macro path-to-Macro.ijm

However, fiji and ImageJ are not in python.  So this command doesn't work.
Does anyone know how to configure a Mac and/or Ubuntu system path so that
we could just run fiji from any terminal?  At the end of the day, my python
function looks like this (currently not working):

def IJwatershed(bw_image):
    imsave('fooing', bw_image)
    macro_file = 'Watershed.imj'
   * path_to_fiji* = '/home/glue/Desktop/Fiji.app/ImageJ2.desktop'
    command = "%s --headless %s" % (path_to_fiji, macro_file)
    with open('foo', 'w') as dnull:
        p = subprocess.call(command, shell=False)# stderr=subprocess.PIPE)

And it seems to not work because of my *path_to_fiji *not being understood.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html