Compilation guideline
Get the source from piper repository at https://gitlab.inria.fr/piper/application.git. Then you will also need the anatomyDB, which is in a separate repository: https://gitlab.inria.fr/piper/anatomydb. Clone this repository inside the application's repository, specifically in piper/src (alongside the directories "application", "extlibs", "lib" etc.). You don't need to configure it, it will be done automatically within the application configuration. Now you can run cmake and set the required variables to help cmake find Piper dependencies - but you will first need to download them. Following is a detailed guide for what dependencies are needed and how to get them.
Windows
The easy way (recommended): Archive including precompiled dependencies for VS2013-64bits are provided:
- VTK 7.0
- Qt 5.6.2
- python2.7 with numpy
- Mesquite
- Boost
- sofa
- dll fix for windows, see README file in archive
At configure time of the Piper project, set the ''PIPER_PACKAGE_DIR'' cmake variable pointing to the directory where you extracted the archive, it will setup cmake to find the libraries included in the package (although you might need to set the paths to the Qt (included in the package) manually).
If you use this package, you ''should not'' need to download and compile/install any of the dependencies listed in External dependencies.
Guide to do Piper CMAKE based build for Microsoft Visual Studio
- Unzip all the piper dependencies (boost, Python27, Qt ,Sofa, VTK,Mesquite ) inside C:\Lib. (Please use this path only as of now. Otherwise, you have to edit sofa\lib\cmake\SofaFramework\SofaFrameworkTargets.cmake:59 to remove hardcoded boost paths)
- Install OCTAVE (can be skipped if you do not plan to work with Octave scripts).
- Start CMake and do:
- Set the source path, e.g. C:<your_path>\piper\src
- Set the build path as well, e.g. C:<your_path>\piper\build (note - in-sources builds were not tested and therefore we recommend to set the build path outside the source path)
- Press Configure and choose the "Visual Studio 12 2013 Wind64" compiler. Newer compilers ''might'' work, but were not tested. You will probably get some error messages, don't worry about them now. You should now see a list of variables - first we have to set some of them:
- Set PIPER_PACKAGE_DIR cmake variable to C:/Lib (find it in the list, click in the "Value" column and change it)
- Set SOFA_ROOT to C:/Lib/sofa, if an error comes for SOFA_ROOT path
- Set OCTAVE_ROOT_DIR to the folder where Octave is installed (e.g. c:\program files\octave-4.0.2)
- Press Configure again
- If you get an error message that cmake couldn't find Qt5xyz package (xyz is name of some qt module like Widgets, OpenGL, Quick etc.), set it manually to C:/Lib/Qt/5.6/msvc2013_64/lib/cmake/Qt5xyz. Press configure again
- If you have more errors, read them, they often tell you how to resolve them. Do not worry about cmake variables set to NOTFOUND - if you don't get an error message, they are likely not needed
Guide to do Piper Microsoft Visual Studio compilation
- Release build is always supported. Debug mode had been giving issues due to absence of of some libraries built in debug mode. So better to go for Release mode or ReleaseWithDebug (change it in the ~ middle of the upper bar in visual studio, debug is default).
- Build the solution. If you want to run Piper directly from visual studio, set the Piper MSVS project as StartUp project (right click on the project -> set as StartUp project)
- If you want to create a ready-to-distribute package of Piper, build the INSTALL project. Note that this requires building the documentation (see below), at least in html.
- It's done, enjoy using PIPER
There is a bug in non-english versions of Microsoft Visual Studio 2013 (and apparently newer versions as well) which prevents setting more than one environment variable for debugging environment because it incorrectly parses line-feed character, which is needed to separate the individual variables. As this is needed to run Piper, Piper will fail to start if you attempt to start it directly from Visual Studio (e.g. by pressing CTRL+F5) - you will likely see a message in the console saying that "QT plugin windows was not found at ""...". The workaround is to download an English language pack) and use English version. You might still see the "missing plugin" message after you configure with CMake as the variable list can have "wrong" line ends. But what usually helps is to go to the properties of the piper project -> Debugging -> Environment -> Edit and if you see all variables on the same line, separate them manually (there is PATH, then QT_PLUGIN_PATH, QML_IMPORT_PATH, QML2_IMPORT_PATH, QT_QPA_PLATFORM_PLUGIN_PATH, SOFA_ROOT, PYTHONPATH, PYTHONHOME, PYTHONUSERBASE). If they are on separate lines and you still get the message, what usually helps is any kind of edit - just add a line end on any of the lines, then delete it again, in our experience that makes Visual Studio reload the variables correctly.
Linux
All dependencies can be installed from the package management system of your distribution (tested with Ubuntu 14.10), except for :
- QT, the official installer / MaintenanceTool is the simplest way to install and update qt binaries, tested with Qt 5.6.2
- Mesquite in trilinos_2016_10_13
- VTK 7.0
- sofa_ubuntu16_04
Documentation
-
In order to build html documentation, you will have to install Doxygen, latex (MikTex) and Ghostscript and fill in the appropriate paths to the latex tools in the cmake in case they don't get filled automatically once you set MIKTEX_BINARY_PATH to {the path to mixtex, e.g. C:/ProgramFiles/MixTeX2.9}/miktex/bin: DVIPDF_CONVERTER, DVIPS_CONVERTER HTLATEX_COMPILER, LATEX_COMPILER, LUALATEX_COMPILER, MAKEINDEX_COMPILER, PDFLATEX_COMPILER, PDFTOPS_CONVERTER. You will find these tools in the MixTeX's bin directory as .exe files with the same names as the cmake variables.
Currently doxygen supports only 32bit version of ghostscript, so make sure you download that and not the 64 bit. On Windows, you have to add the path to the gswin32.exe (ghostscript binary) manually either to your windows PATH environment variable, or, if you don't want to pollute your PATH, add it in the user-guide project in visual studio in Properties -> VC++ directories -> Executable directories (i.e. gswin32.exe needs to be accesible not during running the project - there is nothing to run - but during building it).
-
In order to build pdf documentation, you need to install MikTex and fill in the appropriate paths in cmake (see above).
-
In order to build the "final" version of pdf documentation (includes title page), you also need LibreOffice and PDFtk. Point the LIBREOFFICE_EXECUTABLE to {LibreOffice install path}/program/soffice.exe and PDFTK_EXECUTABLE to {PDFtk install path}/bin/pdftk.exe (similarly on Linux, except for the .exe part). Note that this pdf file is the one that opens in PIPER if the user presses F2, so make sure to build it before re-distributing the package.
Sofa
If you want to compile PIPER with libraries version not compatible with the provided SOFA binaries, then you need to compile SOFA as well. SOFA is an external library which has a plugin based architecture.
Source code repositories
repository | branch | |
---|---|---|
SOFA | https://github.com/Anatoscope/sofa.git | piper-release |
BranchingImage | https://gitlab.inria.fr/piper/sofa/BranchingImage.git | piper-release |
Anatomy | https://gitlab.inria.fr/piper/sofa/Anatomy.git | piper-release |
LinearSubspace | https://gitlab.inria.fr/piper/sofa/LinearSubspace.git | piper-release |
Sofa QtQuick | https://gitlab.inria.fr/ocarre/sofaqtquick/ | piper-release |
Compilation
The easiest way to add these extra plugins to the sofa compilation is to add a custom.cmake
file at the root of the SOFA source directory. This file gets included by the SOFA build system.
add_subdirectory("../sofa-plugins/sofaqtquick" "${CMAKE_CURRENT_BINARY_DIR}/plugins/sofaqtquick")
add_subdirectory("../sofa-plugins/BranchingImage" "${CMAKE_CURRENT_BINARY_DIR}/plugins/BranchingImage")
add_subdirectory("../sofa-plugins/Anatomy" "${CMAKE_CURRENT_BINARY_DIR}/plugins/Anatomy")
add_subdirectory("../sofa-plugins/LinearSubspace" "${CMAKE_CURRENT_BINARY_DIR}/plugins/LinearSubspace")
Then run cmake
using the following options:
cmake -DAPPLICATION_MODELER=OFF \
-DAPPLICATION_RUNSOFA=OFF \
-DSOFAGUI_GLUT=OFF \
-DSOFAGUI_QTVIEWER=OFF \
-DSOFAGUI_QT=OFF \
-DSOFAGUI_QGLVIEWER=OFF \
-DSOFA_BUILD_SCENECREATOR=OFF \
-DSOFA_BUILD_TESTS=OFF \
-DSOFA_USE_MASK=ON \
-DSOFA_FLOATING_POINT_TYPE=double \
-DPLUGIN_COMPLIANT=ON \
-DPLUGIN_FLEXIBLE=ON \
-DPLUGIN_IMAGE=ON \
-DPLUGIN_BRANCHINGIMAGE=ON \
-DPLUGIN_SOFAPYTHON=ON \
-DPLUGIN_SOFAQTQUICKGUI=ON \
-DPLUGIN_CONTACTMAPPING=ON \
-DPLUGIN_ANATOMY=ON \
-DPLUGIN_LINEARSUBSPACE=ON \
then compile and install. For PIPER to use this freshly built SOFA, set the SOFA_ROOT
cmake variable to the installation directory of SOFA.