Editing
Archive
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=Bone lab libraries= A library of reusable bits for the kinds of things we do in the lab. Built on VTK and ITK and other toolkits. ==Overview== The main libraries are vtkski and itkski. These provide various VTK and ITK classes respectively that can be used in other programs. Refer to * [[vtkski development]] * [[itkski development]] See [[Bone lab applications]] for Applications that make use of these libraries You may want to consider using vtkn88 from the Numerics88 software. vtkn88 is not as extensive as vtkski, but it is better maintained and better tested. See [http://mike.kin.ucalgary.ca/numerics88/manual/html/#vtkn88 the section on vtkn88] in the Numerics88 manual. To make things more confusing, quite a bit of old code is actually in vtkMy (see [[vtkMy development]]). It will be ported eventually to vtkski or itkski. Generally if you need to use something there, it is better to port the specific parts you need to vtkski or itkski or Applications. ==Build Instructions== ===Prerequisites=== Refer the to development page corresponding to your system: * [[Development on OS-X]] * [[Development on Windows]] * [[Development on Linux]] You should find there lists of required software, as well as installation instructions. ===Getting the source code=== Choose a place in your home directory that you want to use for the source code. For example mkdir -p ~/code/bonelab cd ~/code/bonelab (Note that '~' gets automatically expanded to your home directory.) Get the sources from the subversion repository. svn checkout https://mike.kin.ucalgary.ca/svn/bonelab/trunk See the section on svn for more info: [[Subversion (SVN)]] . ===Compiling=== ====Create a build directory==== Create a build directory in trunk/Libraries and use cmake to configure the build: cd trunk/Libraries mkdir build cd build ====setenv.sh==== If you're using setenv.sh scripts (see [[Development_on_OS-X#Scripts to Set Environment Variables]]), here is a template. You'll have to adjust the paths for your system. Put this is the build directory; source it before configuring with cmake, and cmake should find everything itself. <source lang=bash> #!/bin/bash # # setenv.sh for bonelab Libraries. source /opt/boost-1.49.0/setenv.sh source /opt/itk-3.20.1/setenv.sh source /opt/vtk-5.10.0/setenv.sh SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" export BONELAB_LIBRARIES_DIR="${SCRIPT_DIR}/bin" export vtkski_DIR="${SCRIPT_DIR}/vtkski" remove_path DYLD_LIBRARY_PATH '/opt/bonelab(-[^/]+)?/lib/?' remove_path DYLD_LIBRARY_PATH '.*/bonelab/.*/Libraries/.*' add_path DYLD_LIBRARY_PATH "${BONELAB_LIBRARIES_DIR}" remove_path PYTHONPATH '/opt/bonelab(-[^/]+)?/lib/?' remove_path PYTHONPATH '.*/bonelab/.*/Libraries/.*' add_path PYTHONPATH "${BONELAB_LIBRARIES_DIR}" </source> Of course, the exact paths will depends on the versions and where you installed them. This is an optional step, but it does make configuring cmake easier. It also makes accessing the libraries easier from other software. =====configuring with cmake===== So now for configuring cmake: cmake-gui .. Here are some typical configuration options: {| border="1" cellpadding="2" cellspacing="0" |- ! option ! Setting ! Comments |- valign="top" | CMAKE_BUILD_TYPE || Release || If not set, that's fine, but you'll get more optimized (i.e. faster) binaries if you set this to Release. |- valign="top" | CMAKE_INSTALL_PREFIX || /opt/bonelab-r2970 || You don't actually have to set anything for this, as bonelab can be run from the build directory. However, if you do install it, it's probably best to include the specific SVN revision number in the directory name. |- valign="top" | VTK_DIR || /opt/vtk-5.10.0/lib/vtk-5.10 || Set this to wherever you installed VTK. If you intend to build the paraview extensions as plugins, then you set this to the internal version of VTK inside the paraview build directory. (See [[Paraview development]] if you need to install ParaView). |- valign="top" | BONELAB_BUILD_LIBRARY_itkski || ON/OFF || Set this to OFF if you don't want to build itkski as well. In this case you won't need to have ITK installed or specify where it can be found. |- valign="top" | ITK_DIR || /opt/itk-3.20.1/lib/InsightToolkit || You only need to set this if BONELAB_BUILD_LIBRARY_itkski is ON. In that case, set it to wherever you installed ITK. |- valign="top" | Boost_INCLUDE_DIR || /opt/boost-1.47.0/include || Set this to wherever you installed boost. Note that this is an Advanced setting, and you won't see it until you toggle to Advanced view. Don't worry about all the Boost libraries it doesn't find; as soon as Boost_INCLUDE_DIR is properly set, it will find them. |- valign="top" | PYTHON_INCLUDE_DIR || /Library/Frameworks/Python.framework/Versions/2.7/Headers || This is if you've installed a more recent version on OS-X than the default version included in OS-X. CMake tends to always find the default version. |- valign="top" | PYTHON_LIBRARY || /Library/Frameworks/Python.framework/Versions/lib/libpython2.7.dylib || See the comments for PYTHON_INCLUDE_DIR |} Once you're happy with your settings, hit Configure. You might have to hit it a couple of times until there are no more errors, and the Generate button is enabled. Then hit Generate and quite cmake-gui. Now run: make You won't usually need to run a 'make install', since you can just use vtkski from your build directory. ===Building Doxygen documentation=== This is an advanced topic. Most users can just refer to the documentation here: http://mike.kin.ucalgary.ca/vtkski/ . To build the Doxygen documentation, set the cmake variable BUILD_DOCUMENTATION to ON. This variable is marked as advanced. You will need to have installed Doxygen ( http://www.doxygen.org/ ) in order to build the documentation. The documentation is not automatically built with make (it takes a very long time to build). Instead, you will need to explicitly request it, like this: make vtkskiDoxygenDoc Warning: You must build against a source code tree of VTK, rather than a binary install. This is because certain scripts from the VTK source code directory are required to build the documentation. (Explicitly, the cmake variable VTK_DIR should be something like /Users/eric/source/vtk-5.6.0/build and not something like /opt/vtk-5.6.0/lib/vtk-5.6 ). ===Installing=== For personal use, just use the bonelab libraries from the build directories. However, for making available to everyone on the system, you can do this: sudo make install This should be done for both the Libraries and the Applications (run from the respective build directories). It will install a setenv.sh script, but it's usually a good idea to fix it up so the paths for vtk and itk are also set. Typically add lines like this near the beginning of the setenv.sh file in the installation directory: source /opt/vtk-5.10.0/setenv.sh source /opt/itk-3.20.1/setenv.sh These should match exactly the versions that were used to build bonelab. ==Building the Applications== Similar process to building the libraries, except that you create the build directory in Applications/build , and do everything from there. ====Installing the Doxygen documentation on mike.kin==== I recommend that you build the documentation with the cmake flag DOCUMENTATION_HTML_TARZ set to on (this variable is an advanced setting). Then the build process will automatically make a tar ball of all the HTML documentation, build/Utilities/Doxygen/vtkski-html.tar.gz , which is easy to copy over to mik.kin (using FTP or scp or the mounted Data0 volume). The documentation needs to live in /Library/WebServer/Documents/vtkski . The commands would look something like this tar xvzf vtkski-html.tar.gz sudo rm -rf /Library/WebServer/Documents/vtkski # remove old docs sudo mv html /Library/WebServer/Documents/vtkski sudo chown -R root /Library/WebServer/Documents/vtkski
Summary:
Please note that all contributions to bone.wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BoneWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
associated-pages
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Documents
Recent changes
Help
Tools
What links here
Related changes
Page information