1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
|
variables:
ITKv5_VERSION: v5.4.5
ITK_GIT_URL: https://github.com/InsightSoftwareConsortium/ITK
LIBTORCH_BINARY_URL_WIN: https://download.pytorch.org/libtorch/cpu/libtorch-win-shared-with-deps-2.6.0%2Bcpu.zip
LIBTORCH_BINARY_URL_LINUX: https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.6.0%2Bcpu.zip
LIBTORCH_BINARY_URL_MAC: https://download.pytorch.org/libtorch/cpu/libtorch-macos-arm64-2.6.0.zip
LIBTORCH_BINARY_DIR: $(Agent.BuildDirectory)/libtorch/libtorch
ITK_SOURCE_DIR: $(Agent.BuildDirectory)/ITK-source
ITK_BINARY_DIR: $(Agent.BuildDirectory)/ITK-build
ELASTIX_SOURCE_DIR: $(Build.Repository.LocalPath)
ELASTIX_BINARY_DIR: $(Agent.BuildDirectory)/Elastix-build
trigger:
paths:
exclude:
- '*.md'
- LICENSE
- .github/workflows/*
- dox/doxygen/*
- tools/*
pr:
paths:
exclude:
- '*.md'
- LICENSE
- .github/workflows/*
- dox/doxygen/*
- tools/*
jobs:
- job: Windows
timeoutInMinutes: 0
pool:
vmImage: 'windows-2022'
strategy:
matrix:
ITKv5:
itk.version: $(ITKv5_VERSION)
steps:
- script: |
mkdir "$(ITK_BINARY_DIR)"
mkdir "$(ELASTIX_BINARY_DIR)"
mkdir externalproject-build
mkdir "$(Agent.BuildDirectory)/libtorch"
displayName: 'Make build directories'
- script: |
curl -L "%LIBTORCH_BINARY_URL_WIN%" -o "$(Agent.BuildDirectory)/libtorch.zip"
displayName: 'Download LibTorch CPU'
- task: ExtractFiles@1
displayName: 'Extract LibTorch'
inputs:
archiveFilePatterns: '$(Agent.BuildDirectory)/libtorch.zip'
destinationFolder: '$(Agent.BuildDirectory)/libtorch'
- script: |
git clone $(ITK_GIT_URL) --branch $(itk.version) --depth 1 "$(ITK_SOURCE_DIR)"
displayName: 'Clone ITK'
- task: CMake@1
displayName: 'CMake Generate ITK'
inputs:
cmakeArgs: -G "Visual Studio 17 2022" -T host=x64 -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DITK_LEGACY_REMOVE=ON "$(ITK_SOURCE_DIR)"
workingDirectory: "$(ITK_BINARY_DIR)"
- task: CMake@1
displayName: 'CMake Build ITK'
inputs:
cmakeArgs: --build . --config Release -j 2
workingDirectory: "$(ITK_BINARY_DIR)"
- task: CMake@1
displayName: 'CMake Generate Elastix'
inputs:
cmakeArgs: -G "Visual Studio 17 2022" -T host=x64 -DITK_DIR="$(ITK_BINARY_DIR)" -DTorch_DIR=$(LIBTORCH_BINARY_DIR)/share/cmake/Torch/ -DBUILD_TESTING=ON -DELASTIX_USE_GTEST=ON -DUSE_ALL_COMPONENTS=ON "$(ELASTIX_SOURCE_DIR)"
workingDirectory: "$(ELASTIX_BINARY_DIR)"
- task: CMake@1
displayName: 'CMake Build Elastix'
inputs:
cmakeArgs: --build . --config Release -j 2
workingDirectory: "$(ELASTIX_BINARY_DIR)"
- task: CMake@1
displayName: 'CMake Generate externalproject'
inputs:
cmakeArgs: -G "Visual Studio 17 2022" -T host=x64 -DElastix_DIR=$(ELASTIX_BINARY_DIR) "$(ELASTIX_SOURCE_DIR)/dox/externalproject"
workingDirectory: $(Agent.BuildDirectory)/externalproject-build
- task: CMake@1
displayName: 'CMake Build externalproject'
inputs:
cmakeArgs: --build . --config Release
workingDirectory: $(Agent.BuildDirectory)/externalproject-build
- bash: |
export PATH="$(ELASTIX_BINARY_DIR)/bin/Release:$(LIBTORCH_BINARY_DIR)/lib:$PATH"
./Release/elastix_impact_metric_example.exe
displayName: 'Run externalproject'
workingDirectory: $(Agent.BuildDirectory)/externalproject-build
- bash: python -m pip install -r "$(ELASTIX_SOURCE_DIR)/Testing/PythonTests/requirements.txt"
displayName: 'Install PythonTests requirements'
- bash: |
export PATH="$(ELASTIX_BINARY_DIR)/bin/Release:$(LIBTORCH_BINARY_DIR)/lib:$PATH"
ctest -C Release -VV -j 2 -E "elastix_run_example_COMPARE_IM|elastix_run_3DCT_lung.MI.bspline.ASGD.001_COMPARE_TP"
displayName: 'CTest Elastix'
workingDirectory: $(ELASTIX_BINARY_DIR)
- job: Ubuntu
timeoutInMinutes: 0
pool:
vmImage: 'ubuntu-22.04'
strategy:
matrix:
ITKv5:
itk.version: $(ITKv5_VERSION)
steps:
- script: |
mkdir $(ITK_BINARY_DIR)
mkdir $(ELASTIX_BINARY_DIR)
mkdir externalproject-build
mkdir "$(Agent.BuildDirectory)/libtorch"
displayName: 'Make build directories'
- script: |
curl -L $(LIBTORCH_BINARY_URL_LINUX) -o $(Agent.BuildDirectory)/libtorch.zip
displayName: 'Download LibTorch CPU'
- task: ExtractFiles@1
displayName: 'Extract LibTorch'
inputs:
archiveFilePatterns: '$(Agent.BuildDirectory)/libtorch.zip'
destinationFolder: '$(Agent.BuildDirectory)/libtorch'
- script: |
git clone $(ITK_GIT_URL) --branch $(itk.version) --depth 1 "$(ITK_SOURCE_DIR)"
displayName: 'Clone ITK'
- task: CMake@1
displayName: 'CMake Generate ITK'
inputs:
cmakeArgs: -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DITK_LEGACY_REMOVE=ON $(ITK_SOURCE_DIR)
workingDirectory: $(ITK_BINARY_DIR)
- task: CMake@1
displayName: 'CMake Build ITK'
inputs:
cmakeArgs: --build . --config Release -j 2
workingDirectory: $(ITK_BINARY_DIR)
- task: CMake@1
displayName: 'CMake Generate Elastix'
inputs:
cmakeArgs: -DITK_DIR=$(ITK_BINARY_DIR) -DTorch_DIR=$(LIBTORCH_BINARY_DIR)/share/cmake/Torch/ -DBUILD_TESTING=ON -DELASTIX_USE_GTEST=ON -DUSE_ALL_COMPONENTS=ON $(ELASTIX_SOURCE_DIR)
workingDirectory: $(ELASTIX_BINARY_DIR)
- task: CMake@1
displayName: 'CMake Build Elastix'
inputs:
cmakeArgs: --build . --config Release -j 2
workingDirectory: $(ELASTIX_BINARY_DIR)
- task: CMake@1
displayName: 'CMake Generate externalproject'
inputs:
cmakeArgs: -DElastix_DIR=$(Agent.BuildDirectory)/Elastix-build $(ELASTIX_SOURCE_DIR)/dox/externalproject
workingDirectory: $(Agent.BuildDirectory)/externalproject-build
- task: CMake@1
displayName: 'CMake Build externalproject'
inputs:
cmakeArgs: --build .
workingDirectory: $(Agent.BuildDirectory)/externalproject-build
- bash: ./elastix_impact_metric_example
workingDirectory: $(Agent.BuildDirectory)/externalproject-build
displayName: 'Run externalproject'
- bash: python -m pip install -r "$(ELASTIX_SOURCE_DIR)/Testing/PythonTests/requirements.txt"
displayName: 'Install PythonTests requirements'
- bash: ctest -C Release -VV -j 2 -E "elastix_run_example_COMPARE_IM|elastix_run_3DCT_lung.MI.bspline.ASGD.001_COMPARE_TP"
displayName: 'CTest Elastix'
workingDirectory: $(ELASTIX_BINARY_DIR)
- job: macOS
timeoutInMinutes: 0
pool:
vmImage: 'macos-14'
strategy:
matrix:
ITKv5:
itk.version: $(ITKv5_VERSION)
steps:
- script: |
mkdir $(ITK_BINARY_DIR)
mkdir $(ELASTIX_BINARY_DIR)
mkdir externalproject-build
mkdir "$(Agent.BuildDirectory)/libtorch-build"
displayName: 'Make build directories'
- script: |
git clone --recursive https://github.com/pytorch/pytorch.git $(Agent.BuildDirectory)/pytorch
displayName: 'Clone LibTorch'
- script: |
python3 -m venv $(Agent.BuildDirectory)/venv
source $(Agent.BuildDirectory)/venv/bin/activate
$(Agent.BuildDirectory)/venv/bin/python -m pip install -r $(Agent.BuildDirectory)/pytorch/requirements.txt
cmake $(Agent.BuildDirectory)/pytorch -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(Agent.BuildDirectory)/libtorch -DPython_EXECUTABLE=-DPython_EXECUTABLE=$(Agent.BuildDirectory)/venv/bin/python -DBUILD_PYTHON=OFF -DBUILD_TEST=OFF -DUSE_CUDA=OFF -DUSE_MPS=OFF -DUSE_MKLDNN=OFF -DUSE_QNNPACK=OFF -DUSE_XNNPACK=OFF -DUSE_FBGEMM=OFF
workingDirectory: $(Agent.BuildDirectory)/libtorch-build
displayName: 'CMake Generate LibTorch'
- script: |
source $(Agent.BuildDirectory)/venv/bin/activate
ninja install
workingDirectory: $(Agent.BuildDirectory)/libtorch-build
displayName: 'CMake Build LibTorch'
- script: |
git clone $(ITK_GIT_URL) --branch $(itk.version) --depth 1 "$(ITK_SOURCE_DIR)"
displayName: 'Clone ITK'
- task: CMake@1
displayName: 'CMake Generate ITK'
inputs:
cmakeArgs: -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DITK_LEGACY_REMOVE=ON $(ITK_SOURCE_DIR)
workingDirectory: $(ITK_BINARY_DIR)
- task: CMake@1
displayName: 'CMake Build ITK'
inputs:
cmakeArgs: --build . --config Release -j 2
workingDirectory: $(ITK_BINARY_DIR)
- task: CMake@1
displayName: 'CMake Generate Elastix'
inputs:
cmakeArgs: -DITK_DIR=$(ITK_BINARY_DIR) -DTorch_DIR=$(Agent.BuildDirectory)/libtorch/share/cmake/Torch/ -DBUILD_TESTING=ON -DELASTIX_USE_GTEST=ON -DUSE_ALL_COMPONENTS=ON $(Build.Repository.LocalPath)
workingDirectory: $(ELASTIX_BINARY_DIR)
- task: CMake@1
displayName: 'CMake Build Elastix'
inputs:
cmakeArgs: --build . --config Release -j 2
workingDirectory: $(ELASTIX_BINARY_DIR)
- task: CMake@1
displayName: 'CMake Generate externalproject'
inputs:
cmakeArgs: -DElastix_DIR=$(Agent.BuildDirectory)/Elastix-build $(ELASTIX_SOURCE_DIR)/dox/externalproject
workingDirectory: $(Agent.BuildDirectory)/externalproject-build
- task: CMake@1
displayName: 'CMake Build externalproject'
inputs:
cmakeArgs: --build .
workingDirectory: $(Agent.BuildDirectory)/externalproject-build
- bash: ./elastix_impact_metric_example
workingDirectory: $(Agent.BuildDirectory)/externalproject-build
displayName: 'Run externalproject'
# Note: On macOS, we have not yet found how to successfully install requirements.txt for Python, so for the time being, we skip the tests.
# See also https://github.com/SuperElastix/elastix/issues/739
|