FARSIGHT Tutorials/Building Software/Bio-Formats/Building C++ Bindings

From FarsightWiki
(Difference between revisions)
Jump to: navigation, search
(Compiling on Windows with Visual C++)
m
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Overview =
+
= NOTICE =
 +
It is no longer necessary to build the Bio-Formats C++ bindings to use Bio-Formats with FARSIGHT. Rather, see the [http://www.loci.wisc.edu/bio-formats/itk Bio-Formats ITK] page for instructions.
  
The Bio-Formats C++ bindings provide language bindings for calling into the [[Bio-Formats]] Java library from C++ in a cross-platform manner. As of this writing the bindings are functional with GCC on Linux and Mac OS X systems, as well as with Visual C++ 2005 and Visual C++ 2008 on Windows.
+
If you still want to build the Bio-Formats C++ bindings, you can find up-to-date instructions on the [http://www.loci.wisc.edu/bio-formats/bio-formats-c-bindings Bio-Formats C++ Bindings] page.
 
+
 
+
= Prerequisites =
+
 
+
The following packages should be installed in order:
+
 
+
# [[FARSIGHT Tutorials/Building Software/Installing CMake|Installing CMake]]
+
# [[FARSIGHT Tutorials/Building Software/Installing Apache Ant|Installing Apache Ant]]
+
# [[FARSIGHT Tutorials/Building Software/Installing Subversion|Installing Subversion]]
+
# [[FARSIGHT Tutorials/Building Software/Installing Boost|Installing Boost Thread]]
+
# [[FARSIGHT Tutorials/Building Software/Installing JDK|Installing Java Development Kit]]
+
# [[FARSIGHT Tutorials/Building Software/Bio-Formats/Installing Visual C++|Installing Visual C++]] (Windows only)
+
# [[FARSIGHT Tutorials/Building Software/Bio-Formats/Downloading Jace|Downloading Jace]]
+
 
+
 
+
= Downloading Bio-Formats =
+
 
+
Execute the following command:
+
 
+
svn co https://skyking.microscopy.wisc.edu/svn/java/trunk /path/to/loci
+
 
+
Where /path/to/loci is the desired location of your LOCI Software source code checkout.
+
 
+
The above command assumes you have the svn command line tool for Subversion installed. It should also work fine to plug in the above information to any graphical Subversion client (e.g., TortoiseSVN).
+
 
+
 
+
= Compiling the code =
+
 
+
Once you have the prerequisites installed, you must first build the loci_tools.jar library:
+
 
+
# Change to the root directory of the checkout.
+
# Execute the command:
+
 
+
ant tools
+
 
+
Finally, you can compile the Bio-Formats C++ bindings:
+
 
+
# Change to the components/native/bf-cpp directory.
+
# Execute the command:
+
 
+
ant -Djace.home=/path/to/jace
+
 
+
Where /path/to/jace is the location of your Jace source code checkout. Do not use a relative path, and use forward slashes, even on Windows.
+
 
+
If all goes well, the build system will:
+
 
+
# Build the Jace Java and C++ libraries.
+
# Generate the Bio-Formats C++ proxy classes.
+
# Build the Bio-Formats C++ shared library.
+
# Build the showinf command line tool, for testing the functionality.
+
 
+
Please be patient, as the build may require several minutes to complete.
+
 
+
 
+
= Compiling on Windows with Visual C++ =
+
 
+
The compilation instructions above are accurate, except that:
+
 
+
# Instead of compiling the C++ source from the command line, the build system launches Visual Studio to complete the build process. You need to select "Build project" from the Build menu to finish the build.
+
# The shared libraries and executables are placed in a subdirectory of the build folder based on the active solution configuration, typically either "debug" or "release." The Ant script takes care of placing a copy of the necessary JAR files in both folders, but if you use a different configuration you will need to copy the JAR files into the correct subdirectory yourself.
+
 
+
== Important note about Visual C++ 2008 Express ==
+
 
+
With Visual C++ 2008 Express, CMake may complain about CMAKE_MAKE_PROGRAM not being set. You can fix the error by using cmake-gui to explicitly select Visual C++ 9.0 as the target compiler, then rerunning the ant command.
+
 
+
= Build results =
+
 
+
Afterwards, the build subdirectory will contain the following files:
+
 
+
# libjace.so / libjace.jnilib / jace.dll — Jace shared library
+
# libbfjace.so / libbfjace.dylib / bfjace.dll — Bio-Formats C++ bindings
+
# jace-runtime.jar — Jace Java classes needed at runtime
+
# loci_tools.jar — Bio-Formats Java library needed at runtime
+
# showinf / showinf.exe — Example command line application
+
 
+
Items 1-4 are necessary and required to deploy Bio-Formats with FARSIGHT. All other files, including the showinf program and various build files generated by CMake, are not needed.
+
 
+
You should verify that the bindings are working by executing the showinf command from the build subdirectory. If all goes well, you will see a message like:
+
 
+
curtis@monk:~/svn/java/components/native/bf-cpp/build$ ./showinf
+
Creating JVM... JVM created.
+
To test read a file in any format, run:
+
  showinf file [-nopix] [-nocore] [-nometa] [-thumbs]
+
    [-merge] [-stitch] [-separate] [-expand] [-omexml]
+
    [-normalize] [-range start end] [-series num]
+
    [-swap inputOrder] [-shuffle outputOrder] [-preload]
+
    [-xmlversion v] [-crop x,y,w,h]
+
+
  -version: print the library version and exit
+
      file: the image file to read
+
    -nopix: read metadata only, not pixels
+
    -nocore: do not output core metadata
+
    -nometa: do not parse format-specific metadata table
+
  -nofilter: do not filter metadata fields
+
    -thumbs: read thumbnails instead of normal pixels
+
    -merge: combine separate channels into RGB image
+
    -stitch: stitch files with similar names
+
  -separate: split RGB image into separate channels
+
    -expand: expand indexed color to RGB
+
    -omexml: populate OME-XML metadata
+
-normalize: normalize floating point images*
+
    -range: specify range of planes to read (inclusive)
+
    -series: specify which image series to read
+
      -swap: override the default input dimension order
+
  -shuffle: override the default output dimension order
+
  -preload: pre-read entire file into a buffer; significantly
+
            reduces the time required to read the images, but
+
            requires more memory
+
  -xmlversion: specify which OME-XML version to generate
+
+
  * = may result in loss of precision
+
 
+
Once the bindings are functional, proceed to the [[FARSIGHT Tutorials/Building Software/Bio-Formats/Building ITK Plugin|Bio-Formats ITK plugin]] build instructions.
+
 
+
Please direct questions to the [http://www.loci.wisc.edu/ome/formats-contact.html Bio-Formats team].
+

Latest revision as of 20:31, 17 August 2011

NOTICE

It is no longer necessary to build the Bio-Formats C++ bindings to use Bio-Formats with FARSIGHT. Rather, see the Bio-Formats ITK page for instructions.

If you still want to build the Bio-Formats C++ bindings, you can find up-to-date instructions on the Bio-Formats C++ Bindings page.

Personal tools