Installation/Linux

From MiToBo
Jump to navigationJump to search

Using MiToBo with ImageJ on a Linux-based system

Use MiToBo as shipped

Extract the zip file to a directory of your choice.
You can use MiToBo right away using the run.sh and oprunner.sh scripts.
Make sure that they have the 'x'-bit set before executing the scripts, i.e. do 'chmod u+x run.sh' and 'chmod u+x oprunner.sh' first.
If an UnsatisfiedLinkError occurs, please read the Native libraries section below.

Use MiToBo with an existing ImageJ installation

To use MiToBo with an existing ImageJ installation perform the following steps:

  1. copy the Mi_To_Bo.jar to be found in the 'plugins/' folder of the MiToBo zip file to your 'ImageJ/plugins/' directory
  2. copy all jars in 'plugins/jars/' of the MiToBo zip file to your 'ImageJ/plugins/jars/' except the ij.jar and any jars already existing in your 'ImageJ/plugins/jars/' directory
    (Notice: MiToBo requires explicit versions of some jars, other versions may not work properly, see requirements.)
  3. copy the MiToBo_Runner.txt from the 'macros/toolsets/' directory in the MiToBo zip file to your 'ImageJ/macros/toolsets/' directory;
    then you can select the MiToBo toolset from the list of available sets by clicking on the arrows button on the right side of the ImageJ standard toolbar
  4. Make the native libraries in lib/ of the MiToBo zip file available to Java (see the Native libraries section below)

You can still use the run.sh and oprunner.sh scripts if you copy them to your 'ImageJ/' directory.

Native libraries

Some operators of MiToBo use native code via the Java Native Interface (JNI).
The 'lib/' directory in the zip file provides precompiled JNI-libraries for 32- (lib/lib32) and 64-Bit (lib/lib64) Linux systems.
For using the native code add the libraries appropriate for your system to the library path.
The path to the native libraries must be available to any java application which uses MiToBo operators that depend on these libraries.

  • The run.sh and oprunner.sh scripts both add the 'lib/lib32' or 'lib/lib64' directory (depending on your architecture)
    to the LD_LIBRARY_PATH, thus, you do not have to configure the LD_LIBRARY_PATH manually.
  • If you run ImageJ with MiToBo or the OpRunner in another way, the directories of native libraries can be passed to Java in any of the following two ways:
  • The LD_LIBRARY_PATH environment variable must contain the path to the native libraries used
  • The call to Java has to be augmented with an option to tell where native libraries reside:
  java -Djava.library.path=/path/to/libs1:/path/to/libs2[:...] ...
For example, you can run ImageJ with MiToBo on a 32-Bit system with the unzipped MiToBo structure, but not the run.sh script, with the following command:
  java -Djava.library.path=lib/lib32:/usr/lib -cp plugins/jars/ij.jar ij.ImageJ
Configuring the LD_LIBRARY_PATH and running java with the -Djava.library.path option are equivalent.
  • Building of MiToBo's native libraries:
MiToBo ships with precompiled native libraries for 32- and 64-Bit Linux. If you encounter problems with the Linux libraries you might try to compile MiToBo's native libraries by yourself:
1. Download the zip file containing the sources of MiToBo and unpack the file to a directory of your choice.
2. Go to the 'native/export' directory in MiToBo's directory structure.
3. Edit Makefile.rules if necessary (defaults are predefined):
  • Set the variable MITOBO_HOME which should point to your MiToBo installation directory.
  • Set the path to your java installation which includes the JNI-header files.
  • Set the path to the CGAL libraries.
  • Set the path to the CGAL headers.
4. Run make install, which will build MiToBo's native libraries for your architecture and move them into the lib/lib32 or lib/lib64 directory. Note that this will overwrite the libraries in 'lib/lib32' and 'lib/lib64', respectively.
Note that when using these libraries also the CGAL libraries have to be available on the LD_LIBRARY_PATH upon execution of MiToBo operators.