diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ad69e1866d4..58f94eee456 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,49 @@ # .pre-commit-config.yaml # for details see https://pre-commit.com -# -# No hooks are configured on this branch. This empty file prevents -# pre-commit from erroring when backporting commits after pre-commit -# hooks have been configured. - -repos: [] +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-added-large-files + args: ['--maxkb=200'] + exclude: | + ( + Source/DataDictionary/gdcmPrivateDefaultDicts.cxx| + Documentation/watershed.ps + ) + - id: check-ast + exclude: "\\/ThirdParty\\/" + - id: check-case-conflict + - id: check-illegal-windows-names + - id: check-json + exclude: "\\/ThirdParty\\/" + - id: check-merge-conflict + exclude: "\\/ThirdParty\\/" + args: ['--assume-in-merge'] + - id: check-toml + exclude: "\\/ThirdParty\\/" + - id: check-vcs-permalinks + exclude: "\\/ThirdParty\\/" + - id: check-xml + exclude: "\\/ThirdParty\\/" + - id: check-yaml + exclude: "\\/ThirdParty\\/" + - id: check-shebang-scripts-are-executable + exclude: "\\/ThirdParty\\/" + - id: debug-statements + exclude: "\\/ThirdParty\\/" + - id: destroyed-symlinks + - id: detect-private-key + - id: end-of-file-fixer + exclude: "\\.(md5|sha|sha512|svg|vtk|vtp)$|^Resources\\/[^\\/]+\\.h$|\\/ColorFiles\\/.+\\.txt$|Data\\/Input\\/.+$|\\/ThirdParty\\/|\\/Data\\/" + - id: forbid-new-submodules + - id: forbid-submodules + - id: mixed-line-ending + exclude: "\\.(sha|sha512|svg|vtk|vtp)$|\\/ThirdParty\\/|\\/Data\\/" + - id: name-tests-test + exclude: "\\/ThirdParty\\/" + args: ['--pytest-test-first'] + - id: no-commit-to-branch + args: ['--branch','dashboard','--branch','python-builds','--branch','release','--branch','hooks','--branch', 'main','--branch','main','--pattern','release-*'] + - id: trailing-whitespace + exclude: "\\.(sha|sha512|svg|vtk|vtp)$|\\/ThirdParty\\/|\\/Data\\/" diff --git a/CMake/ITKSetStandardCompilerFlags.cmake b/CMake/ITKSetStandardCompilerFlags.cmake index 1ec759839e9..56258bde7ef 100644 --- a/CMake/ITKSetStandardCompilerFlags.cmake +++ b/CMake/ITKSetStandardCompilerFlags.cmake @@ -229,7 +229,7 @@ function(check_avx_flags avx_flags_var) endfunction() # Check for the presence of SSE2. -# Adapted from the AVX check and https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/ThirdParty/VNL/src/vxl/config/cmake/config/vxl_platform_tests.cxx#L164-L178 +# Adapted from the AVX check and https://github.com/InsightSoftwareConsortium/ITK/blob/e7db79dca282ce8001e9456d1e5b51fe31de48c5/Modules/ThirdParty/VNL/src/vxl/config/cmake/config/vxl_platform_tests.cxx#L164-L178 function(check_sse2_flags sse2_flags_var) # set flags to be used in check_cxx_source_runs below diff --git a/Documentation/Doxygen/ImageSimilarityMetrics.dox b/Documentation/Doxygen/ImageSimilarityMetrics.dox index fdbe93e9b26..8a7ccaaabcf 100644 --- a/Documentation/Doxygen/ImageSimilarityMetrics.dox +++ b/Documentation/Doxygen/ImageSimilarityMetrics.dox @@ -1,8 +1,8 @@ /** \page ImageSimilarityMetricsPage Image Similarity Metrics - -\section MetricsIntroduction Introduction + +\section MetricsIntroduction Introduction It is a common task in image analysis to require to compare how similar two image might be. This comparison may be limited to a @@ -23,7 +23,7 @@ in a toolkit. You need a set of them because none is able to perform the same job as the other. The following table presents a comparison between image similarity -metrics. This is by no means an exhaustive comparison but will at +metrics. This is by no means an exhaustive comparison but will at least provide some guidance as to what metric can be appropiated for particular problems. diff --git a/Documentation/Doxygen/Iterators.dox b/Documentation/Doxygen/Iterators.dox index 247509ad542..58584edb32a 100644 --- a/Documentation/Doxygen/Iterators.dox +++ b/Documentation/Doxygen/Iterators.dox @@ -298,4 +298,3 @@ */ - diff --git a/Documentation/Doxygen/MainPage.dox b/Documentation/Doxygen/MainPage.dox index bbf7951c038..3420974b636 100644 --- a/Documentation/Doxygen/MainPage.dox +++ b/Documentation/Doxygen/MainPage.dox @@ -37,4 +37,3 @@ * iterators. * */ - diff --git a/Documentation/Doxygen/NeighborhoodIterators.dox b/Documentation/Doxygen/NeighborhoodIterators.dox index 9e1394e0d8e..82a46ea056f 100644 --- a/Documentation/Doxygen/NeighborhoodIterators.dox +++ b/Documentation/Doxygen/NeighborhoodIterators.dox @@ -5,7 +5,7 @@ This document provides a general overview of the intended use of the NeighborhoodIterator classes and their associated objects for low-level image processing in Itk. For a more detailed description of the API, please refer to -the inline Itk documentation and manual. +the inline Itk documentation and manual. \par Neighborhood iterators are the abstraction of the concept of \em locality in @@ -25,16 +25,16 @@ This code in classical \em texbook notation can look like: int nx = 512; int ny = 512; ImageType image(nx,ny); - for(int x=1; xGetRequestedRegion()); 15 ImageIterator out(output_image, output_image->GetRequestedRegion()); 16 @@ -86,32 +86,32 @@ have been omitted for clarity. ) 19 { 20 float accum = 0.0; 21 for (unsigned int i = 0; i < it.Size(); ++i) -22 { -23 accum += it.GetPixel(i); +22 { +23 accum += it.GetPixel(i); 24 } 25 out.Set(accum/(float)(it.Size())); 26 } \endcode -\par +\par Note that the computational work is confined to lines 18-26. The code is also completely generalized for multiple dimensions. For example, changing line 1 to: \code 1 using ImageType = itk::Image; \endcode -produces an averaging filter for five-dimensional images. +produces an averaging filter for five-dimensional images. \par The values in the neighborhood are dereferenced through the GetPixel(n) method -of the iterator. Think of the iterator as a C array, storing neighborhood +of the iterator. Think of the iterator as a C array, storing neighborhood values in the same order that they are stored in the image, with the lowest dimension as the fastest increasing dimension. \section OperatorsOperationsSection Neighborhood operators and operations NeighborhoodOperators are container classes for generating and storing computational kernels such as LaPlacian, Gaussian, derivative, and -morphological operators. They provide a generalized interface for creation and +morphological operators. They provide a generalized interface for creation and access of the operator coefficients. \par @@ -129,7 +129,7 @@ demonstrates this concept. 4 NeighborhoodInnerProduct IP; 5 6 out = out.Begin(); -7 for (it.SetToBegin(); it != it.End(); ++it, ++out) +7 for (it.SetToBegin(); it != it.End(); ++it, ++out) 8 { 9 out.Set( IP( it, OP) ); 10 } @@ -144,7 +144,7 @@ operator/operation model. The mean calculation above is one example. A 1 NeighborhoodIterator::RadiusType radius = {1, 0, 0}; 2 NeighborhoodIterator it(radius, inputImage, regionToProcess) 3 ImageRegionIterator out( outputImage, regionToProcess ); -4 for (it.SetToBegin(); it != it.End(); ++it, ++out) +4 for (it.SetToBegin(); it != it.End(); ++it, ++out) 5 { 6 out.Set( it.GetPixel(3) - it.GetPixel(2) ); 7 } @@ -155,7 +155,7 @@ In this example the neighborhood is defined as a three pixel strip with width along only the first axis. Mapping the spatial orientation of neighborhood pixels to the array location is the responsibility of the code writer. Some methods such as GetStride(n), which -returns the stride length in pixels along an axis n, have been provided to help +returns the stride length in pixels along an axis n, have been provided to help in coding algorithms for arbitrary dimensionality. The index of the center pixel in a neighborhood is always Size()/2. @@ -171,17 +171,17 @@ is appropriate for their algorithm. \par A SmartNeighborhoodIterator can be used in place of NeighborhoodIterator to iterate over an entire image region, but it will incur a penalty on -performance. For this reason, it is desirable to process the image differently +performance. For this reason, it is desirable to process the image differently over distinct boundary and non-boundary regions. Itk's definition of image regions makes this easy to manage. The process is as follows: first apply the algorithm over all neighborhoods not on the image boundary using the fast NeighborhoodIterator, then process each region on the boundary using the -SmartNeighborhoodIterator. The size of the boundary regions are defined by the +SmartNeighborhoodIterator. The size of the boundary regions are defined by the radius of the neighborhood that you are using. \par Rewriting the inner product code using this approach looks like the following. -(Here we are using the default SmartNeighborhoodIterator boundary condition and +(Here we are using the default SmartNeighborhoodIterator boundary condition and omitting some template parameters for simplicity.) \code @@ -205,7 +205,7 @@ out = ImageIterator(outputImage, *regions_iterator); NeighborhoodIterator it (OP.GetRadius(), inputImage, *regions_iterator); NeighborhoodInnerProduct IP; out = out.Begin(); -for (it.SetToBegin(); it != it.End(); ++it, ++out) +for (it.SetToBegin(); it != it.End(); ++it, ++out) { out.Set( IP( it, OP) ); } @@ -219,7 +219,7 @@ for (regions_iterator++ ; regions_iterator != regions.end(); regions_iterator++) { out = ImageIterator(outputImage, *regions_iterator); sit = SmartNeighborhoodIterator(OP.GetRadius(), inputImage, *regions_iterator); - for (sit.SetToBegin(); sit != sit.End(); ++sit, ++out) + for (sit.SetToBegin(); sit != sit.End(); ++sit, ++out) { out.Set( SIP( sit, OP) ); } @@ -242,7 +242,7 @@ AnisotropicDiffusionFunctions and the morphological image filters. itk::WatershedSegmenter also makes extensive use of the neighborhood iterators. -\par +\par The best documentation of the API for these objects is are the class definitions themselves, since the API is subject to change as the toolkit matures and is refined. diff --git a/Documentation/Doxygen/Registration.dox b/Documentation/Doxygen/Registration.dox index 53f8028fac7..cf5a8cdd6d1 100644 --- a/Documentation/Doxygen/Registration.dox +++ b/Documentation/Doxygen/Registration.dox @@ -1,10 +1,10 @@ /** \page RegistrationPage Registration Techniques - -\section RegistrationIntroduction Introduction -\b Registration is a technique aimed to align two objects using a +\section RegistrationIntroduction Introduction + +\b Registration is a technique aimed to align two objects using a particular transformation. A typical example of registration is to have two medical images @@ -15,7 +15,7 @@ a spatial transformation to find the corresponding pixel from one image into the other. Another typical example of registration is to have a geometrical model -of an organ, let's say a bone. This model can be used to find the +of an organ, let's say a bone. This model can be used to find the corresponding structure in a medical image. In this case, a spatial transformation is needed to find the correct location of the structure in the image. @@ -23,7 +23,7 @@ in the image. \section RegistrationFramework ITK Registration Framework -The Insight Toolkit takes full advantage of the power provided by +The Insight Toolkit takes full advantage of the power provided by generic programming. Thanks to that, it have been possible to create an abstraction of the particular problems that the toolkit is intended to solve. @@ -105,6 +105,6 @@ The evaluation of a metric can be very expensive in computing time. An approach It is usual to create first a sequence of reduced resolution version of the objects, this set of objects is called a pryramid representation . A Multiresolution method is basically a set of consecutive registration process, each one performed at a particular level of the pyramid, and using as initial transform the resulting transform of the previous process. -Multiresolution offers the double advantage of increasing performance and at the same time improving the stability of the optimization by smoothing out local minima and increasing the capture region of the process. +Multiresolution offers the double advantage of increasing performance and at the same time improving the stability of the optimization by smoothing out local minima and increasing the capture region of the process. */ diff --git a/Documentation/Doxygen/Streaming.dox b/Documentation/Doxygen/Streaming.dox index 4c13a1cf3ed..4d29de4100b 100644 --- a/Documentation/Doxygen/Streaming.dox +++ b/Documentation/Doxygen/Streaming.dox @@ -2,7 +2,7 @@ \page StreamingPage Streaming \section StreamingIntroduction Introduction - + \image html Streaming.gif "Pipelines can be set up to stream data through filters in small pieces." diff --git a/Documentation/Doxygen/Threading.dox b/Documentation/Doxygen/Threading.dox index 113a16dcbe1..6b60ec32511 100644 --- a/Documentation/Doxygen/Threading.dox +++ b/Documentation/Doxygen/Threading.dox @@ -2,7 +2,7 @@ \page ThreadingPage Threading \section ThreadingIntroduction Introduction - + ITK is designed to run in multiprocessor environments. Many of ITK's filters are multithreaded. When a multithreading filter executes, it automatically divides the work amongst multiprocessors @@ -15,7 +15,7 @@ \image html Threading.gif "Filters may process their data in multiple threads in a shared memory configuration." \section FilterThreadSafety Filter Level Multithreading - + A multithreaded filter provides an implementation of the ThreadedGenerateData() method (see itk::ImageSource::ThreadedGenerateData()) as opposed to the @@ -41,7 +41,7 @@ the threads write to this same block of memory but a given thread is only allowed to set specific pixels. - \subsection FilterMemoryAllocation Memory Management + \subsection FilterMemoryAllocation Memory Management The GenerateData() method is responsible for allocation the output bulk data. For an image processing filter, this corresponds to @@ -76,10 +76,10 @@ ITK is designed so that different instances of the same class can be accessed in different execution threads. But multiple threads should - not attempt to modify a single instance. This granularity of thread + not attempt to modify a single instance. This granularity of thread safety was chosen as a compromise between performance and flexibility. If we allow ITK objects to be modified in multiple threads then ITK - would have to mutex every access to every instance variable of a + would have to mutex every access to every instance variable of a class. This would severely affect performance. \section NumericsThreadSafety Thread Safety in the Numerics Library diff --git a/Documentation/docs/_static/icon/html_head_content.txt b/Documentation/docs/_static/icon/html_head_content.txt index 63b9f2077dc..f847964afda 100644 --- a/Documentation/docs/_static/icon/html_head_content.txt +++ b/Documentation/docs/_static/icon/html_head_content.txt @@ -6,4 +6,4 @@ - \ No newline at end of file + diff --git a/Documentation/docs/releases/5.2.md b/Documentation/docs/releases/5.2.md index 3f635879660..1228d0fd3df 100644 --- a/Documentation/docs/releases/5.2.md +++ b/Documentation/docs/releases/5.2.md @@ -1801,4 +1801,3 @@ Remote Module Changes Since v5.2rc03 #### Style Changes - Move notebooks into examples/ directory directly ([d8ebede](https://github.com/KitwareMedical/ITKUltrasound/commit/d8ebede)) - diff --git a/Documentation/docs/releases/5.4.0.md b/Documentation/docs/releases/5.4.0.md index 1ec9b091b88..27d7e7bf485 100644 --- a/Documentation/docs/releases/5.4.0.md +++ b/Documentation/docs/releases/5.4.0.md @@ -136,7 +136,7 @@ Unpack optional testing data in the same directory where the Library Source is u - Add `itk::Copy(const T & original)`, which simply returns a copy - Make `itk::ImageRegion` trivially copyable, remove inheritance (FUTURE) - `itk::VTKPolyDataMeshIO` support for reading VTK 5.1 format -- Add `ITK_DEFAULT_COPY_AND_MOVE(TypeName)` macro definition +- Add `ITK_DEFAULT_COPY_AND_MOVE(TypeName)` macro definition - Replace `(const std::string)` casts with C++17 `std::string_view` - Replace SetSize/Index calls in tests with `region{ index, size }` - Optionally limit an `ImageMask` to a specific pixel value @@ -229,7 +229,7 @@ We extend our gratitude to all the ITK community members who have contributed to 🗣️ What's Next --------------- -ITK 5.4.0 represents a transformative milestone in our documentation journey. The finalization of 5.4.0 was delayed due to dependency issues in the example documentation's infrastructure. While these are addressed, we'll continue to refine the 5.4 series through patch releases. We're excited to eventually migrate the examples to a similar robust foundation in future innovations. +ITK 5.4.0 represents a transformative milestone in our documentation journey. The finalization of 5.4.0 was delayed due to dependency issues in the example documentation's infrastructure. While these are addressed, we'll continue to refine the 5.4 series through patch releases. We're excited to eventually migrate the examples to a similar robust foundation in future innovations. Looking ahead, we're thrilled to announce that ITK 6, our next major release, will showcase a substantial array of modernizations. The community has been hard at work implementing significant improvements that will elevate development with and on the toolkit. Watch for upcoming alpha and beta releases of ITK 6, which will run parallel to our 5.4 maintenance efforts. diff --git a/Documentation/docs/releases/5.4.2.md b/Documentation/docs/releases/5.4.2.md index 64cb36cf358..78f58642ae8 100644 --- a/Documentation/docs/releases/5.4.2.md +++ b/Documentation/docs/releases/5.4.2.md @@ -272,4 +272,3 @@ Remote Module Changes Since v5.4.0 #### Bug Fixes - Bump Python package version for re-deploy ([9f6654d](https://github.com/InsightSoftwareConsortium/ITKTotalVariation/commit/9f6654d)) - diff --git a/Documentation/docs/releases/5.4.5.md b/Documentation/docs/releases/5.4.5.md index 932a5a6b6b4..4acd2a06964 100644 --- a/Documentation/docs/releases/5.4.5.md +++ b/Documentation/docs/releases/5.4.5.md @@ -168,4 +168,3 @@ We remain dedicated to supporting current users through: #### Bug Fixes - Fix imread with single-element list and add test ([8480b5f6d3](https://github.com/InsightSoftwareConsortium/ITK/commit/8480b5f6d3)) - diff --git a/Modules/Nonunit/IntegratedTest/test/itkBasicFiltersHeaderObjCxxTest.mm b/Modules/Nonunit/IntegratedTest/test/itkBasicFiltersHeaderObjCxxTest.mm index 854dc406584..d01002996fe 100644 --- a/Modules/Nonunit/IntegratedTest/test/itkBasicFiltersHeaderObjCxxTest.mm +++ b/Modules/Nonunit/IntegratedTest/test/itkBasicFiltersHeaderObjCxxTest.mm @@ -16,5 +16,3 @@ * *=========================================================================*/ #import "itkBasicFiltersHeaderTest.cxx" - - diff --git a/Modules/Nonunit/IntegratedTest/test/itkCommonHeaderObjCxxTest.mm b/Modules/Nonunit/IntegratedTest/test/itkCommonHeaderObjCxxTest.mm index 7b4817e084f..d9fd1e6acc5 100644 --- a/Modules/Nonunit/IntegratedTest/test/itkCommonHeaderObjCxxTest.mm +++ b/Modules/Nonunit/IntegratedTest/test/itkCommonHeaderObjCxxTest.mm @@ -16,6 +16,3 @@ * *=========================================================================*/ #import "itkCommonHeaderTest.cxx" - - - diff --git a/Modules/Nonunit/IntegratedTest/wrapping/test/CMakeLists.txt b/Modules/Nonunit/IntegratedTest/wrapping/test/CMakeLists.txt index 8b137891791..e69de29bb2d 100644 --- a/Modules/Nonunit/IntegratedTest/wrapping/test/CMakeLists.txt +++ b/Modules/Nonunit/IntegratedTest/wrapping/test/CMakeLists.txt @@ -1 +0,0 @@ - diff --git a/Modules/Numerics/FEM/test/README b/Modules/Numerics/FEM/test/README index 57ed97a064a..01a8a19d647 100644 --- a/Modules/Numerics/FEM/test/README +++ b/Modules/Numerics/FEM/test/README @@ -27,4 +27,3 @@ Other Codes X - not applicable ? - partially complete - diff --git a/Utilities/Debugger/ITK.natvis b/Utilities/Debugger/ITK.natvis index ba055e5a29d..6bcb864c570 100644 --- a/Utilities/Debugger/ITK.natvis +++ b/Utilities/Debugger/ITK.natvis @@ -164,4 +164,4 @@ You can extend it by adding custom visualizations for more ITK types. If you do, please contribute: https://itk.org/Wiki/ITK/Git/Develop --> - \ No newline at end of file + diff --git a/Utilities/Maintenance/VCL_ModernizeNaming.py b/Utilities/Maintenance/VCL_ModernizeNaming.py old mode 100644 new mode 100755