http://imagej.273.s1.nabble.com/Fiji-ImageJ-Headless-if-not-in-path-tp5012586p5012604.html
It will not launch ImageJ2, only ImageJ1. So the headless mode (which is an
ImageJ2 feature) will not work.
the time being.
to actually spin up ImageJ. But embedding that string into your python code
strikes me as much more fragile.
> path such as /usr/local/bin.
OK, that makes sense. A couple comments about that:
maintain. I would like to resurrect Debian packaging for core ImageJ2 only
enable Fiji by toggling the Fiji update site.
system path. But unfortunately, due to project priorities, neither are
effort. And neither would address the situation for Windows, the most
popular platform.
> This is becoming a can of worms due to my inexperience. When I make the
> alias and the bash_profile, it overwrites my enthought canopy links. In
> other words, when I have a bash profile, my OS defaults back to the system
> python. Before I go down this road of putting canopy back into the
> bash_profile path, I just wanted to ask something. I had this working on
> an older script by explicitly calling the following code:
>
> /ImageJ/jre/bin/java -Xmx512m -jar ImageJ/ij.jar
> What was this doing? Is this still valid (eg if I do this with the new
> version of ImageJ and/or Fiji, will it run code in headless mode?
>
> On Fri, Apr 24, 2015 at 10:47 AM, Adam Hughes <
[hidden email]>
> wrote:
>
> > Thanks, that is correct Juan. I'll try out the alias
> >
> > On Thu, Apr 23, 2015 at 10:42 PM, Juan Nunez-Iglesias <
>
[hidden email]>
> > wrote:
> >
> >> Curtis, I'm guessing Adam was asking whether there is a Fiji installer
> >> that would place the ImageJ-macosx binary (perhaps renamed) in a system
> >> path such as /usr/local/bin.
> >>
> >>
> >>
> >>
> >>
> >>
> >> For what it's worth, on Mac OS X, I usually alias the binary executable
> >> inside the Fiji.app:
> >>
> >>
> >>
> >>
> >> alias fiji=/Applications/Fiji.app/Contents/MacOS/ImageJ-macosx
> >>
> >> On Fri, Apr 24, 2015 at 8:27 AM, Curtis Rueden <
[hidden email]>
> wrote:
> >>
> >> > Hi Adam,
> >> >> Is there a version of fiji on MAC that would install itself to the
> >> >> system path?
> >> > Sorry, I don't understand the question. Even if you include the ImageJ
> >> > launcher's directory on the system path, it still wouldn't be enough,
> >> since
> >> > the executable file name differs across OSes.
> >> > Given a path to a Fiji.app directory, your Python code could
> synthesize
> >> the
> >> > correct launcher to use, similar to the shell script I linked -- but
> in
> >> > Python, of course.
> >> > Another option would be to make it an installation requirement for
> >> users to
> >> > symlink "fiji" somewhere on their path, so that your Python code
> doesn't
> >> > need to worry about it.
> >> >> is everyone using this workaround or am I using the wrong version of
> >> >> fiji or something?
> >> > I don't think many people call ImageJ from Python. Usually it is the
> >> other
> >> > way around: call Python (or Jython) from ImageJ:
> >> > *
http://imagej.net/Python> >> > *
https://github.com/scijava/scripting-cpython> >> > *
https://github.com/scijava/scripting-jython> >> > Someone else did just ask about this on StackOverflow, though:
> >> > *
http://stackoverflow.com/q/29749687/1207769> >> > Regards,
> >> > Curtis
> >> > On Thu, Apr 23, 2015 at 4:11 PM, Adam Hughes <
[hidden email]>
> >> wrote:
> >> >> Thanks. Is there a version of fiji on MAC that would install itself
> >> to the
> >> >> system path? I mean, is everyone using this workaround or am I using
> >> the
> >> >> wrong version of fiji or something?
> >> >>
> >> >> On Thu, Apr 23, 2015 at 4:44 PM, Curtis Rueden <
[hidden email]>
> >> wrote:
> >> >>
> >> >> > Hi Adam,
> >> >> >
> >> >> > > Does anyone know how to configure a Mac and/or Ubuntu system path
> >> so
> >> >> > > that we could just run fiji from any terminal?
> >> >> >
> >> >> > The issue is complicated by the fact that the launcher executable
> is
> >> >> named
> >> >> > differently for every platform.
> >> >> >
> >> >> > Personally, I work around it via the following shell script:
> >> >> > *
> >> >> >
> >> >> >
> >> >>
> >>
>
https://github.com/imagej/imagej-omero/blob/imagej-omero-0.2.1/bin/run-class> >> >> >
> >> >> > Alternately, the ImageJ.sh script (
> >> >> >
> >>
https://github.com/imagej/imagej/blob/imagej-2.0.0-rc-29/bin/ImageJ.sh)
> >> >> > tries very hard to launch ImageJ without using any launcher
> >> executable.
> >> >> In
> >> >> > that way, you can run ImageJ on platforms for which no launcher has
> >> been
> >> >> > compiled, such as the Raspberry Pi.
> >> >> >
> >> >> > HTH,
> >> >> > Curtis
> >> >> >
> >> >> > On Thu, Apr 23, 2015 at 3:32 PM, Adam Hughes <
>
[hidden email]
> >> >
> >> >> > wrote:
> >> >> >
> >> >> > > 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> >> >> > >
> >> >> >
> >> >> > --
> >> >> > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> >> >> >
> >> >>
> >> >> --
> >> >> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> >> >>
> >> > --
> >> > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> >>
> >> --
> >> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> >>
> >
> >
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>