Skip to content

Commit

Permalink
ENH: Refactor to depend on ITKMeshToPolyData
Browse files Browse the repository at this point in the history
Previously `ITKBSplineGradient` and `ITKMeshToPolyData` both contained
identical definitions of `itk::ImageToPointSetFilter`, leading to
duplicate definition warnings in Python wrapping at load time. This
commit removes `itk::ImageToPointSetFilter` from `ITKBSplineGradient`
and replaces it with an explicit dependency on `ITKMeshToPolyData` to
mitigate conflicts.

Addresses InsightSoftwareConsortium/ITKMeshToPolyData#48
  • Loading branch information
tbirdso committed Jun 22, 2022
1 parent a642df0 commit bd26924
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 257 deletions.
39 changes: 36 additions & 3 deletions .github/workflows/build-test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
cd ..
mkdir ITK-build
cd ITK-build
cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_TESTING:BOOL=OFF -GNinja ../ITK
cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_TESTING:BOOL=OFF -DModule_MeshToPolyData:BOOL=ON -GNinja ../ITK
ninja
- name: Build ITK
Expand All @@ -66,7 +66,7 @@ jobs:
mkdir ITK-build
cd ITK-build
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_TESTING:BOOL=OFF -GNinja ../ITK
cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_TESTING:BOOL=OFF -DModule_MeshToPolyData:BOOL=ON -GNinja ../ITK
ninja
shell: cmd

Expand Down Expand Up @@ -157,6 +157,18 @@ jobs:
- name: 'Build 🐍 Python 📦 package'
run: |
export ITK_PACKAGE_VERSION=${{ env.itk-wheel-tag }}
pwd
git clone https://github.com/InsightSoftwareConsortium/ITKMeshToPolyData.git
echo "Building ITKMeshToPolyData dependency"
cp ./dockcross-manylinux-download-cache-and-build-module-wheels.sh ./ITKMeshToPolyData
pushd ITKMeshToPolyData
git checkout ${{env.ITKMeshToPolyData-git-tag}}
./dockcross-manylinux-download-cache-and-build-module-wheels.sh cp${{ matrix.python-version }}
popd
cp ITKMeshToPolyData/include/* include/
rm ./ITKMeshToPolyData/ITKPythonBuilds-linux.tar.zst
mv ./ITKMeshToPolyData/ITKPythonPackage .
echo "Building ITKBSplineGradient"
./dockcross-manylinux-download-cache-and-build-module-wheels.sh cp${{ matrix.python-version }}
- name: Publish Python package as GitHub Artifact
Expand Down Expand Up @@ -189,6 +201,17 @@ jobs:
run: |
export ITK_PACKAGE_VERSION=${{ env.itk-wheel-tag }}
export MACOSX_DEPLOYMENT_TARGET=10.9
pwd
git clone https://github.com/InsightSoftwareConsortium/ITKMeshToPolyData
echo "Building ITKMeshToPolyData dependency"
cp ./macpython-download-cache-and-build-module-wheels.sh ITKMeshToPolyData/
pushd ITKMeshToPolyData
git checkout ${{env.ITKMeshToPolyData-git-tag}}
./macpython-download-cache-and-build-module-wheels.sh
popd
cp ITKMeshToPolyData/include/* include/
rm ./ITKMeshToPolyData/ITKPythonBuilds-macosx.tar.zst
echo "Building ITKBSplineGradient"
./macpython-download-cache-and-build-module-wheels.sh
- name: Publish Python package as GitHub Artifact
Expand Down Expand Up @@ -222,13 +245,15 @@ jobs:
shell: bash
run: |
mv im ../../
cd ../../
cd ../../im
curl -L "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${{ env.itk-wheel-tag }}/ITKPythonBuilds-windows.zip" -o "ITKPythonBuilds-windows.zip"
7z x ITKPythonBuilds-windows.zip -o/c/P -aoa -r
curl -L "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -o "doxygen-1.8.11.windows.bin.zip"
7z x doxygen-1.8.11.windows.bin.zip -o/c/P/doxygen -aoa -r
curl -L "https://data.kitware.com/api/v1/file/5bbf87ba8d777f06b91f27d6/download/grep-win.zip" -o "grep-win.zip"
7z x grep-win.zip -o/c/P/grep -aoa -r
pwd
git clone https://github.com/InsightSoftwareConsortium/ITKMeshToPolyData.git
- name: 'Build 🐍 Python 📦 package'
shell: cmd
Expand All @@ -238,6 +263,14 @@ jobs:
set PATH=C:\P\grep;%PATH%
set CC=cl.exe
set CXX=cl.exe
pwd
echo "Building ITKMeshToPolyData dependency"
cd ITKMeshToPolyData
"C:\Program Files\Git\bin\git.exe" checkout ${{env.ITKMeshToPolyData-git-tag}}
C:\Python3${{ matrix.python-version-minor }}-x64\python.exe C:\P\IPP\scripts\windows_build_module_wheels.py --py-envs "3${{ matrix.python-version-minor }}-x64" --no-cleanup
cd ..
copy ITKMeshToPolyData/include/* include/
echo "Building ITKBSplineGradient"
C:\Python3${{ matrix.python-version-minor }}-x64\python.exe C:\P\IPP\scripts\windows_build_module_wheels.py --py-envs "3${{ matrix.python-version-minor }}-x64" --no-cleanup
- name: Publish Python package as GitHub Artifact
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10.2)
cmake_minimum_required(VERSION 3.16.3)
project(BSplineGradient)

if(NOT ITK_SOURCE_DIR)
Expand Down
95 changes: 0 additions & 95 deletions include/itkImageToPointSetFilter.h

This file was deleted.

75 changes: 0 additions & 75 deletions include/itkImageToPointSetFilter.hxx

This file was deleted.

1 change: 1 addition & 0 deletions itk-module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ itk_module(BSplineGradient
ITKMesh
COMPILE_DEPENDS
ITKImageGrid
MeshToPolyData
TEST_DEPENDS
ITKTestKernel
ITKMetaIO
Expand Down
8 changes: 0 additions & 8 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
itk_module_test()

set(BSplineGradientTests
itkImageToPointSetFilterTest.cxx
itkImageToImageOfVectorsFilterTest.cxx
itkBSplineScatteredDataPointSetToGradientImageFilterTest.cxx
itkBSplineApproximationGradientImageFilterTest.cxx
Expand All @@ -10,13 +9,6 @@ set(BSplineGradientTests

CreateTestDriver(BSplineGradient "${BSplineGradient-Test_LIBRARIES}" "${BSplineGradientTests}")

itk_add_test(NAME itkImageToPointSetFilterTest
COMMAND BSplineGradientTestDriver
itkImageToPointSetFilterTest
DATA{Input/foot.mha}
${ITK_TEST_OUTPUT_DIR}/itkImageToPointSetFilterTestOutput.vtk
)

itk_add_test(NAME itkImageToImageOfVectorsFilterTest
COMMAND BSplineGradientTestDriver
itkImageToImageOfVectorsFilterTest
Expand Down
65 changes: 0 additions & 65 deletions test/itkImageToPointSetFilterTest.cxx

This file was deleted.

10 changes: 0 additions & 10 deletions wrapping/itkImageToPointSetFilter.wrap

This file was deleted.

0 comments on commit bd26924

Please sign in to comment.