[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Change InsightToolkit to use Review/Statistics?



On Fri, 2010-12-24 at 16:53 -0600, Steve M. Robbins wrote:
> Paul: I looked at your Ubuntu packages and modified the wrapping
> options based on what I saw.  Let me know if I have missed an
> important option.

Looks good. Although a couple of the wrapping options were misspelled,
also I don't think wrapping 4D data is necessary. I think it is pretty
rare to need it and not having 4D significantly reduces the package
sizes. These changes are in the attached patch file
(0002-Fixed-some-things-in-the-rules-file.patch).

> > Also, I created a couple of separate packages:
> > python-insighttoolkit-numpy, python-insighttoolkit-vtk, and
> > python-insighttoolkit-multithreader. These correspond to the projects in
> > Wrapping/WrapITK/ExternalProjects. Very handy python modules that
> > connect itk to vtk and itk to numpy. It would be nice to incorporate
> > these projects too.
> 
> Mmm.  I overlooked these.  Do you want to propose patches? :-)

The "0001-Added-PyBuffer-and-ItkVtkGlue-to-build.patch" file does this.
I didn't add the multithreader one, maybe I will add it later.

The final patch file, adds a couple of registration optimizers I need
wrapped. 

I hope these patch files are in a decent format, I use git-svn, and this
is what git spit out when I asked for patch files. Let me know if I
should use a different format.

I think I might try adding the doxygen generated documentation next.
IPython has a nice interface that will display these docs in the shell
when you type something like "itk.Image?". I find it handy.

Anyway, hope these help.
-Paul
>From 9ac6d3461862f041ee663b086f7f239090909cbb Mon Sep 17 00:00:00 2001
From: Paul Novotny <paul.novotny@gmail.com>
Date: Tue, 18 Jan 2011 14:32:22 -0500
Subject: [PATCH 1/3] Added PyBuffer and ItkVtkGlue to build

* This will add the two External Projects to the WrapITK build. PyBuffer
  provides easy interoperability with numpy. ItkVtkGlue makes it easy to
  convert from and to VTK.
---
 debian/control                                |    2 +-
 debian/patches/series                         |    1 +
 debian/patches/wrapitk-externalprojects.patch |  125 +++++++++++++++++++++++++
 debian/rules                                  |    1 +
 4 files changed, 128 insertions(+), 1 deletions(-)
 create mode 100644 debian/patches/wrapitk-externalprojects.patch

diff --git a/debian/control b/debian/control
index fa098a6..3a18933 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Uploaders: Steve M. Robbins <smr@debian.org>
 Build-Depends: cdbs (>= 0.4.49), debhelper (>= 7), 
  cmake, cableswig (>= 0.1.0+cvs20100501), gccxml (>= 0.9.0+cvs20100501-2),
  zlib1g-dev (>= 1.2.2), libpng12-dev, libtiff4-dev (>= 3.7.3),
- python-support (>= 0.6.4), python-dev, libfftw3-dev,
+ python-support (>= 0.6.4), python-dev, python-numpy, libfftw3-dev,
  tcl8.5-dev, tk8.5-dev, uuid-dev, libgdcm2-dev, libjpeg62-dev,
  libfreetype6-dev, libopenjpeg-dev, graphviz,
  libxext-dev, libxss-dev, libxft-dev, libpoppler-dev, libssl-dev,
diff --git a/debian/patches/series b/debian/patches/series
index a19dd25..b75b679 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ tcl-install.patch
 jni-dir.patch
 remove-cmake-export-build-settings.patch
 wrapitk.patch
+wrapitk-externalprojects.patch
diff --git a/debian/patches/wrapitk-externalprojects.patch b/debian/patches/wrapitk-externalprojects.patch
new file mode 100644
index 0000000..28c37f0
--- /dev/null
+++ b/debian/patches/wrapitk-externalprojects.patch
@@ -0,0 +1,125 @@
+Index: insighttoolkit-3.20.0/Wrapping/WrapITK/CMakeLists.txt
+===================================================================
+--- insighttoolkit-3.20.0.orig/Wrapping/WrapITK/CMakeLists.txt	2011-01-09 14:12:59.000000000 -0500
++++ insighttoolkit-3.20.0/Wrapping/WrapITK/CMakeLists.txt	2011-01-11 10:19:08.000000000 -0500
+@@ -176,6 +176,17 @@
+   SUBDIRS(Modules/${module})
+ ENDFOREACH(module)
+ 
++OPTION(BUILD_ITKVTKGLUE "Build WrapITK with ItkVtkGlue" ON)
++IF(BUILD_ITKVTKGLUE)
++  SUBDIRS(ExternalProjects/ItkVtkGlue)
++ENDIF(BUILD_ITKVTKGLUE)
++
++OPTION(BUILD_PYBUFFER "Build WrapITK with Numpy support" ON)
++IF(BUILD_PYBUFFER)
++  SUBDIRS(ExternalProjects/PyBuffer)
++ENDIF(BUILD_PYBUFFER)
++
++
+ ###############################################################################
+ # Configure language-specific features
+ ###############################################################################
+Index: insighttoolkit-3.20.0/Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/CMakeLists.txt
+===================================================================
+--- insighttoolkit-3.20.0.orig/Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/CMakeLists.txt	2011-01-11 10:12:29.000000000 -0500
++++ insighttoolkit-3.20.0/Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/CMakeLists.txt	2011-01-17 18:14:17.000000000 -0500
+@@ -1,29 +1,3 @@
+-CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
+-IF(COMMAND CMAKE_POLICY)
+-  CMAKE_POLICY(SET CMP0003 NEW)
+-ENDIF(COMMAND CMAKE_POLICY)
+-
+-PROJECT(ItkVtkGlue)
+-
+-OPTION(BUILD_WRAPPERS "Wrap library" OFF)
+-OPTION(INSTALL_DEVEL_FILES "Install C++ headers" ON)
+-
+-FIND_PACKAGE(ITK REQUIRED)
+-FIND_PACKAGE(VTK REQUIRED)
+-
+-INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIRS} ${ITK_INCLUDE_DIRS} ${ItkVtkGlue_SOURCE_DIR}/src)
+-LINK_DIRECTORIES(${VTK_LIBRARY_DIRS} ${ITK_LIBRARY_DIRS})
+-
+-IF(BUILD_WRAPPERS)
+-   SUBDIRS(Wrapping)
+-ENDIF(BUILD_WRAPPERS)
+-
+-# install devel files
+-IF(INSTALL_DEVEL_FILES)
+-  FOREACH(f itkImageToVTKImageFilter.h itkImageToVTKImageFilter.txx itkVTKImageToImageFilter.h itkVTKImageToImageFilter.txx)
+-    INSTALL_FILES(/include/InsightToolkit/BasicFilters FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/${f})
+-  ENDFOREACH(f)
+-ENDIF(INSTALL_DEVEL_FILES)
+-
+-ENABLE_TESTING()
++INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
++SUBDIRS(Wrapping)
+ 
+Index: insighttoolkit-3.20.0/Wrapping/WrapITK/ExternalProjects/PyBuffer/CMakeLists.txt
+===================================================================
+--- insighttoolkit-3.20.0.orig/Wrapping/WrapITK/ExternalProjects/PyBuffer/CMakeLists.txt	2011-01-11 10:52:39.000000000 -0500
++++ insighttoolkit-3.20.0/Wrapping/WrapITK/ExternalProjects/PyBuffer/CMakeLists.txt	2011-01-17 11:17:30.000000000 -0500
+@@ -1,11 +1,5 @@
+-PROJECT(PyBuffer)
+-FIND_PACKAGE(WrapITK REQUIRED)
+-
+ # Deal with numarray package  Options
+-SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}")
+-FIND_PACKAGE( NUMARRAY )
+-
+-INCLUDE_DIRECTORIES( ${PYTHON_NUMARRAY_INCLUDE_DIR} )
++INCLUDE_DIRECTORIES( ${PYTHON_NUMPY_INCLUDE_PATH} )
+ 
+ BEGIN_WRAPPER_LIBRARY("BufferConversion" Python)
+ 
+Index: insighttoolkit-3.20.0/Wrapping/WrapITK/ExternalProjects/PyBuffer/itkPyBuffer.txx
+===================================================================
+--- insighttoolkit-3.20.0.orig/Wrapping/WrapITK/ExternalProjects/PyBuffer/itkPyBuffer.txx	2011-01-11 14:49:57.000000000 -0500
++++ insighttoolkit-3.20.0/Wrapping/WrapITK/ExternalProjects/PyBuffer/itkPyBuffer.txx	2011-01-11 14:50:43.000000000 -0500
+@@ -49,7 +49,7 @@
+  
+   char * data = (char *)( buffer );
+   
+-  int dimensions[ ImageDimension ];
++  npy_intp dimensions[ ImageDimension ];
+   
+   SizeType size = image->GetBufferedRegion().GetSize();
+   
+Index: insighttoolkit-3.20.0/Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/Wrapping/CMakeLists.txt
+===================================================================
+--- insighttoolkit-3.20.0.orig/Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/Wrapping/CMakeLists.txt	2011-01-11 15:14:29.000000000 -0500
++++ insighttoolkit-3.20.0/Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/Wrapping/CMakeLists.txt	2011-01-17 11:23:37.000000000 -0500
+@@ -1,23 +1,19 @@
+-FIND_PACKAGE(WrapITK REQUIRED)
+ 
+-BEGIN_WRAPPER_LIBRARY(${PROJECT_NAME})
++BEGIN_WRAPPER_LIBRARY(ItkVtkGlue)
+ SET(WRAPPER_SWIG_LIBRARY_FILES ${WRAPPER_SWIG_LIBRARY_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/itkvtk.swg")
+ SET(WRAPPER_LIBRARY_DEPENDS Base SimpleFilters)
+ 
+-WRAPPER_LIBRARY_CREATE_WRAP_FILES()
+-WRAPPER_LIBRARY_CREATE_LIBRARY()
+-
+ IF(WRAP_ITK_PYTHON)
+   # I can't manage to put that code in Python subdir :-(
+   SET(VTK_VERSION "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")
+-  SET(MIN_ITK_VER "5.0.0")
+-  IF("${VTK_VERSION}" STRLESS "${MIN_ITK_VER}")
+-    TARGET_LINK_LIBRARIES(_${WRAPPER_LIBRARY_NAME}Python vtkImagingPython ITKCommon ITKBasicFilters)
+-  ELSE("${VTK_VERSION}" STRLESS "${MIN_ITK_VER}")
+-    TARGET_LINK_LIBRARIES(_${WRAPPER_LIBRARY_NAME}Python vtkImagingPythonD ITKCommon ITKBasicFilters)
+-  ENDIF("${VTK_VERSION}" STRLESS "${MIN_ITK_VER}")
+-
+-  SUBDIRS(Python)
++  SET(MIN_VTK_VER "5.0.0")
++  IF("${VTK_VERSION}" STRLESS "${MIN_VTK_VER}")
++    SET(WRAPPER_LIBRARY_LINK_LIBRARIES vtkImagingPython ITKCommon ITKBasicFilters)
++  ELSE("${VTK_VERSION}" STRLESS "${MIN_VTK_VER}")
++    SET(WRAPPER_LIBRARY_LINK_LIBRARIES vtkImagingPythonD ITKCommon ITKBasicFilters)
++  ENDIF("${VTK_VERSION}" STRLESS "${MIN_VTK_VER}")
+ ENDIF(WRAP_ITK_PYTHON)
+ 
++WRAPPER_LIBRARY_CREATE_WRAP_FILES()
++WRAPPER_LIBRARY_CREATE_LIBRARY()
+ 
diff --git a/debian/rules b/debian/rules
index 8b0243a..f86a839 100755
--- a/debian/rules
+++ b/debian/rules
@@ -69,6 +69,7 @@ DEB_CMAKE_EXTRA_FLAGS = \
 	-DITK_USE_STRICT_CONCEPT_CHECKING:BOOL=ON \
 	-DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/$(PYVERS) \
 	-DPYTHON_INCLUDE_PATH:PATH=/usr/include/$(PYVERS) \
+	-DPYTHON_NUMPY_INCLUDE_PATH:PATH=/usr/include/$(PYVERS)/numpy \
 	-DPYTHON_LIBRARY:FILEPATH=/usr/lib/lib$(PYVERS).so \
 	-DTCL_INCLUDE_PATH:PATH=/usr/include/tcl$(TCLVERS) \
 	-DTCL_LIBRARY:FILEPATH=/usr/lib/libtcl$(TCLVERS).so \
-- 
1.7.2.3

>From 303d21dba96ca878ef4121282c64c152c6050807 Mon Sep 17 00:00:00 2001
From: Paul Novotny <paul.novotny@gmail.com>
Date: Thu, 20 Jan 2011 13:48:28 -0500
Subject: [PATCH 2/3] Fixed some things in the rules file

* get-orig-source was still deleting the Code/Review directory. This
  directory is needed for WrapITK now.
* Some of the Wrap settings were misspelled.
* Turned off wrapping of 4D images. I don't think this is needed by most
  people. This reduces the package size significantly
---
 debian/rules |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/debian/rules b/debian/rules
index f86a839..5945110 100755
--- a/debian/rules
+++ b/debian/rules
@@ -80,16 +80,16 @@ DEB_CMAKE_EXTRA_FLAGS = \
 	-DWRAP_ITK_JAVA:BOOL=ON \
 	-DWRAP_ITK_PYTHON:BOOL=ON \
 	-DWRAP_ITK_TCL:BOOL=ON \
-	-DWRAP_ITK_DIMS:STRING='2;3;4' \
-	-DWRAPcomplex_float:BOOL=ON \
-	-DWRAPcovariant_vector_float:BOOL=ON \
-	-DWRAPfloat:BOOL=ON \
-	-DWRAPrgb_unsigned_char:BOOL=ON \
-	-DWRAPrgb_unsigned_short:BOOL=ON \
-	-DWRAPsigned_short:BOOL=ON \
-	-DWRAPunsigned_char:BOOL=ON \
-	-DWRAPunsigned_short:BOOL=ON \
-	-DWRAPvector_float:BOOL=ON
+	-DWRAP_ITK_DIMS:STRING='2;3' \
+	-DWRAP_complex_float:BOOL=ON \
+	-DWRAP_covariant_vector_float:BOOL=ON \
+	-DWRAP_float:BOOL=ON \
+	-DWRAP_rgb_unsigned_char:BOOL=ON \
+	-DWRAP_rgb_unsigned_short:BOOL=ON \
+	-DWRAP_signed_short:BOOL=ON \
+	-DWRAP_unsigned_char:BOOL=ON \
+	-DWRAP_unsigned_short:BOOL=ON \
+	-DWRAP_vector_float:BOOL=ON
 
 pre-build::
 	test -d Code/Review || mv review Code/Review
@@ -150,7 +150,7 @@ $(UPSTREAM_SRC).tar.gz:
 get-orig-source: $(UPSTREAM_SRC).tar.gz
 	tar xzf $(UPSTREAM_SRC).tar.gz
 	find $(UPSTREAM_SRC) -name CVS -o -name Patented | xargs rm -rf
-	rm -rf $(UPSTREAM_SRC)/Code/Review
+	#rm -rf $(UPSTREAM_SRC)/Code/Review
 	mv $(UPSTREAM_SRC) $(DEBIAN_SRC_DIR)
 	GZIP=-9 tar czf $(DEBIAN_SRC_TAR) $(DEBIAN_SRC_DIR)
 
-- 
1.7.2.3

>From 3f213a7daef265ddb789b3e8636d03c8d6bbb772 Mon Sep 17 00:00:00 2001
From: Paul Novotny <paul.novotny@gmail.com>
Date: Fri, 21 Jan 2011 16:26:49 -0500
Subject: [PATCH 3/3] Added a few Registration Optimizers for Wrapping

* Added a couple new registration optimizers, including LBFGSBOptimizer
  used for B-spline 3D registratoin.
* Also needed to add a few array types to use the optimizers correctly
---
 debian/patches/add-registration-optimizers.patch |   28 ++++++++++++++++++++++
 debian/patches/series                            |    1 +
 2 files changed, 29 insertions(+), 0 deletions(-)
 create mode 100644 debian/patches/add-registration-optimizers.patch

diff --git a/debian/patches/add-registration-optimizers.patch b/debian/patches/add-registration-optimizers.patch
new file mode 100644
index 0000000..15a9173
--- /dev/null
+++ b/debian/patches/add-registration-optimizers.patch
@@ -0,0 +1,28 @@
+Index: insighttoolkit-3.20.0/Wrapping/WrapITK/WrapITKTypes.cmake
+===================================================================
+--- insighttoolkit-3.20.0.orig/Wrapping/WrapITK/WrapITKTypes.cmake	2011-01-21 12:36:35.000000000 -0500
++++ insighttoolkit-3.20.0/Wrapping/WrapITK/WrapITKTypes.cmake	2011-01-21 12:38:05.000000000 -0500
+@@ -80,6 +80,8 @@
+ WRAP_TYPE("itk::Array" "A")
+   WRAP_TEMPLATE("${ITKM_D}" "${ITKT_D}")
+   WRAP_TEMPLATE("${ITKM_F}" "${ITKT_F}")
++  WRAP_TEMPLATE("${ITKM_UL}" "${ITKT_UL}")
++  WRAP_TEMPLATE("${ITKM_SL}" "${ITKT_SL}")
+ END_WRAP_TYPE()
+ SET(itk_Wrap_Array ${WRAPPER_TEMPLATES})
+ 
+Index: insighttoolkit-3.20.0/Wrapping/WrapITK/Modules/BaseNumerics/wrap_ITKOptimizers.cmake
+===================================================================
+--- insighttoolkit-3.20.0.orig/Wrapping/WrapITK/Modules/BaseNumerics/wrap_ITKOptimizers.cmake	2011-01-21 12:38:49.000000000 -0500
++++ insighttoolkit-3.20.0/Wrapping/WrapITK/Modules/BaseNumerics/wrap_ITKOptimizers.cmake	2011-01-21 12:39:15.000000000 -0500
+@@ -14,3 +14,10 @@
+ WRAP_NON_TEMPLATE_CLASS("itk::RegularStepGradientDescentOptimizer" POINTER)
+ WRAP_NON_TEMPLATE_CLASS("itk::VersorTransformOptimizer" POINTER)
+ WRAP_NON_TEMPLATE_CLASS("itk::AmoebaOptimizer" POINTER)
++WRAP_NON_TEMPLATE_CLASS("itk::CumulativeGaussianOptimizer" POINTER)
++WRAP_NON_TEMPLATE_CLASS("itk::ExhaustiveOptimizer" POINTER)
++WRAP_NON_TEMPLATE_CLASS("itk::FRPROptimizer" POINTER)
++WRAP_NON_TEMPLATE_CLASS("itk::LBFGSBOptimizer" POINTER)
++WRAP_NON_TEMPLATE_CLASS("itk::PowellOptimizer" POINTER)
++WRAP_NON_TEMPLATE_CLASS("itk::SPSAOptimizer" POINTER)
++WRAP_NON_TEMPLATE_CLASS("itk::VersorRigid3DTransformOptimizer" POINTER)
diff --git a/debian/patches/series b/debian/patches/series
index b75b679..eca545d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@ jni-dir.patch
 remove-cmake-export-build-settings.patch
 wrapitk.patch
 wrapitk-externalprojects.patch
+add-registration-optimizers.patch
-- 
1.7.2.3


Reply to: