├── .github └── workflows │ ├── build-test-package.yml │ └── clang-format-linter.yml ├── .gitignore ├── LICENSE ├── README.md ├── cookiecutter.json └── {{cookiecutter.project_name}} ├── .clang-format ├── .editorconfig ├── .github └── workflows │ ├── build-test-package.yml │ └── clang-format-linter.yml ├── CMakeLists.txt ├── CTestConfig.cmake ├── LICENSE ├── README.md ├── examples ├── CMakeLists.txt ├── {{ cookiecutter.example_name }}.cxx └── {{ cookiecutter.example_name }}.py ├── include ├── itkMinimalStandardRandomVariateGenerator.h ├── itk{{cookiecutter.filter_name}}.h └── itk{{cookiecutter.filter_name}}.hxx ├── itk-module.cmake ├── pyproject.toml ├── src ├── CMakeLists.txt └── itkMinimalStandardRandomVariateGenerator.cxx ├── test ├── Baseline │ └── itk{{cookiecutter.filter_name}}TestOutput.mha.sha512 ├── CMakeLists.txt ├── itkMinimalStandardRandomVariateGeneratorTest.cxx └── itk{{cookiecutter.filter_name}}Test.cxx └── wrapping ├── CMakeLists.txt ├── itkMinimalStandardRandomVariateGenerator.wrap └── itk{{cookiecutter.filter_name}}.wrap /.github/workflows/build-test-package.yml: -------------------------------------------------------------------------------- 1 | name: Build, test, package 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - main 10 | 11 | env: 12 | # v6.0a02 13 | itk-git-tag: "v6.0a02" 14 | itk-wheel-tag: "v6.0a02" 15 | # v6.0a02 + fixes 16 | itk-python-package-tag: "v6.0a02" 17 | itk-python-package-org: "InsightSoftwareConsortium" 18 | 19 | jobs: 20 | build-test-cxx: 21 | runs-on: ${{ matrix.os }} 22 | strategy: 23 | max-parallel: 3 24 | matrix: 25 | # runners macos-13 is x86_64, macos-15 is arm64 by default 26 | os: [ubuntu-24.04, windows-2022, macos-13, macos-15] 27 | include: 28 | - os: ubuntu-24.04 29 | c-compiler: "gcc" 30 | cxx-compiler: "g++" 31 | cmake-build-type: "MinSizeRel" 32 | - os: windows-2022 33 | c-compiler: "cl.exe" 34 | cxx-compiler: "cl.exe" 35 | cmake-build-type: "Release" 36 | - os: macos-13 37 | c-compiler: "clang" 38 | cxx-compiler: "clang++" 39 | cmake-build-type: "MinSizeRel" 40 | deployment_target: '10.9' 41 | - os: macos-15 42 | c-compiler: "clang" 43 | cxx-compiler: "clang++" 44 | cmake-build-type: "MinSizeRel" 45 | deployment_target: '13.0' 46 | 47 | steps: 48 | - uses: actions/checkout@v4.2.2 49 | 50 | - name: Free Disk Space (Ubuntu) 51 | if: matrix.os == 'ubuntu-24.04' 52 | uses: jlumbroso/free-disk-space@v1.3.1 53 | with: 54 | large-packages: false 55 | 56 | - name: Set up Python 3.11 57 | uses: actions/setup-python@v5.4.0 58 | with: 59 | python-version: "3.11" 60 | 61 | - name: Install build dependencies 62 | run: | 63 | python -m pip install --upgrade pip 64 | python -m pip install ninja 65 | python -m pip install cookiecutter 66 | 67 | - name: Get specific version of CMake, Ninja 68 | uses: lukka/get-cmake@v3.31.5 69 | 70 | - name: 'Specific XCode version 14.3.1' 71 | if: matrix.os == 'macos-13' 72 | run: | 73 | sudo xcode-select -s "/Applications/Xcode_14.3.1.app" 74 | 75 | - name: 'Specific XCode version 16.2' 76 | if: matrix.os == 'macos-15' 77 | run: | 78 | sudo xcode-select -s "/Applications/Xcode_16.2.app" 79 | 80 | - name: Download ITK 81 | run: | 82 | cd .. 83 | git clone https://github.com/InsightSoftwareConsortium/ITK.git 84 | cd ITK 85 | git checkout ${{ env.itk-git-tag }} 86 | 87 | - name: Build ITK 88 | if: matrix.os != 'windows-2022' 89 | shell: bash 90 | run: | 91 | cd .. 92 | mkdir ITK-build 93 | cd ITK-build 94 | 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 95 | ninja 96 | 97 | - name: Build ITK 98 | if: matrix.os == 'windows-2022' 99 | shell: pwsh 100 | run: | 101 | Set-PSDebug -Trace 1 102 | cd .. 103 | mkdir ITK-build 104 | cd ITK-build 105 | & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -SkipAutomaticLocation 106 | 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 107 | ninja 108 | 109 | - name: Fetch CTest driver script 110 | run: | 111 | curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/dashboard/itk_common.cmake -O 112 | 113 | - name: Evaluate template 114 | shell: bash 115 | run: | 116 | python -m cookiecutter --no-input --output-dir "${GITHUB_WORKSPACE}/../Evaluated" "${GITHUB_WORKSPACE}" 117 | mkdir "${GITHUB_WORKSPACE}/../Evaluated/ITKModuleTemplate/.git" 118 | 119 | - name: Configure CTest script 120 | shell: bash 121 | run: | 122 | operating_system="${{ matrix.os }}" 123 | cat > dashboard.cmake << EOF 124 | set(CTEST_SITE "GitHubActions") 125 | file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/.." CTEST_DASHBOARD_ROOT) 126 | file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/../Evaluated/ITKModuleTemplate" CTEST_SOURCE_DIRECTORY) 127 | file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/../build" CTEST_BINARY_DIRECTORY) 128 | set(dashboard_source_name "${GITHUB_REPOSITORY}") 129 | if(ENV{GITHUB_REF} MATCHES "main") 130 | set(branch "-main") 131 | set(dashboard_model "Continuous") 132 | else() 133 | set(branch "-${GITHUB_REF}") 134 | set(dashboard_model "Experimental") 135 | endif() 136 | set(CTEST_BUILD_NAME "${GITHUB_REPOSITORY}-${operating_system}-\${branch}") 137 | set(CTEST_UPDATE_VERSION_ONLY 1) 138 | set(CTEST_TEST_ARGS \${CTEST_TEST_ARGS} PARALLEL_LEVEL \${PARALLEL_LEVEL}) 139 | set(CTEST_BUILD_CONFIGURATION "Release") 140 | set(CTEST_CMAKE_GENERATOR "Ninja") 141 | set(CTEST_CUSTOM_WARNING_EXCEPTION 142 | \${CTEST_CUSTOM_WARNING_EXCEPTION} 143 | # macOS Azure VM Warning 144 | "ld: warning: text-based stub file" 145 | ) 146 | set(dashboard_no_clean 1) 147 | set(ENV{CC} ${{ matrix.c-compiler }}) 148 | set(ENV{CXX} ${{ matrix.cxx-compiler }}) 149 | if(WIN32) 150 | set(ENV{PATH} "\${CTEST_DASHBOARD_ROOT}/ITK-build/bin;\$ENV{PATH}") 151 | endif() 152 | set(dashboard_cache " 153 | ITK_DIR:PATH=\${CTEST_DASHBOARD_ROOT}/ITK-build 154 | BUILD_TESTING:BOOL=ON 155 | ") 156 | string(TIMESTAMP build_date "%Y-%m-%d") 157 | message("CDash Build Identifier: \${build_date} \${CTEST_BUILD_NAME}") 158 | message("CTEST_SITE = \${CTEST_SITE}") 159 | include(\${CTEST_SCRIPT_DIRECTORY}/itk_common.cmake) 160 | EOF 161 | cat dashboard.cmake 162 | 163 | - name: Build and test 164 | if: matrix.os != 'windows-2022' 165 | run: | 166 | ctest --output-on-failure -j 2 -V -S dashboard.cmake 167 | 168 | - name: Build and test 169 | if: matrix.os == 'windows-2022' 170 | shell: pwsh 171 | run: | 172 | & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -SkipAutomaticLocation 173 | ctest --output-on-failure -j 2 -V -S dashboard.cmake 174 | 175 | build-linux-python-packages: 176 | runs-on: ubuntu-24.04 177 | strategy: 178 | max-parallel: 2 179 | matrix: 180 | python-version: ["39", "310", "311","312","313"] 181 | 182 | steps: 183 | - uses: actions/checkout@v4.2.2 184 | 185 | - name: 'Free up disk space' 186 | run: | 187 | # Workaround for https://github.com/actions/virtual-environments/issues/709 188 | df -h 189 | sudo apt-get clean 190 | sudo rm -rf "/usr/local/share/boost" 191 | sudo rm -rf "$AGENT_TOOLSDIRECTORY" 192 | df -h 193 | 194 | - name: 'Fetch build dependencies' 195 | shell: bash 196 | run: | 197 | sudo apt install zstd 198 | unzstd --version 199 | 200 | - name: Set up Python 3.11 201 | uses: actions/setup-python@v5.4.0 202 | with: 203 | python-version: "3.11" 204 | 205 | - name: Get specific version of CMake, Ninja 206 | uses: lukka/get-cmake@v3.31.5 207 | 208 | - name: Evaluate template 209 | shell: bash 210 | run: | 211 | python -m pip install cookiecutter 212 | python -m cookiecutter --no-input --output-dir "${GITHUB_WORKSPACE}/Evaluated" "${GITHUB_WORKSPACE}" 213 | mkdir "${GITHUB_WORKSPACE}/Evaluated/ITKModuleTemplate/.git" 214 | 215 | - name: 'Fetch build script' 216 | run: | 217 | curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/${{ env.itk-python-package-tag }}/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh -O 218 | chmod u+x dockcross-manylinux-download-cache-and-build-module-wheels.sh 219 | 220 | - name: 'Build 🐍 Python 📦 package' 221 | run: | 222 | cd "${GITHUB_WORKSPACE}/Evaluated/ITKModuleTemplate" 223 | export ITK_PACKAGE_VERSION=${{ env.itk-wheel-tag }} 224 | export ITKPYTHONPACKAGE_TAG=${{ env.itk-python-package-tag }} 225 | for manylinux_version in "_2_28" "2014"; do 226 | rm -rf ITKPythonPackage 227 | export MANYLINUX_VERSION=${manylinux_version} 228 | echo "Building for manylinux specialization ${MANYLINUX_VERSION}" 229 | ../../dockcross-manylinux-download-cache-and-build-module-wheels.sh cp${{ matrix.python-version }} 230 | done 231 | 232 | - name: Publish Python package as GitHub Artifact 233 | uses: actions/upload-artifact@v4.6.0 234 | with: 235 | name: LinuxWheel3${{ matrix.python-version }} 236 | path: Evaluated/ITKModuleTemplate/dist 237 | 238 | build-macos-python-packages: 239 | runs-on: macos-13 240 | strategy: 241 | max-parallel: 2 242 | matrix: 243 | python3-minor-version: ["9", "10", "11", "12", "13"] 244 | 245 | steps: 246 | - uses: actions/checkout@v4.2.2 247 | 248 | - name: 'Specific XCode version' 249 | run: | 250 | sudo xcode-select -s "/Applications/Xcode_14.3.1.app" 251 | 252 | - name: Get specific version of CMake, Ninja 253 | uses: lukka/get-cmake@v3.31.5 254 | 255 | - name: 'Fetch build script' 256 | run: | 257 | curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/${{ env.itk-python-package-tag }}/scripts/macpython-download-cache-and-build-module-wheels.sh -O 258 | chmod u+x macpython-download-cache-and-build-module-wheels.sh 259 | 260 | - name: Set up Python 3.11 261 | uses: actions/setup-python@v5.4.0 262 | with: 263 | python-version: "3.11" 264 | 265 | - name: Evaluate template 266 | shell: bash 267 | run: | 268 | python -m pip install cookiecutter 269 | python -m cookiecutter --no-input --output-dir "${GITHUB_WORKSPACE}/Evaluated" "${GITHUB_WORKSPACE}" 270 | mkdir "${GITHUB_WORKSPACE}/Evaluated/ITKModuleTemplate/.git" 271 | 272 | - name: 'Build 🐍 Python 📦 package' 273 | run: | 274 | cd "${GITHUB_WORKSPACE}/Evaluated/ITKModuleTemplate" 275 | export ITK_PACKAGE_VERSION=${{ env.itk-wheel-tag }} 276 | export ITKPYTHONPACKAGE_TAG=${{ env.itk-python-package-tag }} 277 | export ITKPYTHONPACKAGE_ORG=${{ env.itk-python-package-org }} 278 | # For Xcode 16.2, the recommended "MACOSX_DEPLOYMENT_TARGET" is "13.0"; this means your application should be built to run on macOS Ventura (version 13.0) or later. 279 | export MACOSX_DEPLOYMENT_TARGET=${{ matrix.deployment_target || '13.0' }} 280 | ../../macpython-download-cache-and-build-module-wheels.sh "3.${{ matrix.python3-minor-version }}" 281 | 282 | - name: Publish Python package as GitHub Artifact 283 | uses: actions/upload-artifact@v4.6.0 284 | with: 285 | name: MacOSWheel3${{ matrix.python3-minor-version }} 286 | path: Evaluated/ITKModuleTemplate/dist 287 | 288 | build-windows-python-packages: 289 | runs-on: windows-2022 290 | strategy: 291 | max-parallel: 2 292 | matrix: 293 | python-version-minor: ["9", "10", "11"] 294 | 295 | steps: 296 | - uses: actions/checkout@v4.2.2 297 | 298 | - name: 'Install Python' 299 | run: | 300 | $pythonArch = "64" 301 | $pythonVersion = "3.${{ matrix.python-version-minor }}" 302 | iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1')) 303 | 304 | - uses: actions/setup-python@v5.4.0 305 | with: 306 | python-version: '3.x' 307 | 308 | - name: Get specific version of CMake, Ninja 309 | uses: lukka/get-cmake@v3.31.5 310 | 311 | - name: Set up Python 3.11/ 312 | uses: actions/setup-python@v5.4.0 313 | with: 314 | python-version: "3.11" 315 | 316 | - name: Evaluate template 317 | shell: bash 318 | run: | 319 | python -m pip install cookiecutter 320 | python -m cookiecutter --no-input --output-dir "${GITHUB_WORKSPACE}/Evaluated" "${GITHUB_WORKSPACE}" 321 | mkdir "${GITHUB_WORKSPACE}/Evaluated/ITKModuleTemplate/.git" 322 | 323 | - name: 'Fetch build dependencies' 324 | shell: bash 325 | run: | 326 | cd Evaluated/ITKModuleTemplate 327 | curl -L "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${{ env.itk-wheel-tag }}/ITKPythonBuilds-windows.zip" -o "ITKPythonBuilds-windows.zip" 328 | 7z x ITKPythonBuilds-windows.zip -o/c/P -aoa -r 329 | curl -L "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -o "doxygen-1.8.11.windows.bin.zip" 330 | 7z x doxygen-1.8.11.windows.bin.zip -o/c/P/doxygen -aoa -r 331 | curl -L "https://data.kitware.com/api/v1/file/5bbf87ba8d777f06b91f27d6/download/grep-win.zip" -o "grep-win.zip" 332 | 7z x grep-win.zip -o/c/P/grep -aoa -r 333 | 334 | # Update step for skbuild issue in v5.3.0 build archive 335 | echo "Updating ITKPythonPackage build scripts to ${{ env.itk-python-package-tag }}" 336 | pushd /c/P/IPP 337 | git remote add InsightSoftwareConsortium https://github.com/InsightSoftwareConsortium/ITKPythonPackage.git --tags 338 | git fetch InsightSoftwareConsortium 339 | git checkout ${{ env.itk-python-package-tag }} 340 | git status 341 | popd 342 | 343 | - name: 'Build 🐍 Python 📦 package' 344 | shell: cmd 345 | run: | 346 | cd Evaluated/ITKModuleTemplate 347 | call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" 348 | set PATH=C:\P\grep;%PATH% 349 | set CC=cl.exe 350 | set CXX=cl.exe 351 | 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" 352 | 353 | - name: Publish Python package as GitHub Artifact 354 | uses: actions/upload-artifact@v4.6.0 355 | with: 356 | name: WindowsWheel3.${{ matrix.python-version-minor }} 357 | path: Evaluated/ITKModuleTemplate/dist 358 | -------------------------------------------------------------------------------- /.github/workflows/clang-format-linter.yml: -------------------------------------------------------------------------------- 1 | name: clang-format linter 2 | 3 | on: [push,pull_request] 4 | 5 | jobs: 6 | lint: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v4.2.2 11 | 12 | - uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@master 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Do not add ExternalData module staging files 2 | .ExternalData* 3 | 4 | # back-up files 5 | *~ 6 | *.bak 7 | 8 | # KWStyle hook output 9 | *.kws 10 | 11 | # compiled python files 12 | *.pyc 13 | 14 | # Binary directory 15 | BUILD* 16 | build* 17 | 18 | # qtcreator 19 | CMakeLists.txt.user* 20 | 21 | # kdevelop 22 | *.kdev* 23 | .kdev* 24 | 25 | # back-up files when conflicts occur 26 | *.orig 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | https://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | https://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ITKModuleTemplate 2 | ================= 3 | 4 | [![][gha-img]][gha-link] 5 | 6 | [gha-img]: https://github.com/InsightSoftwareConsortium/ITKModuleTemplate/actions/workflows/build-test-package.yml/badge.svg 7 | [gha-link]: https://github.com/InsightSoftwareConsortium/ITKModuleTemplate/actions/workflows/build-test-package.yml 8 | 9 | 10 | Overview 11 | -------- 12 | 13 | This is a module for the [Insight Toolkit (ITK)](https://itk.org) for 14 | segmentation and registration. It is designed to work with the ITK 15 | modular system. 16 | 17 | This module is a template to be used as a starting point for a new ITK 18 | module. 19 | 20 | Getting Started 21 | --------------- 22 | 23 | The following will get an external module started in a new repository: 24 | 25 | python -m pip install cookiecutter 26 | python -m cookiecutter gh:InsightSoftwareConsortium/ITKModuleTemplate 27 | # Fill in the information requested at the prompts 28 | 29 | Reasonable defaults will be provided for all of the parameters. The 30 | parameters are: 31 | 32 |
33 |
full_name
34 |
Your full name.
35 | 36 |
email
37 |
Your email.
38 | 39 |
project_name
40 |
This is a name for the project, which is ITK followed by the module 41 | name, by convention. Examples include ITKIsotropicWavelets or 42 | ITKBoneMorphometry.
43 | 44 |
module_name
45 |
This is the name of the module. Since this is an external module, it 46 | does not start with the ITK prefix. It is in CamelCase, by convention. 47 | Examples include IsotropicWavelets and BoneMorphometry.
48 | 49 |
filter_name
50 |
The skeleton of an itk::ImageToImageFilter will be created by default. 51 | Optionally specify this value, if you will be adding an 52 | itk::ImageToImageFilter to your module. 53 | 54 |
python_package_name
55 |
This is the name of the Python package that will be created from the 56 | module. By convention, this is itk- 57 | For example, itk-isotropicwavelets or itk-bonemorphometry.
58 | 59 |
download_url
60 |
This is the download url added to the Python package metadata. This can 61 | be the GitHub repository URL.
62 | 63 |
project_short_description
64 |
A short description to use in the project README, module Doxygen 65 | documentation, and Python package documentation.
66 | 67 |
project_long_description
68 |
A long description to use in the project README, module Doxygen 69 | documentation, and Python package documentation.
70 |
71 | 72 | The output of the cookiecutter is a buildable ITK external module with 73 | example classes. Remove or replace the classes with your new classes. 74 | Push your new module to GitHub. Cross-platform C++ testing and Python 75 | packaging is provided via the [ITKRemoteModuleBuildTestPackageAction] 76 | reusable GitHub Action. 77 | 78 | Documentation on [how to populate the 79 | module](https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch9.html#x50-1430009) 80 | can be found in the [ITK Software 81 | Guide](https://itk.org/ITKSoftwareGuide/html/). 82 | 83 | To improve the discoverability of your module on GitHub, first push the 84 | associated repository, then add 85 | [itk-module](https://github.com/topics/itk-module) to the project's 86 | [GitHub Topics](https://help.github.com/articles/about-topics/) . 87 | 88 | Remote Module 89 | ------------- 90 | 91 | After an [Insight Journal](https://www.insight-journal.org/) article has 92 | been submitted, the module can be included in ITK as a [remote 93 | module](https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch9.html#x55-1640009.7). 94 | Add a file in "ITK/Modules/Remote" called "YourModule.remote.cmake", for 95 | this module it would be "ExternalExample.remote.cmake" with the 96 | followlowing contents: 97 | 98 | itk_fetch_module(MyModule 99 | "A description of the a module." 100 | GIT_REPOSITORY https://github.com/myuser/ITKMyModule.git 101 | GIT_TAG abcdef012345 102 | ) 103 | 104 | CI Testing and Python Packages 105 | ------------------------------ 106 | 107 | Continuous integration service configurations are included to build 108 | and test the C++ core of packages across platforms and build binary 109 | Python packages for Linux, macOS, and Windows. For more information, see 110 | the [ITKRemoteModuleBuildTestPackageAction] documentation. 111 | 112 | pyproject.toml migration 113 | ------------------------ 114 | 115 | ITK 5.4 added support for [scikit-build-core](https://scikit-build-core.readthedocs.io/en/latest/), 116 | an update to scikit-build classic that supports [PEP 117 | 517](https://peps.python.org/pep-0517/) and other modern Python packaging 118 | standards configured in the declarative *pyproject.toml* file. While the 119 | *setup.py* file is still supported in ITK 5.4, migration to *pyproject.toml* 120 | is encouraged. One important advantage is the generation of Stable ABI wheels 121 | for Python 3.11+; these packages work with Python 3.11, 3.12, 122 | 3.13, 3.14, etc. To migrate to scikit-build-core, use the pyproject.toml 123 | template in this repository and remove the *setup.py* file. 124 | 125 | ITKv4 Branch 126 | ------------ 127 | 128 | In the transition to the major release of ITKv5 your module might want 129 | to be compatible with both versions: ITKv4 and ITKv5. In order to do 130 | that, keep the master branch for development with ITKv5, and create 131 | another branch, named `ITKv4`, or `release`, that is compatible with the 132 | version 4.13 of ITK. For examples and updated information on how to do 133 | this: please [check the discourse 134 | conversation](https://discourse.itk.org/t/itk-external-module-github-builds-for-4-x-and-5-x/900). 135 | 136 | License 137 | ------- 138 | 139 | This software is distributed under the Apache 2.0 license. Please see 140 | the *LICENSE* file for details. 141 | 142 | Authors 143 | ------- 144 | 145 | - Bradley Lowekamp 146 | - Matt McCormick 147 | - Jean-Baptiste VIMORT 148 | 149 | [ITKRemoteModuleBuildTestPackageAction]: https://github.com/InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction 150 | -------------------------------------------------------------------------------- /cookiecutter.json: -------------------------------------------------------------------------------- 1 | { 2 | "full_name": "Insight Software Consortium", 3 | "email": "itk+community@discourse.itk.org", 4 | "project_name": "ITKModuleTemplate", 5 | "module_name": "{{ cookiecutter.project_name[3:] }}", 6 | "filter_name": "MyFilter", 7 | "python_package_name": "itk-{{ cookiecutter.project_name[3:].lower() }}", 8 | "example_name": "MyFilterApplicationWholePipeline", 9 | "download_url": "https://github.com/InsightSoftwareConsortium/{{ cookiecutter.project_name }}", 10 | "project_short_description": "This is a template that serves as a starting point for a new module.", 11 | "project_long_description": "ITK is an open-source, cross-platform library that provides developers with an extensive suite of software tools for image analysis. Developed through extreme programming methodologies, ITK employs leading-edge algorithms for registering and segmenting multidimensional scientific images." 12 | } 13 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/.clang-format: -------------------------------------------------------------------------------- 1 | ## This config file is only relevant for clang-format version 19.1.4 2 | ## 3 | ## Examples of each format style can be found on the in the clang-format documentation 4 | ## See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html for details of each option 5 | ## 6 | ## The clang-format binaries can be downloaded as part of the clang binary distributions 7 | ## from https://releases.llvm.org/download.html 8 | ## 9 | ## Use the script Utilities/Maintenance/clang-format.bash to faciliate 10 | ## maintaining a consistent code style. 11 | ## 12 | ## EXAMPLE apply code style enforcement before commit: 13 | # Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --modified 14 | ## EXAMPLE apply code style enforcement after commit: 15 | # Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --last 16 | --- 17 | # This configuration requires clang-format version 19.1.4 exactly. 18 | Language: Cpp 19 | AccessModifierOffset: -2 20 | AlignAfterOpenBracket: Align 21 | AlignArrayOfStructures: None 22 | AlignConsecutiveAssignments: 23 | Enabled: false 24 | AcrossEmptyLines: false 25 | AcrossComments: false 26 | AlignCompound: false 27 | AlignFunctionPointers: false 28 | PadOperators: true 29 | AlignConsecutiveBitFields: 30 | Enabled: false 31 | AcrossEmptyLines: false 32 | AcrossComments: false 33 | AlignCompound: false 34 | AlignFunctionPointers: false 35 | PadOperators: false 36 | AlignConsecutiveDeclarations: 37 | Enabled: true 38 | AcrossEmptyLines: false 39 | AcrossComments: false 40 | AlignCompound: false 41 | AlignFunctionPointers: false 42 | PadOperators: true 43 | AlignConsecutiveMacros: 44 | Enabled: false 45 | AcrossEmptyLines: false 46 | AcrossComments: false 47 | AlignCompound: false 48 | AlignFunctionPointers: false 49 | PadOperators: false 50 | AlignConsecutiveShortCaseStatements: 51 | Enabled: false 52 | AcrossEmptyLines: false 53 | AcrossComments: false 54 | AlignCaseArrows: false 55 | AlignCaseColons: false 56 | AlignConsecutiveTableGenBreakingDAGArgColons: 57 | Enabled: false 58 | AcrossEmptyLines: false 59 | AcrossComments: false 60 | AlignCompound: false 61 | AlignFunctionPointers: false 62 | PadOperators: false 63 | AlignConsecutiveTableGenCondOperatorColons: 64 | Enabled: false 65 | AcrossEmptyLines: false 66 | AcrossComments: false 67 | AlignCompound: false 68 | AlignFunctionPointers: false 69 | PadOperators: false 70 | AlignConsecutiveTableGenDefinitionColons: 71 | Enabled: false 72 | AcrossEmptyLines: false 73 | AcrossComments: false 74 | AlignCompound: false 75 | AlignFunctionPointers: false 76 | PadOperators: false 77 | AlignEscapedNewlines: Left 78 | AlignOperands: Align 79 | AlignTrailingComments: 80 | Kind: Always 81 | OverEmptyLines: 0 82 | AllowAllArgumentsOnNextLine: true 83 | AllowAllParametersOfDeclarationOnNextLine: false 84 | AllowBreakBeforeNoexceptSpecifier: Never 85 | AllowShortBlocksOnASingleLine: Never 86 | AllowShortCaseExpressionOnASingleLine: true 87 | AllowShortCaseLabelsOnASingleLine: false 88 | AllowShortCompoundRequirementOnASingleLine: true 89 | AllowShortEnumsOnASingleLine: true 90 | #AllowShortFunctionsOnASingleLine: Inline Only merge functions defined inside a class. Implies empty. 91 | #AllowShortFunctionsOnASingleLine: None (in configuration: None) Never merge functions into a single line. 92 | AllowShortFunctionsOnASingleLine: All 93 | AllowShortIfStatementsOnASingleLine: Never 94 | AllowShortLambdasOnASingleLine: All 95 | AllowShortLoopsOnASingleLine: false 96 | AlwaysBreakAfterDefinitionReturnType: None 97 | AlwaysBreakBeforeMultilineStrings: false 98 | AttributeMacros: 99 | - __capability 100 | BinPackArguments: false 101 | BinPackParameters: false 102 | BitFieldColonSpacing: Both 103 | BraceWrapping: 104 | AfterCaseLabel: true 105 | AfterClass: true 106 | AfterControlStatement: Always 107 | AfterEnum: true 108 | AfterExternBlock: true 109 | AfterFunction: true 110 | AfterNamespace: true 111 | AfterObjCDeclaration: true 112 | AfterStruct: true 113 | AfterUnion: true 114 | BeforeCatch: true 115 | BeforeElse: true 116 | BeforeLambdaBody: false 117 | BeforeWhile: false 118 | IndentBraces: false 119 | SplitEmptyFunction: false 120 | SplitEmptyRecord: false 121 | SplitEmptyNamespace: false 122 | BreakAdjacentStringLiterals: true 123 | BreakAfterAttributes: Leave 124 | BreakAfterJavaFieldAnnotations: false 125 | BreakAfterReturnType: All 126 | BreakArrays: true 127 | BreakBeforeBinaryOperators: None 128 | BreakBeforeConceptDeclarations: Always 129 | BreakBeforeBraces: Custom 130 | BreakBeforeInlineASMColon: OnlyMultiline 131 | BreakBeforeTernaryOperators: true 132 | BreakConstructorInitializers: BeforeComma 133 | BreakFunctionDefinitionParameters: false 134 | BreakInheritanceList: BeforeComma 135 | BreakStringLiterals: true 136 | BreakTemplateDeclarations: Yes 137 | ## The following line allows larger lines in non-documentation code 138 | ColumnLimit: 120 139 | CommentPragmas: '^ IWYU pragma:' 140 | CompactNamespaces: false 141 | ConstructorInitializerIndentWidth: 2 142 | ContinuationIndentWidth: 2 143 | Cpp11BracedListStyle: false 144 | DerivePointerAlignment: false 145 | DisableFormat: false 146 | EmptyLineAfterAccessModifier: Never 147 | EmptyLineBeforeAccessModifier: LogicalBlock 148 | ExperimentalAutoDetectBinPacking: false 149 | FixNamespaceComments: true 150 | ForEachMacros: 151 | - foreach 152 | - Q_FOREACH 153 | - BOOST_FOREACH 154 | IfMacros: 155 | - KJ_IF_MAYBE 156 | IncludeBlocks: Preserve 157 | IncludeCategories: 158 | - Regex: '^"(llvm|llvm-c|clang|clang-c)/' 159 | Priority: 2 160 | SortPriority: 0 161 | CaseSensitive: false 162 | - Regex: '^(<|"(gtest|gmock|isl|json)/)' 163 | Priority: 3 164 | SortPriority: 0 165 | CaseSensitive: false 166 | - Regex: '.*' 167 | Priority: 1 168 | SortPriority: 0 169 | CaseSensitive: false 170 | IncludeIsMainRegex: '(Test)?$' 171 | IncludeIsMainSourceRegex: '' 172 | IndentAccessModifiers: false 173 | IndentCaseBlocks: false 174 | IndentCaseLabels: true 175 | IndentExternBlock: AfterExternBlock 176 | IndentGotoLabels: true 177 | IndentPPDirectives: AfterHash 178 | IndentRequiresClause: true 179 | IndentWidth: 2 180 | IndentWrappedFunctionNames: false 181 | InsertBraces: false 182 | InsertNewlineAtEOF: false 183 | InsertTrailingCommas: None 184 | IntegerLiteralSeparator: 185 | Binary: 0 186 | BinaryMinDigits: 0 187 | Decimal: 0 188 | DecimalMinDigits: 0 189 | Hex: 0 190 | HexMinDigits: 0 191 | JavaScriptQuotes: Leave 192 | JavaScriptWrapImports: true 193 | KeepEmptyLines: 194 | AtEndOfFile: false 195 | AtStartOfBlock: true 196 | AtStartOfFile: true 197 | LambdaBodyIndentation: Signature 198 | LineEnding: DeriveLF 199 | MacroBlockBegin: '' 200 | MacroBlockEnd: '' 201 | MainIncludeChar: Quote 202 | MaxEmptyLinesToKeep: 2 203 | NamespaceIndentation: None 204 | ObjCBinPackProtocolList: Auto 205 | ObjCBlockIndentWidth: 2 206 | ObjCBreakBeforeNestedBlockParam: true 207 | ObjCSpaceAfterProperty: true 208 | ObjCSpaceBeforeProtocolList: false 209 | PackConstructorInitializers: BinPack 210 | PenaltyBreakAssignment: 2 211 | PenaltyBreakBeforeFirstCallParameter: 19 212 | PenaltyBreakComment: 300 213 | ## The following line allows larger lines in non-documentation code 214 | PenaltyBreakFirstLessLess: 120 215 | PenaltyBreakOpenParenthesis: 0 216 | PenaltyBreakScopeResolution: 500 217 | PenaltyBreakString: 1000 218 | PenaltyBreakTemplateDeclaration: 10 219 | PenaltyExcessCharacter: 1000000 220 | PenaltyIndentedWhitespace: 0 221 | PenaltyReturnTypeOnItsOwnLine: 200 222 | PointerAlignment: Middle 223 | PPIndentWidth: -1 224 | QualifierAlignment: Custom 225 | QualifierOrder: 226 | - friend 227 | - static 228 | - inline 229 | - constexpr 230 | - const 231 | - type 232 | ReferenceAlignment: Pointer 233 | ReflowComments: true 234 | RemoveBracesLLVM: false 235 | RemoveParentheses: Leave 236 | RemoveSemicolon: false 237 | RequiresClausePosition: OwnLine 238 | RequiresExpressionIndentation: OuterScope 239 | SeparateDefinitionBlocks: Leave 240 | ShortNamespaceLines: 1 241 | SkipMacroDefinitionBody: false 242 | # We may want to sort the includes as a separate pass 243 | SortIncludes: Never 244 | SortJavaStaticImport: Before 245 | # We may want to revisit this later 246 | SortUsingDeclarations: Never 247 | SpaceAfterCStyleCast: false 248 | SpaceAfterLogicalNot: false 249 | SpaceAfterTemplateKeyword: true 250 | SpaceAroundPointerQualifiers: Default 251 | SpaceBeforeAssignmentOperators: true 252 | SpaceBeforeCaseColon: false 253 | SpaceBeforeCpp11BracedList: false 254 | SpaceBeforeCtorInitializerColon: true 255 | SpaceBeforeInheritanceColon: true 256 | SpaceBeforeJsonColon: false 257 | SpaceBeforeParens: ControlStatements 258 | SpaceBeforeParensOptions: 259 | AfterControlStatements: true 260 | AfterForeachMacros: true 261 | AfterFunctionDefinitionName: false 262 | AfterFunctionDeclarationName: false 263 | AfterIfMacros: true 264 | AfterOverloadedOperator: false 265 | AfterPlacementOperator: true 266 | AfterRequiresInClause: false 267 | AfterRequiresInExpression: false 268 | BeforeNonEmptyParentheses: false 269 | SpaceBeforeRangeBasedForLoopColon: true 270 | SpaceBeforeSquareBrackets: false 271 | SpaceInEmptyBlock: false 272 | SpacesBeforeTrailingComments: 1 273 | SpacesInAngles: Never 274 | SpacesInContainerLiterals: false 275 | SpacesInLineCommentPrefix: 276 | Minimum: 1 277 | Maximum: -1 278 | SpacesInParens: Never 279 | SpacesInParensOptions: 280 | ExceptDoubleParentheses: false 281 | InCStyleCasts: false 282 | InConditionalStatements: false 283 | InEmptyParentheses: false 284 | Other: false 285 | SpacesInSquareBrackets: false 286 | Standard: Latest 287 | StatementAttributeLikeMacros: 288 | - Q_EMIT 289 | StatementMacros: 290 | - Q_UNUSED 291 | - QT_REQUIRE_VERSION 292 | - ITK_GCC_PRAGMA_PUSH 293 | - ITK_GCC_PRAGMA_POP 294 | - ITK_GCC_SUPPRESS_Wfloat_equal 295 | - ITK_GCC_SUPPRESS_Wformat_nonliteral 296 | - ITK_GCC_SUPPRESS_Warray_bounds 297 | - ITK_CLANG_PRAGMA_PUSH 298 | - ITK_CLANG_PRAGMA_POP 299 | - ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant 300 | - CLANG_PRAGMA_PUSH 301 | - CLANG_PRAGMA_POP 302 | - CLANG_SUPPRESS_Wfloat_equal 303 | - INTEL_PRAGMA_WARN_PUSH 304 | - INTEL_PRAGMA_WARN_POP 305 | - INTEL_SUPPRESS_warning_1292 306 | - itkTemplateFloatingToIntegerMacro 307 | - itkLegacyMacro 308 | TableGenBreakInsideDAGArg: DontBreak 309 | TabWidth: 2 310 | UseTab: Never 311 | VerilogBreakBetweenInstancePorts: true 312 | WhitespaceSensitiveMacros: 313 | - BOOST_PP_STRINGIZE 314 | - CF_SWIFT_NAME 315 | - NS_SWIFT_NAME 316 | - PP_STRINGIZE 317 | - STRINGIZE 318 | ... 319 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/.editorconfig: -------------------------------------------------------------------------------- 1 | # https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Apply to all code files 7 | [*] 8 | # A newline ending every file 9 | insert_final_newline = true 10 | 11 | # Set default charset 12 | charset = utf-8 13 | 14 | # 4 space indentation 15 | indent_style = space 16 | indent_size = 2 17 | 18 | # Various options 19 | trim_trailing_whitespace = true 20 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/.github/workflows/build-test-package.yml: -------------------------------------------------------------------------------- 1 | name: Build, test, package 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | tags: 8 | - 'v*' 9 | pull_request: 10 | branches: 11 | - main 12 | 13 | jobs: 14 | cxx-build-workflow: 15 | uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@v5.4.2 16 | 17 | python-build-workflow: 18 | uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@v5.4.2 19 | secrets: 20 | pypi_password: ${{ "{{" }} secrets.pypi_password {{ "}}" }} 21 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/.github/workflows/clang-format-linter.yml: -------------------------------------------------------------------------------- 1 | name: clang-format linter 2 | 3 | on: [push,pull_request] 4 | 5 | jobs: 6 | lint: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v4 11 | 12 | - uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@master 13 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.22.1...3.29.0 FATAL_ERROR) 2 | project({{ cookiecutter.module_name }}) 3 | 4 | set({{ cookiecutter.module_name }}_LIBRARIES {{ cookiecutter.module_name }}) 5 | 6 | if(NOT ITK_SOURCE_DIR) 7 | find_package(ITK REQUIRED) 8 | list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) 9 | include(ITKModuleExternal) 10 | else() 11 | set(ITK_DIR ${CMAKE_BINARY_DIR}) 12 | itk_module_impl() 13 | endif() 14 | 15 | itk_module_examples() 16 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/CTestConfig.cmake: -------------------------------------------------------------------------------- 1 | set(CTEST_PROJECT_NAME "ITK") 2 | set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC") 3 | 4 | set(CTEST_DROP_METHOD "https") 5 | set(CTEST_DROP_SITE "open.cdash.org") 6 | set(CTEST_DROP_LOCATION "/submit.php?project=Insight") 7 | set(CTEST_DROP_SITE_CDASH TRUE) 8 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | https://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | https://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/README.md: -------------------------------------------------------------------------------- 1 | # {{ cookiecutter.project_name }} 2 | 3 | [![Build Status]({{ cookiecutter.download_url }}/actions/workflows/build-test-package.yml/badge.svg)]({{ cookiecutter.download_url }}/actions/workflows/build-test-package.yml) 4 | 5 | [![PyPI Version](https://img.shields.io/pypi/v/{{ cookiecutter.python_package_name }}.svg)](https://pypi.python.org/pypi/{{ cookiecutter.python_package_name }}) 6 | 7 | [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)]({{ cookiecutter.download_url }}/blob/main/LICENSE) 8 | 9 | ## Overview 10 | 11 | {{ cookiecutter.project_short_description }} 12 | 13 | {{ cookiecutter.project_long_description }} 14 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.22.1...3.29.0 FATAL_ERROR) 2 | project({{ cookiecutter.module_name }}Examples) 3 | 4 | set(ExampleSpecificComponents 5 | {{ cookiecutter.module_name }} 6 | ) 7 | 8 | if(NOT ITK_SOURCE_DIR) 9 | find_package(ITK REQUIRED COMPONENTS ITKImageIO ITKTransformIO ${ExampleSpecificComponents}) 10 | else() 11 | # When being built as part of ITK, ITKImageIO and ITKTransformIO 12 | # lists of modules are not yet ready, causing a configure error 13 | find_package(ITK REQUIRED COMPONENTS ${ExampleSpecificComponents}) 14 | endif() 15 | include(${ITK_USE_FILE}) 16 | 17 | add_executable({{ cookiecutter.example_name }} {{ cookiecutter.example_name }}.cxx ) 18 | target_link_libraries({{ cookiecutter.example_name }} ${ITK_LIBRARIES}) 19 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/examples/{{ cookiecutter.example_name }}.cxx: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | * 3 | * Copyright NumFOCUS 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0.txt 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | *=========================================================================*/ 18 | 19 | #include "itk{{cookiecutter.filter_name}}.h" 20 | 21 | #include "itkCommand.h" 22 | #include "itkImageFileReader.h" 23 | #include "itkImageFileWriter.h" 24 | 25 | 26 | int main( int argc, char * argv[] ) 27 | { 28 | if( argc < 4 ) 29 | { 30 | std::cerr << "Missing parameters." << std::endl; 31 | std::cerr << "Usage: " << argv[0] 32 | << " inputImage" 33 | << " outputImage" 34 | << " parameters" << std::endl; 35 | return EXIT_FAILURE; 36 | } 37 | 38 | 39 | // Please, write a complete, self-containted and useful example that 40 | // demonstrate a class when being used along with other ITK classes or in 41 | // the context of a wider or specific application. 42 | 43 | 44 | return EXIT_SUCCESS; 45 | } 46 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/examples/{{ cookiecutter.example_name }}.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright NumFOCUS 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # https://www.apache.org/licenses/LICENSE-2.0.txt 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Run with: 18 | # ./{{ cookiecutter.example_name }}.py 19 | # 20 | # e.g. 21 | # ./{{ cookiecutter.example_name }}.py MyImage.mha Output.mha 2 0.2 22 | # (A rule of thumb is to set the Threshold to be about 1 / 100 of the Level.) 23 | # 24 | # parameter_1: absolute minimum... 25 | # The assumption is that... 26 | # parameter_2: controls the.. 27 | # A tradeoff between... 28 | 29 | import argparse 30 | 31 | import itk 32 | 33 | 34 | parser = argparse.ArgumentParser(description="Example short description.") 35 | parser.add_argument("input_image") 36 | parser.add_argument("output_image") 37 | parser.add_argument("parameter_1") 38 | args = parser.parse_args() 39 | 40 | # Please, write a complete, self-containted and useful example that 41 | # demonstrate a class when being used along with other ITK classes or in 42 | # the context of a wider or specific application. 43 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/include/itkMinimalStandardRandomVariateGenerator.h: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | * 3 | * Copyright NumFOCUS 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0.txt 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | *=========================================================================*/ 18 | #ifndef itkMinimalStandardRandomVariateGenerator_h 19 | #define itkMinimalStandardRandomVariateGenerator_h 20 | 21 | #include "itkIntTypes.h" 22 | #include "itkObjectFactory.h" 23 | #include "itkRandomVariateGeneratorBase.h" 24 | #include "{{ cookiecutter.module_name}}Export.h" 25 | #include "itkNormalVariateGenerator.h" 26 | 27 | namespace itk 28 | { 29 | namespace Statistics 30 | { 31 | /** \class MinimalStandardRandomVariateGenerator 32 | * \brief Linear congruential random random variate generator. 33 | * 34 | * This is a pseudo-random number generator for unsigned integers following 35 | * 36 | * \f[ 37 | * X_{n+1} = (a X_n + c) \mod m 38 | * \f] 39 | * 40 | * where \f$a\f$ is the Multiplier \f$c\f$ is the Increment and \f$m\f$ is 41 | * the Modulus. 42 | * 43 | * https://en.wikipedia.com/wiki/Linear_congruential_generator 44 | * 45 | * The random numbers generated have a period \f$m\f$. 46 | * 47 | * This class uses \f$a = 48271\f$, \f$c = 0\f$, \f$m = 2^31 -1 = 48 | * 2147483647\f$, the Minimial Standard configuration recommended by Park, 49 | * Miller and Stockmeyer in 1993. 50 | * 51 | * \ingroup {{ cookiecutter.module_name }} 52 | */ 53 | class {{ cookiecutter.module_name }}_EXPORT MinimalStandardRandomVariateGenerator : public RandomVariateGeneratorBase 54 | { 55 | public: 56 | ITK_DISALLOW_COPY_AND_MOVE(MinimalStandardRandomVariateGenerator); 57 | 58 | /** Standard class aliases. */ 59 | using Self = MinimalStandardRandomVariateGenerator; 60 | using Superclass = RandomVariateGeneratorBase; 61 | using Pointer = SmartPointer; 62 | using ConstPointer = SmartPointer; 63 | 64 | using IntegerType = uint32_t; 65 | 66 | using NormalGeneratorType = itk::Statistics::NormalVariateGenerator; 67 | 68 | /** Run-time type information (and related methods). */ 69 | itkOverrideGetNameOfClassMacro(MinimalStandardRandomVariateGenerator); 70 | 71 | /** Method for creation through the object factory. */ 72 | itkNewMacro(Self); 73 | 74 | /** initialize with a simple IntegerType */ 75 | void 76 | Initialize(int randomSeed); 77 | 78 | /** Get a variate in the range [0, 1] */ 79 | double 80 | GetVariate() override; 81 | 82 | protected: 83 | MinimalStandardRandomVariateGenerator(); 84 | ~MinimalStandardRandomVariateGenerator() override = default; 85 | 86 | void 87 | PrintSelf(std::ostream & os, Indent indent) const override; 88 | 89 | private: 90 | NormalGeneratorType::Pointer m_NormalGenerator; 91 | }; 92 | 93 | } // end of namespace Statistics 94 | } // end of namespace itk 95 | 96 | #endif // itkMinimalStandardRandomVariateGenerator_h 97 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/include/itk{{cookiecutter.filter_name}}.h: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | * 3 | * Copyright NumFOCUS 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0.txt 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | *=========================================================================*/ 18 | #ifndef itk{{ cookiecutter.filter_name }}_h 19 | #define itk{{ cookiecutter.filter_name }}_h 20 | 21 | #include "itkImageToImageFilter.h" 22 | 23 | namespace itk 24 | { 25 | 26 | /** \class {{ cookiecutter.filter_name }} 27 | * 28 | * \brief Filters a image by iterating over its pixels. 29 | * 30 | * Filters a image by iterating over its pixels in a multi-threaded way 31 | * and {to be completed by the developer}. 32 | * 33 | * \ingroup {{ cookiecutter.module_name }} 34 | * 35 | */ 36 | template 37 | class {{ cookiecutter.filter_name }} : public ImageToImageFilter 38 | { 39 | public: 40 | ITK_DISALLOW_COPY_AND_MOVE({{ cookiecutter.filter_name }}); 41 | 42 | static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension; 43 | static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension; 44 | 45 | using InputImageType = TInputImage; 46 | using OutputImageType = TOutputImage; 47 | using InputPixelType = typename InputImageType::PixelType; 48 | using OutputPixelType = typename OutputImageType::PixelType; 49 | 50 | /** Standard class aliases. */ 51 | using Self = {{ cookiecutter.filter_name }}; 52 | using Superclass = ImageToImageFilter; 53 | using Pointer = SmartPointer; 54 | using ConstPointer = SmartPointer; 55 | 56 | /** Run-time type information. */ 57 | itkOverrideGetNameOfClassMacro({{ cookiecutter.filter_name }}); 58 | 59 | /** Standard New macro. */ 60 | itkNewMacro(Self); 61 | 62 | protected: 63 | {{ cookiecutter.filter_name }}(); 64 | ~{{ cookiecutter.filter_name }}() override = default; 65 | 66 | void 67 | PrintSelf(std::ostream & os, Indent indent) const override; 68 | 69 | using OutputRegionType = typename OutputImageType::RegionType; 70 | 71 | void 72 | DynamicThreadedGenerateData(const OutputRegionType & outputRegion) override; 73 | 74 | private: 75 | #ifdef ITK_USE_CONCEPT_CHECKING 76 | // Add concept checking such as 77 | // itkConceptMacro( FloatingPointPixel, ( itk::Concept::IsFloatingPoint< typename InputImageType::PixelType > ) ); 78 | #endif 79 | }; 80 | } // namespace itk 81 | 82 | #ifndef ITK_MANUAL_INSTANTIATION 83 | # include "itk{{ cookiecutter.filter_name }}.hxx" 84 | #endif 85 | 86 | #endif // itk{{ cookiecutter.filter_name }} 87 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/include/itk{{cookiecutter.filter_name}}.hxx: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | * 3 | * Copyright NumFOCUS 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0.txt 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | *=========================================================================*/ 18 | #ifndef itk{{ cookiecutter.filter_name }}_hxx 19 | #define itk{{ cookiecutter.filter_name }}_hxx 20 | 21 | #include "itk{{ cookiecutter.filter_name }}.h" 22 | 23 | #include "itkImageRegionIterator.h" 24 | #include "itkImageRegionConstIterator.h" 25 | 26 | namespace itk 27 | { 28 | 29 | template 30 | {{ cookiecutter.filter_name }} 31 | ::{{ cookiecutter.filter_name }}() 32 | {} 33 | 34 | 35 | template 36 | void 37 | {{ cookiecutter.filter_name }} 38 | ::PrintSelf(std::ostream & os, Indent indent) const 39 | { 40 | Superclass::PrintSelf(os, indent); 41 | } 42 | 43 | 44 | template 45 | void 46 | {{ cookiecutter.filter_name }} 47 | ::DynamicThreadedGenerateData(const OutputRegionType & outputRegion) 48 | { 49 | OutputImageType * output = this->GetOutput(); 50 | const InputImageType * input = this->GetInput(); 51 | using InputRegionType = typename InputImageType::RegionType; 52 | InputRegionType inputRegion = InputRegionType(outputRegion.GetSize()); 53 | 54 | itk::ImageRegionConstIterator in(input, inputRegion); 55 | itk::ImageRegionIterator out(output, outputRegion); 56 | 57 | for (in.GoToBegin(), out.GoToBegin(); !in.IsAtEnd() && !out.IsAtEnd(); ++in, ++out) 58 | { 59 | out.Set(in.Get()); 60 | } 61 | } 62 | 63 | } // end namespace itk 64 | 65 | #endif // itk{{ cookiecutter.filter_name }}_hxx 66 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/itk-module.cmake: -------------------------------------------------------------------------------- 1 | # the top-level README is used for describing this module, just 2 | # re-used it for documentation here 3 | get_filename_component(MY_CURRENT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 4 | file(READ "${MY_CURRENT_DIR}/README.md" DOCUMENTATION) 5 | 6 | # itk_module() defines the module dependencies in {{ cookiecutter.module_name }} 7 | # {{ cookiecutter.module_name }} depends on ITKCommon 8 | # The testing module in {{ cookiecutter.module_name }} depends on ITKTestKernel 9 | # and ITKMetaIO(besides {{ cookiecutter.module_name }} and ITKCore) 10 | # By convention those modules outside of ITK are not prefixed with 11 | # ITK. 12 | 13 | # define the dependencies of the include module and the tests 14 | itk_module({{ cookiecutter.module_name }} 15 | DEPENDS 16 | ITKCommon 17 | ITKStatistics 18 | COMPILE_DEPENDS 19 | ITKImageSources 20 | TEST_DEPENDS 21 | ITKTestKernel 22 | ITKMetaIO 23 | DESCRIPTION 24 | "${DOCUMENTATION}" 25 | EXCLUDE_FROM_DEFAULT 26 | ENABLE_SHARED 27 | ) 28 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["scikit-build-core"] 3 | build-backend = "scikit_build_core.build" 4 | 5 | [project] 6 | name = "{{ cookiecutter.python_package_name }}" 7 | version = "0.1.0" 8 | description = "{{ cookiecutter.project_short_description }}" 9 | readme = "README.md" 10 | license = {file = "LICENSE"} 11 | authors = [ 12 | { name = "{{ cookiecutter.full_name }}", email = "{{ cookiecutter.email }}" }, 13 | ] 14 | keywords = [ 15 | "itk", 16 | ] 17 | classifiers = [ 18 | "Development Status :: 4 - Beta", 19 | "Intended Audience :: Developers", 20 | "Intended Audience :: Education", 21 | "Intended Audience :: Healthcare Industry", 22 | "Intended Audience :: Science/Research", 23 | "License :: OSI Approved :: Apache Software License", 24 | "Operating System :: Android", 25 | "Operating System :: MacOS", 26 | "Operating System :: Microsoft :: Windows", 27 | "Operating System :: POSIX", 28 | "Operating System :: Unix", 29 | "Programming Language :: C++", 30 | "Programming Language :: Python", 31 | "Topic :: Scientific/Engineering", 32 | "Topic :: Scientific/Engineering :: Information Analysis", 33 | "Topic :: Scientific/Engineering :: Medical Science Apps.", 34 | "Topic :: Software Development :: Libraries", 35 | ] 36 | requires-python = ">=3.8" 37 | dependencies = [ 38 | "itk == 5.4.*", 39 | ] 40 | 41 | [project.urls] 42 | Download = "{{ cookiecutter.download_url }}" 43 | Homepage = "{{ cookiecutter.download_url }}" 44 | 45 | [tool.scikit-build] 46 | # The versions of CMake to allow. If CMake is not present on the system or does 47 | # not pass this specifier, it will be downloaded via PyPI if possible. An empty 48 | # string will disable this check. 49 | cmake.version = ">=3.16.3" 50 | 51 | # A list of args to pass to CMake when configuring the project. Setting this in 52 | # config or envvar will override toml. See also ``cmake.define``. 53 | cmake.args = [] 54 | 55 | # A table of defines to pass to CMake when configuring the project. Additive. 56 | cmake.define = {} 57 | 58 | # Verbose printout when building. 59 | cmake.verbose = true 60 | 61 | # The build type to use when building the project. Valid options are: "Debug", 62 | # "Release", "RelWithDebInfo", "MinSizeRel", "", etc. 63 | cmake.build-type = "Release" 64 | 65 | # The source directory to use when building the project. Currently only affects 66 | # the native builder (not the setuptools plugin). 67 | cmake.source-dir = "." 68 | 69 | # The versions of Ninja to allow. If Ninja is not present on the system or does 70 | # not pass this specifier, it will be downloaded via PyPI if possible. An empty 71 | # string will disable this check. 72 | ninja.version = ">=1.11" 73 | 74 | # The logging level to display, "DEBUG", "INFO", "WARNING", and "ERROR" are 75 | # possible options. 76 | logging.level = "INFO" 77 | 78 | # Files to include in the SDist even if they are skipped by default. Supports 79 | # gitignore syntax. 80 | sdist.include = [] 81 | 82 | # Files to exclude from the SDist even if they are included by default. Supports 83 | # gitignore syntax. 84 | sdist.exclude = [] 85 | 86 | # A list of license files to include in the wheel. Supports glob patterns. 87 | wheel.license-files = ["LICEN[CS]E*",] 88 | 89 | # Target the platlib or the purelib. If not set, the default is to target the 90 | # platlib if wheel.cmake is true, and the purelib otherwise. 91 | wheel.platlib = "false" 92 | 93 | # If CMake is less than this value, backport a copy of FindPython. Set to 0 94 | # disable this, or the empty string. 95 | backport.find-python = "3.26.1" 96 | 97 | # Select the editable mode to use. Can be "redirect" (default) or "inplace". 98 | editable.mode = "redirect" 99 | 100 | # Rebuild the project when the package is imported. The build-directory must be 101 | # set. 102 | editable.rebuild = false 103 | 104 | # If set, this will provide a method for scikit-build-core backward compatibility. 105 | minimum-version = "0.8.2" 106 | 107 | # The build directory. Defaults to a temporary directory, but can be set. 108 | build-dir = "build/{wheel_tag}" 109 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set({{ cookiecutter.module_name }}_SRCS 2 | itkMinimalStandardRandomVariateGenerator.cxx 3 | ) 4 | 5 | itk_module_add_library({{ cookiecutter.module_name }} ${{ '{' }}{{ cookiecutter.module_name }}_SRCS{{ '}' }}) 6 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/src/itkMinimalStandardRandomVariateGenerator.cxx: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | * 3 | * Copyright NumFOCUS 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0.txt 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | *=========================================================================*/ 18 | #include "itkMinimalStandardRandomVariateGenerator.h" 19 | 20 | namespace itk 21 | { 22 | namespace Statistics 23 | { 24 | 25 | MinimalStandardRandomVariateGenerator ::MinimalStandardRandomVariateGenerator() 26 | { 27 | this->m_NormalGenerator = NormalGeneratorType::New(); 28 | this->Initialize(1); 29 | } 30 | 31 | void 32 | MinimalStandardRandomVariateGenerator ::Initialize(int randomSeed) 33 | { 34 | this->m_NormalGenerator->Initialize(randomSeed); 35 | } 36 | 37 | 38 | double 39 | MinimalStandardRandomVariateGenerator ::GetVariate() 40 | { 41 | return this->m_NormalGenerator->GetVariate(); 42 | } 43 | 44 | 45 | void 46 | MinimalStandardRandomVariateGenerator ::PrintSelf(std::ostream & os, Indent indent) const 47 | { 48 | Superclass::PrintSelf(os, indent); 49 | } 50 | 51 | } // end namespace Statistics 52 | } // end namespace itk 53 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/test/Baseline/itk{{cookiecutter.filter_name}}TestOutput.mha.sha512: -------------------------------------------------------------------------------- 1 | 34cdd2aafce413dcf7efc692a707d53b7b57ebb006d0fbc20ecb42343f8a078b2252eff2137b17d3ab583d133f780438e247241ebf213c3289bd9ba1525081b7 2 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | itk_module_test() 2 | 3 | set({{ cookiecutter.module_name }}Tests 4 | itkMinimalStandardRandomVariateGeneratorTest.cxx 5 | itk{{ cookiecutter.filter_name }}Test.cxx 6 | ) 7 | 8 | CreateTestDriver({{ cookiecutter.module_name }} "${{ '{' }}{{ cookiecutter.module_name -}}-Test_LIBRARIES}" "${{ '{' }}{{ cookiecutter.module_name }}Tests}") 9 | 10 | itk_add_test(NAME itkMinimalStandardRandomVariateGeneratorTest 11 | COMMAND {{ cookiecutter.module_name }}TestDriver itkMinimalStandardRandomVariateGeneratorTest 12 | ) 13 | 14 | itk_add_test(NAME itk{{ cookiecutter.filter_name }}Test 15 | COMMAND {{ cookiecutter.module_name }}TestDriver 16 | --compare 17 | DATA{Baseline/itk{{ cookiecutter.filter_name }}TestOutput.mha} 18 | ${ITK_TEST_OUTPUT_DIR}/itk{{ cookiecutter.filter_name }}TestOutput.mha 19 | itk{{ cookiecutter.filter_name }}Test 20 | ${ITK_TEST_OUTPUT_DIR}/itk{{ cookiecutter.filter_name }}TestOutput.mha 21 | ) 22 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/test/itkMinimalStandardRandomVariateGeneratorTest.cxx: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | * 3 | * Copyright NumFOCUS 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0.txt 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | *=========================================================================*/ 18 | 19 | #include "itkMinimalStandardRandomVariateGenerator.h" 20 | 21 | #include "itkTestingMacros.h" 22 | #include "itkMath.h" 23 | 24 | int 25 | itkMinimalStandardRandomVariateGeneratorTest(int, char *[]) 26 | { 27 | typedef itk::Statistics::MinimalStandardRandomVariateGenerator GeneratorType; 28 | GeneratorType::Pointer generator = GeneratorType::New(); 29 | 30 | ITK_EXERCISE_BASIC_OBJECT_METHODS(generator, MinimalStandardRandomVariateGenerator, RandomVariateGeneratorBase); 31 | 32 | generator->Initialize(324); 33 | 34 | ITK_TEST_EXPECT_TRUE(itk::Math::FloatAlmostEqual(generator->GetVariate(), 1.35581, 4, 0.0001)); 35 | 36 | return EXIT_SUCCESS; 37 | } 38 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/test/itk{{cookiecutter.filter_name}}Test.cxx: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | * 3 | * Copyright NumFOCUS 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0.txt 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | *=========================================================================*/ 18 | 19 | #include "itk{{ cookiecutter.filter_name }}.h" 20 | 21 | #include "itkCommand.h" 22 | #include "itkImageFileWriter.h" 23 | #include "itkTestingMacros.h" 24 | 25 | namespace 26 | { 27 | class ShowProgress : public itk::Command 28 | { 29 | public: 30 | itkNewMacro(ShowProgress); 31 | 32 | void 33 | Execute(itk::Object * caller, const itk::EventObject & event) override 34 | { 35 | Execute((const itk::Object *)caller, event); 36 | } 37 | 38 | void 39 | Execute(const itk::Object * caller, const itk::EventObject & event) override 40 | { 41 | if (!itk::ProgressEvent().CheckEvent(&event)) 42 | { 43 | return; 44 | } 45 | const auto * processObject = dynamic_cast(caller); 46 | if (!processObject) 47 | { 48 | return; 49 | } 50 | std::cout << " " << processObject->GetProgress(); 51 | } 52 | }; 53 | } // namespace 54 | 55 | int 56 | itk{{ cookiecutter.filter_name }}Test(int argc, char * argv[]) 57 | { 58 | if (argc < 2) 59 | { 60 | std::cerr << "Missing parameters." << std::endl; 61 | std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv); 62 | std::cerr << " outputImage"; 63 | std::cerr << std::endl; 64 | return EXIT_FAILURE; 65 | } 66 | const char * outputImageFileName = argv[1]; 67 | 68 | constexpr unsigned int Dimension = 2; 69 | using PixelType = float; 70 | using ImageType = itk::Image; 71 | 72 | using FilterType = itk::{{ cookiecutter.filter_name }}; 73 | FilterType::Pointer filter = FilterType::New(); 74 | 75 | ITK_EXERCISE_BASIC_OBJECT_METHODS(filter, {{ cookiecutter.filter_name }}, ImageToImageFilter); 76 | 77 | // Create input image to avoid test dependencies. 78 | ImageType::SizeType size; 79 | size.Fill(128); 80 | ImageType::Pointer image = ImageType::New(); 81 | image->SetRegions(size); 82 | image->Allocate(); 83 | image->FillBuffer(1.1f); 84 | 85 | ShowProgress::Pointer showProgress = ShowProgress::New(); 86 | filter->AddObserver(itk::ProgressEvent(), showProgress); 87 | filter->SetInput(image); 88 | 89 | using WriterType = itk::ImageFileWriter; 90 | WriterType::Pointer writer = WriterType::New(); 91 | writer->SetFileName(outputImageFileName); 92 | writer->SetInput(filter->GetOutput()); 93 | writer->SetUseCompression(true); 94 | 95 | ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update()); 96 | 97 | 98 | std::cout << "Test finished." << std::endl; 99 | return EXIT_SUCCESS; 100 | } 101 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/wrapping/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | itk_wrap_module({{ cookiecutter.module_name }}) 2 | itk_auto_load_submodules() 3 | itk_end_wrap_module() 4 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/wrapping/itkMinimalStandardRandomVariateGenerator.wrap: -------------------------------------------------------------------------------- 1 | itk_wrap_simple_class("itk::Statistics::MinimalStandardRandomVariateGenerator" POINTER) 2 | -------------------------------------------------------------------------------- /{{cookiecutter.project_name}}/wrapping/itk{{cookiecutter.filter_name}}.wrap: -------------------------------------------------------------------------------- 1 | itk_wrap_class("itk::{{ cookiecutter.filter_name }}" POINTER) 2 | itk_wrap_image_filter("${WRAP_ITK_SCALAR}" 2) 3 | itk_end_wrap_class() 4 | 5 | --------------------------------------------------------------------------------