Build in Windows

From BioImageXD Wiki
(Difference between revisions)
Jump to: navigation, search
 
(4 intermediate revisions by one user not shown)
Line 26: Line 26:
 
#: <code>VTK_USE_TK: OFF</code>
 
#: <code>VTK_USE_TK: OFF</code>
 
# Click 'Configure' to configure and 'Generate' to generate and exit
 
# Click 'Configure' to configure and 'Generate' to generate and exit
# Issue command 'make', get a cup of coffee and wait about 30-60 minutes for VTK to get build
+
# Go to directory you selected for binaries and open file 'VTK.sln' to Visual Studio.
# Set <code>${VTK_INSTALL_DIR}/lib/python2.6/site-packages/</code> to <code>PYTHONPATH</code> so you can install VTK correctly, if you are installing VTK outside path
+
# Select Build->Build Solution, get a cup of coffee and wait about 30-60 minutes for VTK to get build
# Issue command 'make install' to install built VTK to directory defined in <code>CMAKE_INSTALL_PREFIX</code>
+
  
  
 
== Building ITK ==
 
== Building ITK ==
  
# Download ITK 3.20.1 (ITK 4.x.x will not work, we'll updated this guide when we move to ITK 4), http://sourceforge.net/projects/itk/files/itk/3.20/InsightToolkit-3.20.1.tar.gz/download
+
# Download ITK 3.20.1 (ITK 4.x.x will not work, we'll updated this guide when we move to ITK 4), http://sourceforge.net/projects/itk/files/itk/3.20/InsightToolkit-3.20.1.zip/download
 
# Extract package
 
# Extract package
# Go to directory where you extracted ITK source and issue command 'ccmake .'
+
# Open CMake GUI
# Set following settings (click 't' to toggle advanced mode on, and 'c' to configure):
+
# Browse path of ITK sources to "Where is the source code"
#: <code>BUILD_EXAMPLES: OFF (you can leave it ON if you want, increases compilation time)</code>
+
# Create new directory for binaries and set it to "Where to build the binaries"
 +
# Change Simple view to Advanced view
 +
# Set following settings:
 +
#: <code>BUILD_EXAMPLES: OFF</code>
 
#: <code>BUILD_SHARED_LIBS: ON</code>
 
#: <code>BUILD_SHARED_LIBS: ON</code>
#: <code>BUILD_TESTING: OFF (you can leave it ON if you want, increases compilation time)</code>
+
#: <code>BUILD_TESTING: OFF</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
#: <code>CMAKE_INSTALL_PREFIX: Change to some location where you have write access if you don't have admin rights</code>
 
 
#: <code>ITK_USE_OPTIMIZED_REGISTRATION: ON</code>
 
#: <code>ITK_USE_OPTIMIZED_REGISTRATION: ON</code>
 
#: <code>ITK_USE_REVIEW: ON</code>
 
#: <code>ITK_USE_REVIEW: ON</code>
 
#: <code>ITK_USE_REVIEW_STATISTICS: ON</code>
 
#: <code>ITK_USE_REVIEW_STATISTICS: ON</code>
# Click 'c' to configure (don't care about attentions) and 'g' to generate and exit
+
# Click 'Configure' to configure (don't care about attentions) and 'Generate' to generate and exit
# Issue command 'make', get another cup of coffee and wait about 10 minutes for ITK to get build
+
# Go to directory you selected for binaries and open file 'ITK.sln' to Visual Studio.
# Issue command 'make install' to install built ITK to directory defined in <code>CMAKE_INSTALL_PREFIX</code>
+
# Select Build->Build Solution, get another cup of coffee and wait about 10 minutes for ITK to get build
  
  
 
== Building CableSwig (needed for wrapITK) ==
 
== Building CableSwig (needed for wrapITK) ==
  
# Download CableSwig-ITK 3.20.0, http://voxel.dl.sourceforge.net/sourceforge/itk/CableSwig-ITK-3.20.0.tar.gz
+
# Download CableSwig-ITK 3.20.0, http://voxel.dl.sourceforge.net/sourceforge/itk/CableSwig-ITK-3.20.0.zip
 
# Extract package
 
# Extract package
# Go to directory where you extracted CableSwig source and issue command 'ccmake .'
+
# Open CMake GUI
# Set following settings (click 't' to toggle advanced mode on, and 'c' to configure):
+
# Browse path of CableSwig sources to "Where is the source code"
 +
# Create new directory for binaries and set it to "Where to build the binaries"
 +
# Change Simple view to Advanced view
 +
# Set following settings:
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
#: <code>CMAKE_INSTALL_PREFIX: Change to some location where you have write access if you don't have admin rights</code>
+
# Click 'Configure' to configure and 'Generate' to generate and exit
# Click 'c' to configure and 'g' to generate and exit
+
# Go to directory you selected for binaries and open file 'CableSwig.sln' to Visual Studio.
# Issue command 'make', get another cup of coffee and wait about 5 minutes for CableSwig to get build
+
# Select Build->Build Solution, and wait about 5 minutes for CableSwig to get build
# Issue command 'make install' to install built ITK to directory defined in <code>CMAKE_INSTALL_PREFIX</code>
+
  
  
Line 67: Line 70:
 
# Create directory for wrapITK source
 
# Create directory for wrapITK source
 
# Go to directory and fetch sources using command 'svn checkout http://wrapitk.googlecode.com/svn/branches/maint .'
 
# Go to directory and fetch sources using command 'svn checkout http://wrapitk.googlecode.com/svn/branches/maint .'
# Issue command 'ccmake .'
+
# Open CMake GUI
# Set following settings (click 't' to toggle advanced mode on, and 'c' to configure, don't care about missing ITK_DIR error):
+
# Browse path of wrapITK sources to "Where is the source code"
#: <code>BUILD_TESTING: OFF (you can leave it ON if you want, increases compilation time)</code>
+
# Create new directory for binaries and set it to "Where to build the binaries"
 +
# Change Simple view to Advanced view
 +
# Set following settings:
 +
#: <code>BUILD_TESTING: OFF</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
#: <code>CMAKE_INSTALL_PREFIX: Change to some location where you have write access if you don't have admin rights</code>
 
 
#: <code>ITK_DIR: Set to root directory of your ITK sources</code>
 
#: <code>ITK_DIR: Set to root directory of your ITK sources</code>
 
#: <code>WRAP_double: ON</code>
 
#: <code>WRAP_double: ON</code>
 
#: <code>WRAP_unsigned_char: ON</code>
 
#: <code>WRAP_unsigned_char: ON</code>
 
#: <code>WRAP_unsigned_long: ON</code>
 
#: <code>WRAP_unsigned_long: ON</code>
# Click 'c' to configure (don't care about possible errors) and set
+
# Click 'Configure' to configure (don't care about possible errors) and set
 
#: <code>CableSwig_DIR: Set to root directory of your CableSwig sources</code>
 
#: <code>CableSwig_DIR: Set to root directory of your CableSwig sources</code>
 
#: <code>WRAP_ITK_PYTHON: ON</code>
 
#: <code>WRAP_ITK_PYTHON: ON</code>
#: <code>INSTALL_WRAP_ITK_COMPATIBILITY: OFF (if you don't have admin rights)</code>
+
#: <code>INSTALL_WRAP_ITK_COMPATIBILITY: OFF</code>
# Click 'c' to configure, nothing to set so click 'c' to configure again, and 'g' to generate and exit
+
# Click 'Configure' to configure, nothing to set so click 'Configure' to configure again, and 'Generate' to generate and exit
# Issue command 'make'. Since you have now drinked 3 cups of coffee you might not feel like having a lunch right now. Go for nice 30-60 minutes walk outside. After that you can have lunch or dinner. Then wait a while for building of wrapITK to finish. It will take about 3-5 hours.
+
# Go to directory you selected for binaries and open file 'wrapITK.sln' to Visual Studio.
# Issue command 'make install' to install built wrapITK to directory defined in <code>CMAKE_INSTALL_PREFIX</code>
+
# Select Build->Build Solution. Since you have drinked too many cups of coffee you might not feel like having a lunch right now. Go for nice 30-60 minutes walk outside. After that you can have lunch or dinner. Then wait a while for building of wrapITK to finish. It will take about 3-5 hours.
# Go into directory ${wrapITK_source}/ExternalProjects/ItkVtkGlue
+
# Open CMake GUI
# Issue command 'ccmake .'
+
# Browse path ${wrapITK_source}\ExternalProjects\ItkVtkGlue to "Where is the source code" and "Where to build the binaries"
# Set following settings (click 't' to toggle advanced mode on, and 'c' to configure, don't care about missing <code>ITK_DIR</code> error):
+
# Change Simple view to Advanced view
 +
# Set following settings:
 
#: <code>BUILD_WRAPPERS: ON</code>
 
#: <code>BUILD_WRAPPERS: ON</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
#: <code>CMAKE_INSTALL_PREFIX: Same as selected for wrapITK</code>
 
 
#: <code>ITK_DIR: Set to root directory of ITK sources</code>
 
#: <code>ITK_DIR: Set to root directory of ITK sources</code>
#: <code>LIBRARY_OUTPUT_PATH: Same as selected for wrapITK</code>
+
# Click 'Configure' to configure (don't care about possible errors) and set
# Click 'c' to configure (don't care about possible errors) and set
+
 
#: <code>VTK_DIR: Set to root directory of VTK sources</code>
 
#: <code>VTK_DIR: Set to root directory of VTK sources</code>
# Click 'c' to configure and set
+
# Click 'Configure' to configure and set
 
#: <code>WrapITK_DIR: Set to root directory of wrapITK sources</code>
 
#: <code>WrapITK_DIR: Set to root directory of wrapITK sources</code>
# Click 'c' to configure, and 'g' to generate and exit
+
# Click 'Configure' to configure, and 'Generate' to generate and exit
# Issue command 'make'
+
# Go to directory ${wrapITK_source}\ExternalProjects\ItkVtkGlue and open file 'ItkVtkGlue.sln' to Visual Studio
# Issue command 'make install'
+
# Select Build->Build Solution, and wait for ItkVtkGlue to get build
  
  
Line 103: Line 107:
  
 
# Create directory for BioImageXD sources and fetch sources using command 'svn co https://bioimagexd.svn.sourceforge.net/svnroot/bioimagexd/bioimagexd/trunk .'
 
# Create directory for BioImageXD sources and fetch sources using command 'svn co https://bioimagexd.svn.sourceforge.net/svnroot/bioimagexd/bioimagexd/trunk .'
# Go into directory ${BXD_source}/vtkBXD
+
# Open CMake GUI
# Issue command 'ccmake .'
+
# Browse path ${BXD_source}\vtkBXD to "Where is the source code" and "Where to build the binaries"
# Set following settings (click 't' to toggle advanced mode on, and 'c' to configure, don't care about possible errors):
+
# Change Simple view to Advanced view
 +
# Set following settings:
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
#: <code>CMAKE_INSTALL_PREFIX: Same as selected for VTK</code>
 
 
#: <code>VTK_DIR: Set to root directory of VTK sources</code>
 
#: <code>VTK_DIR: Set to root directory of VTK sources</code>
# Click 'c' to configure, 'c' to configure, and 'g' to generate and exit
+
# Click 'Configure' to configure, 'Configure' to configure, and 'Generate' to generate and exit
# Issue command 'make'
+
# Go to directory ${BXD_source}\vtkBXD and open file 'VTKBXD.sln' to Visual Studio
# Issue command 'make install'
+
# Select Build->Build Solution, and wait for VTKBXD to get build
# Go into directory ${BXD_source}/itkBXD
+
# Open CMake GUI
# Issue command 'ccmake .'
+
# Browse path ${BXD_SOURCE}\itkBXD to "Where is the source code" and "Where to build the binaries"
# Set following settings (click 't' to toggle advanced mode on, and 'c' to configure, don't care about possible errors):
+
# Change Simple view to Advanced view
 +
# Set following settings:
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
 
#: <code>CMAKE_BUILD_TYPE: Release</code>
#: <code>CMAKE_INSTALL_PREFIX: Same as selected for wrapITK</code>
 
 
#: <code>ITK_DIR: Set to root directory of ITK sources</code>
 
#: <code>ITK_DIR: Set to root directory of ITK sources</code>
 
#: <code>WrapITK_DIR: Set to root directory of wrapITK sources</code>
 
#: <code>WrapITK_DIR: Set to root directory of wrapITK sources</code>
#: <code>LIBRARY_OUTPUT_PATH: Same as selected for wrapITK</code>
+
# Click 'Configure' to configure, 'Configure' to configure and 'Generate' to generate and exit
# Click 'c' to configure, 'c' to configure and 'g' to generate and exit
+
# Go to directory ${BXD_SOURCE}\itkBXD and open file 'ITKBXD.sln' to Visual Studio
# Issue command 'make'
+
# Select Build->Build Solution, and wait for ITKBXD to get build
# Issue command 'make install'
+
  
  
Line 128: Line 131:
  
  
Now you can go to root of BioImageXD source and launch BioImageXD by 'python BioImageXD.py'. Depending where you installed libraries, you might need to set PYTHONPATH and/or LD_LIBRARY_PATH. You might even want to set path to your shared libraries to /etc/ld.so.conf.d if your built libs aren't in path already, and you have permission to write to /etc/ld.so.conf.d. If you don't have any additional rights and you have built BioImageXD outside any previously defined paths, you can set PYTHONPATH and <code>LD_LIBRARY_PATH</code> as (notice building of VTK, part 8):<br/><code>
+
Now you can go to root of BioImageXD sources and launch BioImageXD by 'python BioImageXD.py'. Depending where you built libraries, you might need to set PYTHONPATH and/or PATH environment variables. Add following to your environment variables (Windows 7: Control Panel->System->Advanced system settings->Environment variables):
PYTHONPATH=${VTK_INSTALL_PATH}/lib/python2.6/site-packages/VTK-5.6.1-py2.6.egg/:${VTK_INSTALL_PATH}/lib/python2.6/site-packages/:${WRAPITK_SOURCE}/Languages/Python/:${WRAPITK_INSTALL_PATH}/lib/InsightToolkit/WrapITK/Python<br/>
+
<code>
LD_LIBRARY_PATH=${VTK_INSTALL_PATH}/lib/vtk-5.6/:${VTK_INSTALL_PATH}/lib/:${ITK_INSTALL_PATH}/lib/InsightToolkit
+
PYTHONPATH=${VTK_BINARY_PATH}\Wrapping\Python:${VTK_BINARY_PATH}\bin\Release:${VTKBXD_BINARY_PATH}\Wrapping\Python:${VTKBXD_BINARY_PATH}\bin\Release:${WRAPITK_BINARY_PATH}\lib:${WRAPITK_BINARY_PATH}\Languages\Python\Release:${ITKVTKGLUE_BINARY_PATH}\lib:${ITKBXD_BINARY_PATH}\lib<br/>
 +
PATH=${WRAPITK_BINARY_PATH}\lib\Release:${ITK_BINARY_PATH}\lib\Release:${ITKVTKGLUE_BINARY_PATH}\lib\Release:${ITKBXD_BINARY_PATH}\lib\Release
 
</code>
 
</code>
 +
Where <code>${...}</code> should be replaced with path to that location.

Latest revision as of 09:09, 5 July 2012

These instructions give details how we build all necessary libraries and setup BioImageXD in Windows. Same instructions work for Windows XP, Vista and 7, and for both 32- and 64-bit systems. We use Visual Studio 2008 to build necessary libraries, but other tools should work as well. If you have any problems, contact info@bioimagexd.net. Whole process takes full day (about 8h), but gladly computer will do most of the job.

Prerequisites:


Contents

[edit] Building VTK

  1. Download VTK 5.6.1 (or newer, might work, but no guarantees), http://www.vtk.org/files/release/5.6/vtk-5.6.1.zip
  2. Extract package
  3. Open CMake GUI
  4. Browse path of VTK sources to "Where is the source code"
  5. Create new directory for binaries and set it to "Where to build the binaries"
  6. Change Simple view to Advanced view
  7. Set following settings:
    BUILD_SHARED_LIBS: ON
    BUILD_TESTING: OFF
    CMAKE_BUILD_TYPE: Release
    VTK_USE_PARALLEL: ON
    VTK_WRAP_PYTHON: ON
  8. Click 'Configure' and set
    VTK_USE_TK: OFF
  9. Click 'Configure' to configure and 'Generate' to generate and exit
  10. Go to directory you selected for binaries and open file 'VTK.sln' to Visual Studio.
  11. Select Build->Build Solution, get a cup of coffee and wait about 30-60 minutes for VTK to get build


[edit] Building ITK

  1. Download ITK 3.20.1 (ITK 4.x.x will not work, we'll updated this guide when we move to ITK 4), http://sourceforge.net/projects/itk/files/itk/3.20/InsightToolkit-3.20.1.zip/download
  2. Extract package
  3. Open CMake GUI
  4. Browse path of ITK sources to "Where is the source code"
  5. Create new directory for binaries and set it to "Where to build the binaries"
  6. Change Simple view to Advanced view
  7. Set following settings:
    BUILD_EXAMPLES: OFF
    BUILD_SHARED_LIBS: ON
    BUILD_TESTING: OFF
    CMAKE_BUILD_TYPE: Release
    ITK_USE_OPTIMIZED_REGISTRATION: ON
    ITK_USE_REVIEW: ON
    ITK_USE_REVIEW_STATISTICS: ON
  8. Click 'Configure' to configure (don't care about attentions) and 'Generate' to generate and exit
  9. Go to directory you selected for binaries and open file 'ITK.sln' to Visual Studio.
  10. Select Build->Build Solution, get another cup of coffee and wait about 10 minutes for ITK to get build


[edit] Building CableSwig (needed for wrapITK)

  1. Download CableSwig-ITK 3.20.0, http://voxel.dl.sourceforge.net/sourceforge/itk/CableSwig-ITK-3.20.0.zip
  2. Extract package
  3. Open CMake GUI
  4. Browse path of CableSwig sources to "Where is the source code"
  5. Create new directory for binaries and set it to "Where to build the binaries"
  6. Change Simple view to Advanced view
  7. Set following settings:
    CMAKE_BUILD_TYPE: Release
  8. Click 'Configure' to configure and 'Generate' to generate and exit
  9. Go to directory you selected for binaries and open file 'CableSwig.sln' to Visual Studio.
  10. Select Build->Build Solution, and wait about 5 minutes for CableSwig to get build


[edit] Building wrapITK (the long-lasting part)

  1. Create directory for wrapITK source
  2. Go to directory and fetch sources using command 'svn checkout http://wrapitk.googlecode.com/svn/branches/maint .'
  3. Open CMake GUI
  4. Browse path of wrapITK sources to "Where is the source code"
  5. Create new directory for binaries and set it to "Where to build the binaries"
  6. Change Simple view to Advanced view
  7. Set following settings:
    BUILD_TESTING: OFF
    CMAKE_BUILD_TYPE: Release
    ITK_DIR: Set to root directory of your ITK sources
    WRAP_double: ON
    WRAP_unsigned_char: ON
    WRAP_unsigned_long: ON
  8. Click 'Configure' to configure (don't care about possible errors) and set
    CableSwig_DIR: Set to root directory of your CableSwig sources
    WRAP_ITK_PYTHON: ON
    INSTALL_WRAP_ITK_COMPATIBILITY: OFF
  9. Click 'Configure' to configure, nothing to set so click 'Configure' to configure again, and 'Generate' to generate and exit
  10. Go to directory you selected for binaries and open file 'wrapITK.sln' to Visual Studio.
  11. Select Build->Build Solution. Since you have drinked too many cups of coffee you might not feel like having a lunch right now. Go for nice 30-60 minutes walk outside. After that you can have lunch or dinner. Then wait a while for building of wrapITK to finish. It will take about 3-5 hours.
  12. Open CMake GUI
  13. Browse path ${wrapITK_source}\ExternalProjects\ItkVtkGlue to "Where is the source code" and "Where to build the binaries"
  14. Change Simple view to Advanced view
  15. Set following settings:
    BUILD_WRAPPERS: ON
    CMAKE_BUILD_TYPE: Release
    ITK_DIR: Set to root directory of ITK sources
  16. Click 'Configure' to configure (don't care about possible errors) and set
    VTK_DIR: Set to root directory of VTK sources
  17. Click 'Configure' to configure and set
    WrapITK_DIR: Set to root directory of wrapITK sources
  18. Click 'Configure' to configure, and 'Generate' to generate and exit
  19. Go to directory ${wrapITK_source}\ExternalProjects\ItkVtkGlue and open file 'ItkVtkGlue.sln' to Visual Studio
  20. Select Build->Build Solution, and wait for ItkVtkGlue to get build


[edit] Get BioImageXD sources and build vtkBXD and itkBXD

  1. Create directory for BioImageXD sources and fetch sources using command 'svn co https://bioimagexd.svn.sourceforge.net/svnroot/bioimagexd/bioimagexd/trunk .'
  2. Open CMake GUI
  3. Browse path ${BXD_source}\vtkBXD to "Where is the source code" and "Where to build the binaries"
  4. Change Simple view to Advanced view
  5. Set following settings:
    CMAKE_BUILD_TYPE: Release
    VTK_DIR: Set to root directory of VTK sources
  6. Click 'Configure' to configure, 'Configure' to configure, and 'Generate' to generate and exit
  7. Go to directory ${BXD_source}\vtkBXD and open file 'VTKBXD.sln' to Visual Studio
  8. Select Build->Build Solution, and wait for VTKBXD to get build
  9. Open CMake GUI
  10. Browse path ${BXD_SOURCE}\itkBXD to "Where is the source code" and "Where to build the binaries"
  11. Change Simple view to Advanced view
  12. Set following settings:
    CMAKE_BUILD_TYPE: Release
    ITK_DIR: Set to root directory of ITK sources
    WrapITK_DIR: Set to root directory of wrapITK sources
  13. Click 'Configure' to configure, 'Configure' to configure and 'Generate' to generate and exit
  14. Go to directory ${BXD_SOURCE}\itkBXD and open file 'ITKBXD.sln' to Visual Studio
  15. Select Build->Build Solution, and wait for ITKBXD to get build


[edit] Final setup

Now you can go to root of BioImageXD sources and launch BioImageXD by 'python BioImageXD.py'. Depending where you built libraries, you might need to set PYTHONPATH and/or PATH environment variables. Add following to your environment variables (Windows 7: Control Panel->System->Advanced system settings->Environment variables): PYTHONPATH=${VTK_BINARY_PATH}\Wrapping\Python:${VTK_BINARY_PATH}\bin\Release:${VTKBXD_BINARY_PATH}\Wrapping\Python:${VTKBXD_BINARY_PATH}\bin\Release:${WRAPITK_BINARY_PATH}\lib:${WRAPITK_BINARY_PATH}\Languages\Python\Release:${ITKVTKGLUE_BINARY_PATH}\lib:${ITKBXD_BINARY_PATH}\lib
PATH=${WRAPITK_BINARY_PATH}\lib\Release:${ITK_BINARY_PATH}\lib\Release:${ITKVTKGLUE_BINARY_PATH}\lib\Release:${ITKBXD_BINARY_PATH}\lib\Release
Where ${...} should be replaced with path to that location.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox