Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions .hooks-config.bash

This file was deleted.

78 changes: 78 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# .pre-commit-config.yaml
# for details see https://pre-commit.com
# for list of available hooks see https://pre-commit.com/hooks.html
#
# Preclude commits that do not conform to various criteria.
#
# If a pre-commit check must be skipped then use: `SKIP=check_id git commit` Where `check_id` is the id of the check to
# be skipped such as `black`.

fail_fast: true
default_stages: [pre-commit]
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-json
- id: check-toml
- id: check-yaml
- id: check-shebang-scripts-are-executable
- 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
args: ['--pytest-test-first']
- id: trailing-whitespace
exclude: "\\.(sha|sha512|svg|vtk|vtp)$|\\/ThirdParty\\/|\\/Data\\/"
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.4
hooks:
- id: clang-format
args: ['--style=file']
files: '\.(c|cc|h|cxx|hxx)$'
exclude: "\\/ThirdParty\\/|\\/Data\\/"
- repo: https://github.com/psf/black
rev: 24.2.0
hooks: # check conformance to black formatting
- id: black
#args: ['--diff', '-v', '--target-version', 'py39' ] # if run without arguments, will fail and will format the files
args: ['--target-version', 'py39' ] # Allow black to fail and provide auto-formatting to files that need it for compliance
exclude: ".*build.*|\\/ThirdParty\\/|\\/Data\\/"
- repo: local
hooks:
- id: local-prepare-commit-msg
name: 'local prepare-commit-msg'
entry: 'Utilities/Hooks/prepare-commit-msg'
language: system
stages: [prepare-commit-msg]
- id: check-setup-for-development
name: 'Check version of SetupForDevelopment'
entry: 'Utilities/Hooks/check-setup-for-development'
language: system
stages: [pre-commit]
- id: local-pre-commit
name: 'local pre-commit'
entry: 'Utilities/Hooks/pre-commit'
language: system
stages: [pre-commit]
- id: kw-commit-msg
name: 'kw commit-msg'
entry: 'Utilities/Hooks/kw-commit-msg'
language: system
stages: [commit-msg]
- id: kw-pre-commit
name: 'kw-pre-commit'
entry: 'Utilities/Hooks/kw-pre-commit'
language: system
stages: [pre-commit]
23 changes: 0 additions & 23 deletions CMake/ITKClangFormatConfig.cmake.in

This file was deleted.

18 changes: 0 additions & 18 deletions CMake/ITKModuleClangFormat.cmake

This file was deleted.

1 change: 0 additions & 1 deletion CMake/ITKModuleMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ include(${_ITKModuleMacros_DIR}/ITKModuleAPI.cmake)
include(${_ITKModuleMacros_DIR}/ITKModuleDoxygen.cmake)
include(${_ITKModuleMacros_DIR}/ITKModuleHeaderTest.cmake)
include(${_ITKModuleMacros_DIR}/ITKModuleKWStyleTest.cmake)
include(${_ITKModuleMacros_DIR}/ITKModuleClangFormat.cmake)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@N-Dekker Ahh, with this commit, we will not be required to "know" about existence of clang-format. Except for use in IDEs, such as Visual Studio 😄

include(${_ITKModuleMacros_DIR}/CppcheckTargets.cmake)
include(${_ITKModuleMacros_DIR}/ITKModuleCPPCheckTest.cmake)
include(${_ITKModuleMacros_DIR}/ITKFactoryRegistration.cmake)
Expand Down
6 changes: 3 additions & 3 deletions Documentation/Doxygen/ImageSimilarityMetrics.dox
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.

Expand Down
1 change: 0 additions & 1 deletion Documentation/Doxygen/Iterators.dox
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,3 @@


*/

1 change: 0 additions & 1 deletion Documentation/Doxygen/MainPage.dox
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@
* iterators.
*
*/

42 changes: 21 additions & 21 deletions Documentation/Doxygen/NeighborhoodIterators.dox
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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; x<nx-1; x++)
for(int x=1; x<nx-1; x++)
{
float sum = 0;
for(int y=1; y<ny-1; y++)
for(int y=1; y<ny-1; y++)
{
sum += image(x-1,y-1) + image(x ,y-1) + image(x+1,y-1);
sum += image(x-1,y ) + image(x ,y ) + image(x+1,y );
sum += image(x-1,y+1) + image(x ,y+1) + image(x+1,y+1);
}
}
}
\endcode

\par
Expand All @@ -45,7 +45,7 @@ by using iterators to dereference pixels, and for a two-dimensional image,
code-readability may not suffer much. But what if we want code for three
or more dimensions? Before long, the code size and complexity will increase to
unmanageable levels. In Itk, we have encapsulated this functionality for
efficiency, readability, and reusability.
efficiency, readability, and reusability.

\section NeighborhoodIteratorsSection Neighborhood iterators
itk::Image neighborhood iteration and dereferencing is encapsulated in the
Expand Down Expand Up @@ -77,7 +77,7 @@ have been omitted for clarity. )
10 for (unsigned int i = 0; i < ImageType::ImageDimension; ++i) radius[i] = 1;
11
12 // Initializes the iterators on the input & output image regions
13 NeighborhoodIterator it(radius, input_image,
13 NeighborhoodIterator it(radius, input_image,
14 output_image->GetRequestedRegion());
15 ImageIterator out(output_image, output_image->GetRequestedRegion());
16
Expand All @@ -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<float, 5>;
\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
Expand All @@ -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 }
Expand All @@ -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 }
Expand All @@ -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.

Expand All @@ -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
Expand All @@ -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) );
}
Expand All @@ -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) );
}
Expand All @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions Documentation/Doxygen/Registration.dox
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,15 +15,15 @@ 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.


\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.
Expand Down Expand Up @@ -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 <em> pryramid representation </em>. 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.

*/
2 changes: 1 addition & 1 deletion Documentation/Doxygen/Streaming.dox
Original file line number Diff line number Diff line change
Expand Up @@ -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."


Expand Down
Loading