ITK Release 4/Microscopy/File Formats/Bio-Formats
This page describes the process of building the ITK adaptors to the Bio-Format library.
Download JACE
Check out the Jace source code:
svn co -r 39 https://jace.svn.sourceforge.net/svnroot/jace/trunk /path/to/jace
Where
/path/to/jace
is the desired location of your Jace source code checkout.
The "-r 39" matters, since Jace revisions 40 and later may not work with bf-cpp. As of this writing, the most recent revision was 52, and it does not compile on some systems. We currently recommend revision 39.
Download Bio-Formats
Download the bio-formats code according to the instructions in
http://www.loci.wisc.edu/bio-formats/source-code
Essentially
git clone git://dev.loci.wisc.edu/bio-formats.git
Build Bio-Formats and Its C++ Bindings
go to the top directory of the bio-formats source tree and type
ant tools
then go to the directory "components/native/bf-cpp"
cd components/native/bf-cpp
and type
ant -Djace.home=/path/to/jace
where "/path/to/jace" is the path to the directory where you checked out the code of JACE.
This will produce C++ libraries that wrap the functionalities of the Bio-Formats Java library.
If you have installed boost in a non-standard directory (say, /home/user/myinstall), CMake may complain that it cannot find the boost library. You can set the CMAKE_PREFIX_PATH environment variable to point to your custom installation base directory (/home/user/myinstall). CMake should then be able to find boost.
If builds fails in 64 bits machine
When building in Linux 64 bits machine you may see the message:
BUILD FAILED /home/ibanez/src/bio-formats/components/native/bf-cpp/build.xml:162: Warning: Could not find file /home/ibanez/src/bio-formats/artifacts/loci_tools.jar to copy.
This tend to be the result of using the static version of the boost thread libraries in the configuration of jace.
This can be fixed by doing:
cd build make edit_cache
and changing the values
Boost_THREAD_LIBRARY /usr/lib/libboost_thread-mt.a Boost_THREAD_LIBRARY_DEBUG /usr/lib/libboost_thread-mt.a Boost_THREAD_LIBRARY_RELEASE /usr/lib/libboost_thread-mt.a
to
Boost_THREAD_LIBRARY /usr/lib/libboost_thread-mt.so Boost_THREAD_LIBRARY_DEBUG /usr/lib/libboost_thread-mt.so Boost_THREAD_LIBRARY_RELEASE /usr/lib/libboost_thread-mt.so
then hit "c" to configure, and "g" to generate.
Finally do
make
Configure ITK
Go to the binary tree where you have build ITK and rerun CMake
For example, in Linux do
make edit_cache
Go to the Advanced mode by hitting the "t" key.
Search for the CMake option
ITKIO_SUPPORTS_BIOFORMATS_IMAGEIO
and turn it ON
reconfigure by hitting the "c" key.
At this point, new options will be displayed.
In particular:
BIOFORMATS_CPP_LIB BIOFORMATS_JACE_LIB BIOFORMATS_INCLUDE_PATH
They should respectively point to
the libbfcpp.so library, the libjace.so and the "include" directory of the bf-cpp binding code.
For example, in a typical case, they will be:
BIOFORMATS_CPP_LIB:FILEPATH=/home/ibanez/src/bio-formats/components/native/bf-cpp/build/libbfcpp.so BIOFORMATS_INCLUDE_PATH:PATH=/home/ibanez/src/bio-formats/components/native/bf-cpp/include BIOFORMATS_JACE_LIB:FILEPATH=/home/ibanez/src/bio-formats/components/native/bf-cpp/build/libjace.so
Once these settings have been provided, you can hit the "c" key to configure again, and the "g" key to generate the final Makefiles.
Build ITK adaptors
You can now quit CMake and simply do
make
(at this point, with JACE -r39 a significant amount of warnings are generated during the build process. They are unrelated to ITK, and can be ignored by now. We anticipate that future releases of JACE will address this problem).