Slicer3WrapITKPython

From NAMIC Wiki
Revision as of 20:52, 15 October 2010 by Inorton (talk | contribs)
Jump to: navigation, search
Home < Slicer3WrapITKPython

The recommended ITK wrapping is WrapITK. To build Slicer3 with Python ITK wrapping, make the following change:

Edit [path]/Slicer3/SuperBuild/External_Insight.cmake

  • In the section CMAKE_ARGS, add the following arguments:
      -DINSTALL_WRAP_ITK_COMPATIBILITY:BOOL=ON
      -DUSE_WRAP_ITK:BOOL=ON
      -DWRAP_ITK_PYTHON:BOOL=ON

Then save and make Slicer as usual. BE WARNED that WrapITK will take a long time to compile because of all the templating (>2 hrs on new&fast computer)

If this works, the wrapping should build against the auto-detected system Python. There are options which could be added above so that ITK build uses the Slicer python, but since ITK (Insight) builds first that may cause some problems. Maybe CMake will automatically detect the dependency but I haven't tried it yet... So, the easy way is just let WrapITK do it's thing first, then add ITK manually to the Slicer python:

  • Edit Slicer3-SuperBuild/Insight-build/Wrapping/WrapITK/Python/WrapITK.pth
  • The first line should be ok, but must also add the ITK bin directory. My WrapITK.pth looks like this:
/cmn/dev/Slicer3-SuperBuild/Insight-build/Wrapping/WrapITK/Python
/cmn/dev/Slicer3-SuperBuild/Insight-build/bin
  • Now copy/link WrapITK.pth into the python site-packages directory. For example:
ln -s /cmn/dev/Slicer3-SuperBuild/Insight-build/Wrapping/WrapITK.Python/WrapITK.pth /cmn/dev/Slicer3-SuperBuild/python-build/lib/python2.6/site-packages/

Note that you must give the full path to WrapITK.pth

Now start Slicer and gain Insight!