Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

pre commit action #1293

Merged
merged 6 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ root = true
# Apply to any source file
[*.*]

# Indentation of two spaces
# Indentation of two spaces
indent_style = space
indent_size = 2
42 changes: 20 additions & 22 deletions .github/workflows/ElastixGitHubActions.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Elastix

on: [push, pull_request]

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
Expand Down Expand Up @@ -30,7 +30,7 @@ jobs:
ANNLib: "ANNlib-5.2.dll"
vcvars64: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
- os: macos-13
c-compiler: "clang"
c-compiler: "clang"
cxx-compiler: "clang++"
itk-git-tag: "v5.4.1"
cmake-build-type: "Release"
Expand All @@ -39,7 +39,7 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Make directory structure
run: |
items=(*)
Expand All @@ -49,15 +49,15 @@ jobs:
mv .clang-format Elastix-source
mv Elastix-source/Dockerfile .
shell: bash

- uses: actions/cache@v3
id: cache
with:
path: |
ITK-build
ITK-source
key: ${{ matrix.itk-git-tag }}-${{ matrix.os }}-${{ matrix.cmake-build-type }}
key: ${{ matrix.itk-git-tag }}-${{ matrix.os }}-${{ matrix.cmake-build-type }}

- name: Set up Python
uses: actions/setup-python@v3
with:
Expand All @@ -67,25 +67,25 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install ninja

- name: Get specific version of CMake, Ninja
uses: lukka/get-cmake@v3.24.2

- name: Download ITK
if: steps.cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/InsightSoftwareConsortium/ITK.git ITK-source
cd ITK-source
git checkout ${{ matrix.itk-git-tag }}

- name: Build ITK
if: ${{ steps.cache.outputs.cache-hit != 'true' && !startsWith(matrix.os, 'windows') }}
run: |
mkdir ITK-build
cd ITK-build
cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_EXAMPLES=OFF -DBUILD_TESTING:BOOL=OFF -DITK_LEGACY_REMOVE=ON -GNinja ../ITK-source
ninja

- name: Build ITK
if: steps.cache.outputs.cache-hit != 'true' && startsWith(matrix.os, 'windows')
run: |
Expand All @@ -95,7 +95,7 @@ jobs:
cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_EXAMPLES=OFF -DBUILD_TESTING:BOOL=OFF -GNinja ../ITK-source
ninja
shell: cmd

- name: Install requirements of PythonTests
run: |
python -m pip install -r ${{ github.workspace }}/Elastix-source/Testing/PythonTests/requirements.txt
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
if: startsWith(matrix.os, 'macos')
run: |
ctest --output-on-failure -VV -j 2 -E "elastix_run_example_COMPARE_IM|elastix_run_3DCT_lung.MI.bspline.ASGD.001_COMPARE_TP|elastix_run_3DCT_lung.NMI.bspline.ASGD.001_COMPARE_TP" -S dashboard.cmake

- name: Test Windows
if: startsWith(matrix.os, 'windows')
run: |
Expand All @@ -153,15 +153,15 @@ jobs:
if: startsWith(matrix.os, 'ubuntu')
run: |
ctest --output-on-failure -VV -j 2 -E "elastix_run_example_COMPARE_IM|elastix_run_3DCT_lung.MI.bspline.ASGD.001_COMPARE_TP" -S dashboard.cmake

- name: Build externalproject example
if: ${{ !startsWith(matrix.os, 'windows') }}
run: |
mkdir externalproject-build
cd externalproject-build
cmake -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DElastix_DIR=${{ github.workspace }}/Elastix-build -GNinja ../Elastix-source/dox/externalproject
ninja

- name: Build externalproject example
if: startsWith(matrix.os, 'windows')
run: |
Expand All @@ -183,7 +183,7 @@ jobs:
set path=${{ github.workspace }}\Elastix-build\bin
externalproject-build\elastix_translation_example.exe
shell: cmd

- name: Prepare Artifacts Unix
if: ${{ !startsWith(matrix.os, 'windows') }}
shell: bash
Expand All @@ -199,7 +199,7 @@ jobs:
mv Elastix-source/LICENSE uploads
mv bin uploads
mv lib uploads

- name: Prepare Artifacts Windows
if: startsWith(matrix.os, 'windows')
shell: bash
Expand All @@ -210,13 +210,13 @@ jobs:
mv Elastix-build/bin/elastix.exe uploads
mv Elastix-build/bin/transformix.exe uploads
mv Elastix-build/bin/${{ matrix.ANNLib }} uploads

- name: Publish Artifacts
uses: actions/upload-artifact@v4.4.3
with:
with:
name: "${{ matrix.os }}"
path: uploads

- name: Login to Docker Hub
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && startsWith(matrix.os, 'ubuntu')
uses: docker/#-action@v1
Expand All @@ -225,11 +225,9 @@ jobs:
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && startsWith(matrix.os, 'ubuntu')
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && startsWith(matrix.os, 'ubuntu')
run: |
mkdir output
docker build -t superelastix/elastix:${GITHUB_REF#refs/tags/} .
docker run -u $UID:$GROUPS --mount type=bind,source="$(pwd)"/output,target=/out -v "$(pwd)"/Elastix-source/Testing/Data:/elastix/ superelastix/elastix:${GITHUB_REF#refs/tags/} elastix -out /out/ -p /elastix/parameters.3D.NC.euler.ASGD.001.txt -f /elastix/3DCT_lung_baseline.mha -m /elastix/3DCT_lung_followup.mha
docker push superelastix/elastix:${GITHUB_REF#refs/tags/}


19 changes: 19 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: pre-commit

on:
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Check install of Python, pre-commit
run: |
./tools/pre-commit-setup.bash
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: pre-commit/action@v3.0.1
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ repos:
- id: end-of-file-fixer
exclude: "\\.(md5|sha|sha512|svg|vtk|vtp)$|^Resources\\/[^\\/]+\\.h$|\\/ColorFiles\\/.+\\.txt$|Data\\/Input\\/.+$|\\/ThirdParty\\/|\\/Data\\/"
- id: forbid-new-submodules
- id: forbid-submodules
- id: mixed-line-ending
exclude: "\\.(sha|sha512|svg|vtk|vtp)$|\\/ThirdParty\\/|\\/Data\\/"
- id: name-tests-test
Expand All @@ -42,7 +41,7 @@ repos:
- id: trailing-whitespace
exclude: "\\.(sha|sha512|svg|vtk|vtp)$|\\/ThirdParty\\/|\\/Data\\/"
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.4
rev: v19.1.7
hooks:
- id: clang-format
args: ['--style=file']
Expand Down
1 change: 0 additions & 1 deletion CMake/FindEigen3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,3 @@ else(EIGEN3_INCLUDE_DIR)
mark_as_advanced(EIGEN3_INCLUDE_DIR)

endif()

2 changes: 1 addition & 1 deletion CMake/elastixVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set(ELASTIX_VERSION_MAJOR "5")
set(ELASTIX_VERSION_MINOR "2")
set(ELASTIX_VERSION_PATCH "0")

set(ELASTIX_VERSION "${ELASTIX_VERSION_MAJOR}.${ELASTIX_VERSION_MINOR}.${ELASTIX_VERSION_PATCH}")
set(ELASTIX_VERSION "${ELASTIX_VERSION_MAJOR}.${ELASTIX_VERSION_MINOR}.${ELASTIX_VERSION_PATCH}")
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cmake_policy(SET CMP0042 NEW) # "MACOSX_RPATH is enabled by default."
include(CTest)

#---------------------------------------------------------------------
# Allow specifying whether or not the executables are built.
# Allow specifying whether or not the executables are built.
option( ELASTIX_BUILD_EXECUTABLE "Build elastix and transformix as executable? (The libraries are always built as well anyway.)" ON )

# The following may make smaller and quicker loading libraries,
Expand Down
1 change: 0 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,3 @@ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.ht

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

1 change: 0 additions & 1 deletion Common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,3 @@ endif()
target_link_libraries(elxCommon
${ITK_LIBRARIES}
)

2 changes: 1 addition & 1 deletion Common/GTesting/itkImageFullSamplerGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,4 @@ GTEST_TEST(ImageFullSampler, ExactlyEqualVersusSlightlyDifferentMaskImageDomain)
EXPECT_FALSE(samplesOnExactlyEqualImageDomains.empty());

EXPECT_EQ(samplesOnExactlyEqualImageDomains, samplesOnSlightlyDifferentImageDomains);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ void set_interpolation_weights_3d( const float3 cindex, float * weights,
// function pointers to reference the correct spline order. Left as is for
// now for readability use following float per different spline order:
// float w, w2, w4, t, t0, t1, t2;

// create float x[3] from float3, makes it easy to use in loops
float x[3];
x[0] = cindex.x;
Expand Down
1 change: 0 additions & 1 deletion Components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,3 @@ foreach(userComponentDir ${ELASTIX_USER_COMPONENT_DIRS})

endforeach()
endforeach()

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( FixedGenericPyramid
elxFixedGenericPyramid.h
elxFixedGenericPyramid.hxx
elxFixedGenericPyramid.cxx)

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( FixedRecursivePyramid
elxFixedRecursivePyramid.h
elxFixedRecursivePyramid.hxx
elxFixedRecursivePyramid.cxx)

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( FixedShrinkingPyramid # Was OFF by default before elastix 5.0.
elxFixedShrinkingPyramid.h
elxFixedShrinkingPyramid.hxx
elxFixedShrinkingPyramid.cxx)

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( FixedSmoothingPyramid
elxFixedSmoothingPyramid.h
elxFixedSmoothingPyramid.hxx
elxFixedSmoothingPyramid.cxx)

1 change: 0 additions & 1 deletion Components/ImageSamplers/Full/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( FullSampler
elxFullSampler.h
elxFullSampler.hxx
elxFullSampler.cxx)

1 change: 0 additions & 1 deletion Components/ImageSamplers/Grid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( GridSampler
elxGridSampler.h
elxGridSampler.hxx
elxGridSampler.cxx)

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( MultiInputRandomCoordinateSampler
elxMultiInputRandomCoordinateSampler.h
elxMultiInputRandomCoordinateSampler.hxx
elxMultiInputRandomCoordinateSampler.cxx)

1 change: 0 additions & 1 deletion Components/ImageSamplers/Random/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( RandomSampler
elxRandomSampler.h
elxRandomSampler.hxx
elxRandomSampler.cxx)

1 change: 0 additions & 1 deletion Components/ImageSamplers/RandomCoordinate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( RandomCoordinateSampler
elxRandomCoordinateSampler.h
elxRandomCoordinateSampler.hxx
elxRandomCoordinateSampler.cxx)

1 change: 0 additions & 1 deletion Components/ImageSamplers/RandomSparseMask/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( RandomSamplerSparseMask
elxRandomSamplerSparseMask.h
elxRandomSamplerSparseMask.hxx
elxRandomSamplerSparseMask.cxx)

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( BSplineInterpolator
elxBSplineInterpolator.h
elxBSplineInterpolator.hxx
elxBSplineInterpolator.cxx)

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( BSplineInterpolatorFloat # Was OFF by default before elastix 5
elxBSplineInterpolatorFloat.h
elxBSplineInterpolatorFloat.hxx
elxBSplineInterpolatorFloat.cxx)

1 change: 0 additions & 1 deletion Components/Interpolators/LinearInterpolator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( LinearInterpolator
elxLinearInterpolator.h
elxLinearInterpolator.hxx
elxLinearInterpolator.cxx)

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( NearestNeighborInterpolator # Was OFF by default before elasti
elxNearestNeighborInterpolator.h
elxNearestNeighborInterpolator.hxx
elxNearestNeighborInterpolator.cxx)

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( RayCastInterpolator # Was OFF by default before elastix 5.0.1
elxRayCastInterpolator.h
elxRayCastInterpolator.hxx
elxRayCastInterpolator.cxx)

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ ADD_ELXCOMPONENT( ReducedDimensionBSplineInterpolator
elxReducedDimensionBSplineInterpolator.h
elxReducedDimensionBSplineInterpolator.hxx
elxReducedDimensionBSplineInterpolator.cxx)

1 change: 0 additions & 1 deletion Components/Metrics/AdvancedKappaStatistic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ ADD_ELXCOMPONENT( AdvancedKappaStatisticMetric # Was OFF by default before elast
elxAdvancedKappaStatisticMetric.cxx
itkAdvancedKappaStatisticImageToImageMetric.h
itkAdvancedKappaStatisticImageToImageMetric.hxx)

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ ADD_ELXCOMPONENT( AdvancedMattesMutualInformationMetric
elxAdvancedMattesMutualInformationMetric.cxx
itkParzenWindowMutualInformationImageToImageMetric.h
itkParzenWindowMutualInformationImageToImageMetric.hxx)

1 change: 0 additions & 1 deletion Components/Metrics/AdvancedMeanSquares/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ ADD_ELXCOMPONENT( AdvancedMeanSquaresMetric
elxAdvancedMeanSquaresMetric.cxx
itkAdvancedMeanSquaresImageToImageMetric.h
itkAdvancedMeanSquaresImageToImageMetric.hxx)

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ ADD_ELXCOMPONENT( AdvancedNormalizedCorrelationMetric
elxAdvancedNormalizedCorrelationMetric.cxx
itkAdvancedNormalizedCorrelationImageToImageMetric.h
itkAdvancedNormalizedCorrelationImageToImageMetric.hxx)

1 change: 0 additions & 1 deletion Components/Metrics/BendingEnergyPenalty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ ADD_ELXCOMPONENT( TransformBendingEnergyPenalty
itkTransformBendingEnergyPenaltyTerm.h
itkTransformBendingEnergyPenaltyTerm.hxx
)

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ ADD_ELXCOMPONENT( CorrespondingPointsEuclideanDistanceMetric
elxCorrespondingPointsEuclideanDistanceMetric.hxx
itkCorrespondingPointsEuclideanDistancePointMetric.h
itkCorrespondingPointsEuclideanDistancePointMetric.hxx)

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ ADD_ELXCOMPONENT( DisplacementMagnitudePenalty # Was OFF by default before elast
itkDisplacementMagnitudePenaltyTerm.h
itkDisplacementMagnitudePenaltyTerm.hxx
)

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ ADD_ELXCOMPONENT( DistancePreservingRigidityPenalty
elxDistancePreservingRigidityPenaltyTerm.cxx
itkDistancePreservingRigidityPenaltyTerm.h
itkDistancePreservingRigidityPenaltyTerm.hxx)

1 change: 0 additions & 1 deletion Components/Metrics/GradientDifference/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ ADD_ELXCOMPONENT( GradientDifferenceMetric # Was OFF by default before elastix 5
elxGradientDifferenceMetric.cxx
itkGradientDifferenceImageToImageMetric2.h
itkGradientDifferenceImageToImageMetric2.hxx)

Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ if(USE_KNNGraphAlphaMutualInformationMetric)
elastix_export_target(KNNlib)
elastix_export_target(ANNlib)
endif()

Loading
Loading