Ilastik installation — the easy way using conda!

Sure, go ahead and download the binaries from the elastik.org page. You are done and this page is noise for you.

If, on the other hand, you need to get the latest Ilastik version and some feature you only know about because you are deep into things… then you might njoy this nice page: https://github.com/ilastik/ilastik-build-conda

Interested in tracking?

Once you reach point 2 on that page, use a modified version of  this line:

  • env CPLEX_ROOT_DIR=~/Applications/IBM/ILOG/CPLEX_Studio126 conda install --channel stuarteberg ilastik-deps-tracking

Note: precondition is to have a running version of CPLEX installed on your machine.

If you set your .bashrc correctly, this should now start ilastik for you:

  1. source activate ilastikenv
  2. PYTHONPATH="ilastik:lazyflow:volumina" python ilastik/ilastik.py

Note: Step two above works if you are in the ‘ilastik-meta’ git repository. All libraries dowloaded for the conda environment are below your conda installation folder (in env/ilastikenv).

Hope this does the trick and your ilastik start screen looks somewhat like this:

Ilastik_start_after_conda_success

If CPLEX refuses to work on your machine, here a description for how to get CPLEX running: http://ilastik.org/documentation/basics/installation.html

Does ilastik not show you the tracking workflows after you installed as described above — you might miss the necessary CPLEX dylibs. Here an excerpt of the ilastik installation documentation for how to create them:

First figure which gcc version you use by calling…

gcc --version

and look at the output. This should be either GCC 4.2.1, or Apple LLVM (clang). The folders used to specify the location of the libraries in cases involving clang depend on whether you installed from cplex_studio1251.macos.bin or cplex_studio1251.osx.bin. If you installed the first one, you need to replace x86-64_osx by x86-64_darwin.

  • If the compiler is GCC 4.2.1, use the commands below (in the respective folders where the files are located)
    g++ -fpic -shared -Wl,-all_load libcplex.a -Wl,-noall_load -o libcplex.dylib
    g++ -fpic -shared -Wl,-all_load libilocplex.a -Wl,-noall_load -o libilocplex.dylib
    g++ -fpic -shared -Wl,-all_load libconcert.a -Wl,-noall_load -o libconcert.dylib
    
  • If the compiler is clang and you have OSX version < 10.9, then you need to supply the symbols of cplex and concert when building libilocplex.dylib:
    g++ -fpic -shared -Wl,-all_load libcplex.a -Wl,-noall_load -o libcplex.dylib
    g++ -fpic -shared -Wl,-all_load libconcert.a -Wl,-noall_load -o libconcert.dylib
    g++ -fpic -shared -Wl,-all_load libilocplex.a -Wl,-noall_load -L. -L../../../../concert/lib/x86-64_osx/static_pic -lcplex -lconcert -o libilocplex.dylib
    
  • If the compiler is clang and you have OSX 10.9 Mavericks, then you need to specify the correct C++ standard library to use in addition to the commands above:
    g++ -fpic -shared -Wl,-all_load libcplex.a -Wl,-noall_load -stdlib=libstdc++ -o libcplex.dylib
    g++ -fpic -shared -Wl,-all_load libconcert.a -Wl,-noall_load -stdlib=libstdc++ -o libconcert.dylib
    g++ -fpic -shared -Wl,-all_load libilocplex.a -Wl,-noall_load -L. -L../../../../concert/lib/x86-64_osx/static_pic -lcplex -lconcert -stdlib=libstdc++ -o libilocplex.dylib
    install_name_tool -id @executable_path/../Frameworks/libcplex.dylib libcplex.dylib
    install_name_tool -id @executable_path/../Frameworks/libconcert.dylib libconcert.dylib
    install_name_tool -id @executable_path/../Frameworks/libilocplex.dylib libilocplex.dylib
    install_name_tool -change libcplex.dylib @executable_path/../Frameworks/libcplex.dylib libilocplex.dylib
    install_name_tool -change libconcert.dylib @executable_path/../Frameworks/libconcert.dylib libilocplex.dylib
    

If you replace ‘@executable_path/../Frameworks' by the absolute path (this is in fact required for the whole thing to work with conda) to respective libraries you are guarenteed to

  • get working dylibs, and
  • prevent any reuse in different location... ;) 

otool -L <library-name> can be used to check if your dylib mods where successful.

Change the Fiji temp Folder (by passing JVM arguments)

Why? For example if you run Fiji headless on a cluster and you would like it to use a fast local folder instead of a network drive.

This page tells you how you can pass on JVM arguments to Fiji upon start: http://fiji.sc/Java_Options

One can specify the “temp” directory using the following command:

$ fiji -Djava.io.tmpdir=~/tmp -- &

Double dash at the end is required to specify that the given argument is for Java.

Find JAR Containing Specific Class

Tons of JARs are in the classpath of Fiji. Multiple JARs might contain the same class definition.

In order to know which JAR is the one hosting the version Fiji is actually using (this is determined by the order those JARs are found in the CLASSPATH), you can use this handy function from within Fiji.

Start Fiji – hit ctrl+L or cmd+L on your keyboard – type ‘jar’ in the search field – start ‘Find jar for class’ and type the name of the class + the entire package information as shown below – hit ‘Ok’ – done!

Fiji_findJarForClass