Building PyVE ============== PyVE and the packages it is made of are available as various flavours of open-source packages. Therefore if you don't find the binary for your system (actually only a Windows binary is distributed) you can compile it yourself. What you need is a good dose of patience. Depending on your system however, you may or may not find suitable binary packages for the following software packages at their websites. Prerequisites ------------- * `Python 2.x <http://python.org>`_ * `CMake 2.8.x <http://www.cmake.org/>`_ (for compilation) * `SWIG 1.3.x <http://swig.org>`_ (for the python wrapping) Building -------- The following software packages must be compiled and installed on your system in order to have PyVE working. * `VTK 5.4.x <http://www.vtk.org>`_ * `PyVE Viewer <https://sourceforge.net/p/pyve/code/>`_ * `ITK 3.20.x <http://www.itk.org>`_ * `WrapITK 0.30.x <http://code.google.com/p/wrapitk/>`_ * `GDCM <http://sourceforge.net/projects/gdcm/files/gdcm%202.x/>`_ (optional, reccomended to use DICOM) * `elastix <http://elastix.isi.uu.nl/>`_ required if you want to perform image registration of some kind (requires ITK 3.20) * `Qt 4.6.x <http://qt.nokia.com/downloads/downloads#qt-lib>`_ (optional, reccomended for GUI development) * `SIP <http://www.riverbankcomputing.co.uk/software/sip/download>`_ and `PyQt4 <http://www.riverbankcomputing.co.uk/software/pyqt/download>`_ (optional, reccomended for GUI development) * `Qwt <http://qwt.sourceforge.net/>`_ and `PyQwt <http://pyqwt.sourceforge.net/>`_ (optional, reccomended for plotting in GUI) We will cover here the compilation instructions for the first 5 packages. The other packages should compile out of the box following the general instructions that are provided at the respective websites. The instructions are reported for Windows but the same settings can be used for the compilation in other systems. The PyVE Viewer is reported to have been compiled under Linux (Debian 6.0 powerpc) and MacOSX 10.4.11. Building VTK ^^^^^^^^^^^^ To build VTK, you need CMake. * Download the `VTK <http://www.vtk.org/VTK/resources/software.html>`_ source package and extract to E:\Libraries\vtk-x.x.x. * Open CMake and browse to the VTK source folder. * Specify a location to build the binaries, for example E:\Libraries\vtk-x.x.x-bin. * Click *Configure*, and select your target compiler, for example *Visual Studio 8 2005* * Modify the following fields (some require Advanced View): :: BUILD_SHARED_LIBS ON BUILD_TESTING OFF CMAKE_INSTALL_PREFIX # Location where you want to install VTK VTK_DATA_ROOT # location where you downloaded and unpacked VTKData VTK_WRAP_PYTHON ON VTK_USE_GUISUPPORT ON VTK_USE_TK OFF * Click 'Configure' again. Modify the following fields: :: VTK_USE_QVTK ON DESIRED_QT_VERSION 4 VTK_USE_QVTK_QTOPENGL ON * Click 'Configure' again. * Click 'Configure' one final time, and click 'Generate' to create the project files. * Open the '''Visual Studio 2005 Command Prompt''' ('''Start Menu|Programs|Microsoft Visual Studio 2005|Visual Studio Tools'''), go to the binaries directory, and build the solution: :: msbuild VTK.sln /property:configuration=Release * To install VTK to the directory specified in ``CMAKE_INSTALL_PREFIX``, build the ``INSTALL`` project: :: msbuild INSTALL.vcproj /property:configuration=Release Qt designer plugin: To add the VTK viewer widget to the Qt designer: * Copy ``[VTK]\bin\release\QVTKWidgetPlugin.dll`` to ``[Qt]\plugins\designer``. Building the PyVE Viewer ^^^^^^^^^^^^^^^^^^^^^^^^ With VTK compiled and installed it is already possible to compile the PyVE Viewer class with CMake. * Download the vtkPyveViewer source code from Sourceforge :: git clone git://git.code.sf.net/p/pyve/code pyve-code * Open CMake and browse to the vtkPyveViewer source folder. * Specify the binaries directory, * Click ``Configure`` * Make sure the field ``CMAKE_INSTALL_PREFIX`` matches that of VTK. * Click ``Configure``, then ``Generate``. * Open the ``Visual Studio 2005 Command Prompt`` (Start Menu|Programs|Microsoft Visual Studio 2005|Visual Studio Tools) go to the binaries directory, and build the solution: :: msbuild vtkPyve.sln /property:configuration=Release * To install vtkPyveViewer to the directory specified in ``CMAKE_INSTALL_PREFIX``, build the ``INSTALL`` project: :: msbuild INSTALL.vcproj /property:configuration=Release Building ITK and WrapITK ^^^^^^^^^^^^^^^^^^^^^^^^ To wrap ITK for Python using the WrapITK project, you will need `CableSwig <http://www.itk.org/ITK/resources/CableSwig.html>`_. CableSwig is currently only available by CVS. :: cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/CableSwig co CableSwig * Download the `ITK source <http://www.itk.org/ITK/resources/software.html>`_ and extract to E:\Libraries\itk-x.x.x. * Copy the CableSwig directory to [ITK]\Utilities. * Open CMake and browse to the ITK source folder. * Specify a location to build the binaries, for example E:\Libraries\itk-x.x.x-bin. * Click *Configure*, and select your target compiler, for example **Visual Studio 8 2005** * Modify the following fields (some require *Advanced View* :: BUILD_EXAMPLES OFF BUILD_SHARED_LIBS ON BUILD_TESTING OFF CMAKE_INSTALL_PREFIX # Location where you eventually want to install ITK ITK_USE_REVIEW ON USE_WRAP_ITK ON * Add ``/bigobj`` to the field ``CMAKE_CXX_FLAGS``. * Click 'Configure' again. Modify the following fields: :: WRAP_ITK_DIMS 2;3;4 WRAP_ITK_PYTHON ON WRAP_Iterators ON WRAP_rgb_unsigned_char ON WRAP_rgb_unsigned_short OFF WRAP_rgba_unsigned_char ON WRAP_rgba_unsigned_short OFF WRAP_signed_short ON WRAP_unsigned_char ON WRAP_unsigned_short OFF * Click *Configure* one final time, and click *Generate* to create the project files. * Open the *Visual Studio 2005 Command Prompt* (Start Menu|Programs|Microsoft Visual Studio 2005|Visual Studio Tools), go to the binaries directory, and build the ITK solution: :: msbuild ITK.sln /property:configuration=Release * To install ITK to the directory specified in ``CMAKE_INSTALL_PREFIX``, build the **INSTALL** project: :: msbuild INSTALL.vcproj /property:configuration=Release Building GDCM ^^^^^^^^^^^^^ To build GDCM, you need SWIG. * Download the `GDCM <http://sourceforge.net/projects/gdcm/files/gdcm%202.x/>`_ package and unpack it for example in ``E:\Libraries\gdcm-x.x.x`` * Open CMake and browse to ``E:\Libraries\gdcm-x.x.x``. * Specify the binaries directory, preferably ``E:\Libraries\gdcm-x.x.x-bin``. * Click *Configure*. * Modify the following fields: :: CMAKE_INSTALL_PREFIX # Location where you want to install GDCM GDCM_BUILD_SHARED_LIBS ON GDCM_WRAP_PYTHON ON SWIG_EXECUTABLE [SWIG]\swig.exe * Click *Configure*, then *Generate*. * Go to the binaries directory and open the solution file (GDCM.sln), and build the solution. * To install GDCM to the directory specified in ``CMAKE_INSTALL_PREFIX``, build the INSTALL project. See `Configuring and Building GDCM <http://gdcm.sourceforge.net/wiki/index.php/Configuring_and_Building_With_VS_.NET_2003>`_ External Binary and Python Packages ----------------------------------- We suggest to use the packages: * `numpy/scipy <http://scipy.org/>`_ * `pyDicom 0.9.5 <http://code.google.com/p/pydicom/>`_