Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

All #3

Open
wants to merge 10,000 commits into
base: release-3.20
Choose a base branch
from
Open

Conversation

Marklovesmichelle69
Copy link

See the CONTRIBUTING guide. Specifically:

Start ITK commit messages with a standard prefix (and a space):

  • BUG: fix for runtime crash or incorrect result
  • COMP: compiler error or warning fix
  • DOC: documentation change
  • ENH: new functionality
  • PERF: performance improvement
  • STYLE: no logic impact (indentation, comments)
  • WIP: Work In Progress not ready for merge

Provide a short, meaningful message that describes the change you made.

When the PR is based on a single commit, the commit message is usually left as the PR message.

A reference to a related issue or pull request in your repository. You can automatically close a related issues using keywords

@mentions of the person or team responsible for reviewing proposed changes.

Thanks for contributing to ITK!

kwrobot pushed a commit that referenced this pull request Sep 6, 2018
cmake_minimum_required(VERSION 3.9.5 FATAL_ERROR)
foreach(p
    ## Only policies introduced after the cmake_minimum_required
    ## version need to explicitly be set to NEW.
    CMP0070 #3.10.0 Define ``file(GENERATE)`` behavior for relative paths.
    CMP0071 #3.10.0 Let ``AUTOMOC`` and ``AUTOUIC`` process ``GENERATED`` files.
    )
  if(POLICY ${p})
    cmake_policy(SET ${p} NEW)
  endif()
endforeach()

Change-Id: I30c9a4f2401bf83bcdb56ba89d44b24ca8342853
kwrobot pushed a commit that referenced this pull request Mar 4, 2021
…n metric

Fix uninitialized variable use in `ANTS` neighborhood correlation metric:
ensure that `fixedImageGradient` and `movingImageGradient` have valid
values before assigning them to the `scanMem` struct that scans over
images.

Fixes:
```
Run-Time Check Failure #3 - The variable 'fixedImageGradient' is being
used without being initialized.
```

The bug was affecting a number of tests in the
`ITKRegistrationMethodsv4Test` module.

Signaled at
https://open.cdash.org/viewTest.php?onlyfailed&buildid=7067466
and
https://open.cdash.org/viewTest.php?onlyfailed&buildid=7069241
kwrobot pushed a commit that referenced this pull request Apr 29, 2024
Found with thread sanitizer (TSan) running the `itkANTSNeighborhoodCorrelationImageToImageRegistrationTest` unit test.

There was already a `m_ANTSAssociateOnceFlag` flag for use with `std::call_once`, so I just used that in this place too (it's already used elsewhere).

Partial backtrace from TSan:

```
WARNING: ThreadSanitizer: data race (pid=79176)
  Write of size 8 at 0x000108f02240 by thread T2:
    #0 void itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution_impl<itk::ThreadedIndexedContainerPartitioner>(itk::IdentityHelper<itk::ThreadedIndexedContainerPartitioner>, itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx:118 (ITKMetricsv4TestDriver:arm64+0x1004bfe50)
    #1 itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution(itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h:235 (ITKMetricsv4TestDriver:arm64+0x1004bf9c0)
    #2 itk::DomainThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreaderCallback(void*) itkDomainThreader.hxx:123 (ITKMetricsv4TestDriver:arm64+0x100259b6c)
    #3 std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()::operator()() const itkThreadPool.h:92 (ITKMetricsv4TestDriver:arm64+0x1007d3228)
    #4 decltype(std::declval<void* (*&)(void*)>()(std::declval<itk::PoolMultiThreader::ThreadPoolInfoStruct*>())) std::__1::__invoke[abi:v160006]<std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()&>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&) invoke.h:394 (ITKMetricsv4TestDriver:arm64+0x1007d31a4)

  Previous write of size 8 at 0x000108f02240 by thread T14:
    #0 void itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution_impl<itk::ThreadedIndexedContainerPartitioner>(itk::IdentityHelper<itk::ThreadedIndexedContainerPartitioner>, itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx:118 (ITKMetricsv4TestDriver:arm64+0x1004bfe50)
    #1 itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution(itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h:235 (ITKMetricsv4TestDriver:arm64+0x1004bf9c0)
    #2 itk::DomainThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreaderCallback(void*) itkDomainThreader.hxx:123 (ITKMetricsv4TestDriver:arm64+0x100259b6c)
    #3 std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()::operator()() const itkThreadPool.h:92 (ITKMetricsv4TestDriver:arm64+0x1007d3228)
    #4 decltype(std::declval<void* (*&)(void*)>()(std::declval<itk::PoolMultiThreader::ThreadPoolInfoStruct*>())) std::__1::__invoke[abi:v160006]<std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()&>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&) invoke.h:394 (ITKMetricsv4TestDriver:arm64+0x1007d31a4)
```
kwrobot pushed a commit that referenced this pull request May 30, 2024
Found with thread sanitizer (TSan) running the `itkANTSNeighborhoodCorrelationImageToImageRegistrationTest` unit test.

There was already a `m_ANTSAssociateOnceFlag` flag for use with `std::call_once`, so I just used that in this place too (it's already used elsewhere).

Partial backtrace from TSan:

```
WARNING: ThreadSanitizer: data race (pid=79176)
  Write of size 8 at 0x000108f02240 by thread T2:
    #0 void itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution_impl<itk::ThreadedIndexedContainerPartitioner>(itk::IdentityHelper<itk::ThreadedIndexedContainerPartitioner>, itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx:118 (ITKMetricsv4TestDriver:arm64+0x1004bfe50)
    #1 itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution(itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h:235 (ITKMetricsv4TestDriver:arm64+0x1004bf9c0)
    #2 itk::DomainThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreaderCallback(void*) itkDomainThreader.hxx:123 (ITKMetricsv4TestDriver:arm64+0x100259b6c)
    #3 std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()::operator()() const itkThreadPool.h:92 (ITKMetricsv4TestDriver:arm64+0x1007d3228)
    #4 decltype(std::declval<void* (*&)(void*)>()(std::declval<itk::PoolMultiThreader::ThreadPoolInfoStruct*>())) std::__1::__invoke[abi:v160006]<std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()&>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&) invoke.h:394 (ITKMetricsv4TestDriver:arm64+0x1007d31a4)

  Previous write of size 8 at 0x000108f02240 by thread T14:
    #0 void itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution_impl<itk::ThreadedIndexedContainerPartitioner>(itk::IdentityHelper<itk::ThreadedIndexedContainerPartitioner>, itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx:118 (ITKMetricsv4TestDriver:arm64+0x1004bfe50)
    #1 itk::ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>, itk::ANTSNeighborhoodCorrelationImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreadedExecution(itk::Index<2u> const&, unsigned int) itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h:235 (ITKMetricsv4TestDriver:arm64+0x1004bf9c0)
    #2 itk::DomainThreader<itk::ThreadedIndexedContainerPartitioner, itk::ImageToImageMetricv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double, itk::DefaultImageToImageMetricTraitsv4<itk::Image<double, 2u>, itk::Image<double, 2u>, itk::Image<double, 2u>, double>>>::ThreaderCallback(void*) itkDomainThreader.hxx:123 (ITKMetricsv4TestDriver:arm64+0x100259b6c)
    #3 std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()::operator()() const itkThreadPool.h:92 (ITKMetricsv4TestDriver:arm64+0x1007d3228)
    #4 decltype(std::declval<void* (*&)(void*)>()(std::declval<itk::PoolMultiThreader::ThreadPoolInfoStruct*>())) std::__1::__invoke[abi:v160006]<std::__1::future<std::__1::invoke_result<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>::type> itk::ThreadPool::AddWork<void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&)::'lambda'()&>(void* (*&)(void*), itk::PoolMultiThreader::ThreadPoolInfoStruct*&&) invoke.h:394 (ITKMetricsv4TestDriver:arm64+0x1007d31a4)
```
N-Dekker and others added 26 commits November 21, 2024 08:09
- Follow-up to pull request #4964
commit 4926511
"STYLE: Replace `Pointer var; var = x` with `Pointer var = x`"

Triggered by a comment by Bradley Lowekamp at
#4964 (comment)
- Follow-up to pull request #4964
commit 677b761
"STYLE: Replace T::Pointer with auto when initializing variables by New()"

Triggered by a comment by Bradley Lowekamp at
#4964 (comment)
Using Notepad++, Replace in Files, doing:

    Find what: ^( [ ]+)([^ ][^=\r\n]*[Ii]terator[^=\r\n]*)([ ]+)(\w+[Ii]t);[\r\n]+\1\4\ =
    Replace with: $1$2$3$4 =
    Filters: itk*.* !+\test
    Directory: D:\src\ITK\Modules
    [v] Match case
    (*) Regular expression

- Follow-up to pull request #4964
commit 4926511
"STYLE: Replace `Pointer var; var = x` with `Pointer var = x`"
Small style improvement to the previous commit.

- Following pull request #3959
commit ef24b65
"STYLE: Construct local variables by passing arguments directly (part 2)",
11 March, 2023
This value is used for setting the publicly defined TIFFLIB_VERSION
macro. DCMTK uses this value.
For any ITK type `T`, `T::New()` does already initialize the object it returns.

Using Notepad++, Replace in Files, doing:

    Find what:  (\w+)([ ]+= .+::New\(\);)\r\n[\r\n]* [ ]+\1->Initialize\(\);
    Replace with:  $1$2
    Filters: itk*.* !+\test
    Directory: D:\src\ITK\Modules
    [v] Match case
    (*) Regular expression

Manually removed an obsolete comment saying `Clear elements`.
Code extracted from:

    https://github.com/libjpeg-turbo/libjpeg-turbo.git

at commit f29eda648547b36aa594c4116c7764a6c8a079b9 (3.0.4).
# By libjpeg-turbo Upstream
* upstream-jpeg-turbo:
  jpeg-turbo 2024-09-14 (f29eda64)
BUG: Set LIBTIFF_RELEASE_DATE in libtiff CMake configuration
DCMTK external project's configuration support forwarding ITK modules
properties, not cmake target properties. Update libtiff's ITK module
include properties to include the directory of the configuration
files. Remove unneeded includes.
ITK/Modules/Numerics/FEM/include/itkFEMImageMetricLoad.hxx:579:10: warning: variable 'chebycoefs0' set but not used [-Wunused-but-set-variable]
BUG: Update libtiff's ITK module include paths
Simplify the code by returning as soon as the condition is known to be
false.
Remove unnecessary "ok" temporary variable.
For most ITK types, `p->Initialize()` has no effect, directly after
`p = T::New()`, so the `Initialize()` call might as well be removed.

Excluded a `randomNumberGenerator->Initialize()` call from this commit, as that
call appears to actually have an effect (randomizing the seed).

- Follow-up to pull request #4972
commit 674b3d2
"STYLE: Remove `p->Initialize()` calls directly after `p = T::New()`"
- Follow-up to pull request #4972
commit 674b3d2
"STYLE: Remove `p->Initialize()` calls directly after `p = T::New()`"
Avoided GCC warnings about an implicitly-declared copy-constructor
[-Wdeprecated-copy].
Using Notepad++, Replace in Files, doing:

    Find what: ^( [ ]+)([^ ][^=\r\n]*)([ ]+)(\w+);[\r\n]+\1\4\ =
    Replace with: $1$2$3$4 =
    Filters: itk*.* !+\test
    Directory: D:\src\ITK\Modules
    [v] Match case
    (*) Regular expression

Excluded a few cases where the syntax `T var; var = x` appears intentional (in
ConceptChecking, ImageKmeansModelEstimator, MahalanobisDistanceThresholdImageFunction,
QuasiNewtonOptimizerv4Template, and VariableSizeMatrix).

- Following pull request #4970
commit 89b5bd0
"STYLE: Replace `Iterator it; it = x` with `Iterator it = x`"
and other similar commits for different types of variables.
Search for loop patterns for common locations
where indexes can be initialized rather than assigned.

regex:   \( *[ijrc] *= *0;
Finds and replaces integer literals which are cast to bool.

cd ${BLDDIR}
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-bool-literals  -header-filter=.* -fix
Move copying input to output to before threaded methods, to ensure
the operation has been completed before modifications.
Remove support for system installed versions of GDCM that are more than
10 years old.

This simplifies the codebase for code that has likely not been
explicitly tested in a very long time.
The emptiness of a container should be checked using the empty() method
instead of the size() method. It is not guaranteed that size() is a
constant-time function, and it is generally more efficient and also
shows clearer intent to use empty(). Furthermore some containers may
implement the empty() method but not implement the size() method. Using
empty() whenever possible makes it easier to switch to another container
in the future.

cd ${BLDDIR}
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,readability-container-size-empty  -header-filter=.* -fix
cmake 3.31 does an implicit conversion of paths like:
```
/myvenv/site-packages//itk --> /myvenv/site-packages/itk
                     ^^                             ^
```

which produces many warnings like:

```txt
ITKCommon: Creating itkAnatomicalOrientation submodule.
 CMake Warning (dev) at Wrapping/Generators/Python/CMakeLists.txt:88 (install):
   Policy CMP0177 is not set: install() DESTINATION paths are normalized.  Run
   "cmake --help-policy CMP0177" for policy details.  Use the cmake_policy
   command to set the policy and suppress this warning.
 Call Stack (most recent call first):
   Wrapping/Generators/Python/CMakeLists.txt:305 (wrap_itk_python_bindings_install)
   Wrapping/Generators/Python/CMakeLists.txt:380 (itk_setup_swig_python)
   Wrapping/macro_files/itk_auto_load_submodules.cmake:328 (itk_end_wrap_submodule_python)
   Wrapping/TypedefMacros.cmake:1331 (itk_auto_load_submodules)
   Modules/Core/Common/wrapping/CMakeLists.txt:63 (itk_auto_load_and_end_wrap_submodules)
```

Explicitly normalizing the path before calling the install command suppresses the message.
hjmjohnson and others added 30 commits December 16, 2024 16:55
Replace in Files, doing:

    Find what: ^( [ ]+)([^ ].*)[ ]+(\w+);[\r\n]+\1\3\.Fill\(
    Replace with: $1auto $3 = MakeFilled<$2>\(
    Filters: itk*.h;itk*.hxx;itk*.cxx
    Directory: D:\src\ITK\Modules
    [v] Match case
    (*) Regular expression
Changing variable to const caused windows builds
to fail.

error C2666: 'MetaImage::SequenceID': 2 overloads have similar conversions

Filtering\ImageFeature\include\itkZeroCrossingImageFilter.hxx(64): error C2668: 'itk::ImageRegion<3>::PadByRadius': ambiguous call to overloaded function
Core\Common\include\itkImageRegion.h(333): note: could be 'void itk::ImageRegion<3>::PadByRadius(const __int64 [])'
Core\Common\include\itkImageRegion.h(330): note: or       'void itk::ImageRegion<3>::PadByRadius(__int64)'
Filtering\ImageFeature\include\itkZeroCrossingImageFilter.hxx(64): note: while trying to match the argument list '(const itk::SizeValueType)'
Filtering\ImageFeature\include\itkZeroCrossingImageFilter.hxx(43): note: while compiling class template member function 'void itk::ZeroCrossingImageFilter<itk::Image<float,3>,itk::Image<float,3>>::GenerateInputRequestedRegion(void)'
Segmentation\LevelSets\include\itkSparseFieldLevelSetImageFilter.hxx(470): note: see reference to class template instantiation 'itk::ZeroCrossingImageFilter<itk::Image<float,3>,itk::Image<float,3>>' being compiled
Segmentation\LevelSets\include\itkSparseFieldLevelSetImageFilter.hxx(454): note: while compiling class template member function 'void itk::SparseFieldLevelSetImageFilter<TInputImage,TOutputImage>::CopyInputToOutput(void)'
Making variables const identified that the requestedRegion
was an unused variable.

Modules/Filtering/ImageGrid/test/itkCropImageFilterTest.cxx:82:31:
  warning: unused variable 'requestedRegion' [-Wunused-variable]

Expanded the testing to ensure that all 3 cropped regions
are updated to the same size & index values.
The ivar m_Factor was a constant that did not require
state to be saved.  The computation can be done at
compile time, thus saving runtime computations.

Move m_Factor from an ivar to a constexpr in the one place
it is used.
Use if constexpr to limit the compilation of code in
cases where array index access would fall outside
data structures in cases that should never be used.

Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx:138:83:
warning: array index 2 is past the end of the array (that has type 'ScalarValueType[2]' (aka 'float[2]')) [-Warray-bounds]
  138 |       (gd->m_dx[i0] * gd->m_dx[i0] + gd->m_dx[i1] * gd->m_dx[i1] + gd->m_dx[i2] * gd->m_dx[i2]);
      |

Instrumenting with [[maybe_unused]] to suppress
Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx:119:82:
warning: parameter 'gd' set but not used [-Wunused-but-set-parameter]
To demonstrate that this is an active project with a large community.
We want the same behavior as SetOutputParametersFromImage.

Without this, a crash occurs on Update().
Implements detection of local variables which could be declared as const but
are not. Declaring variables as const is recommended by many coding
guidelines, such as: ES.25 from the C++ Core Guidelines.

cd ${BLDDIR}
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,misc-const-correctness -header-filter=.* -fix
IDE can identify these cases, but code changes are implemented manually

REPLACE: (^ *)const *([a-zA-Z0-9_:]* [0-9a-zA-Z_]* = *[\+\-e0-9\.]+;)
   WITH: $1constexpr $2

REPLACE: (^ *)const (\w* \w*\{\}\;)
   WITH: $1constexpr $2
If statement with compile-time constant can be
replaced with "if constexpr"
The test for epsilon > 0 is always true because
epsilon is a constexpr greater than 0.
[CTest: warning matched] /Users/builder/externalModules/Filtering/ImageCompare/test/itkSimilarityIndexImageFilterTest.cxx:63:18:
warning: result of comparison of 0 <= unsigned expression is always true [-Wtautological-unsigned-zero-compare]
   63 |       if (lower1 <= count && count <= upper1)
      |           ~~~~~~ ^  ~~~~~
[CTest: warning suppressed] 1 warning generated.
Windows build failed when making an unused variable constexpr.
Modules\Core\Common\test\itkVectorContainerTest.cxx(54): error C2127:
'p_null': illegal initialization of 'constexpr' entity with a
non-constant expression

Remove the unused variable to avoid the problem.
This is a follow-up to commit 4cbe24c,
PR #5030: #5030

The error message was:

FAILED: Wrapping/Generators/Python/itk/ITKCommon-6.0.dll lib/ITKCommon-6.0.lib
C:\Windows\system32\cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --msvc-ver=1929 --intdir=Modules\Core\Common\src\CMakeFiles\ITKCommon.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~2\2019\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\ITKCommon.rsp  /out:Wrapping\Generators\Python\itk\ITKCommon-6.0.dll /implib:lib\ITKCommon-6.0.lib /pdb:Wrapping\Generators\Python\itk\ITKCommon-6.0.pdb /dll /version:1.0 /machine:x64  /INCREMENTAL:NO && cd ."
LINK: command "C:\PROGRA~2\MICROS~2\2019\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\ITKCommon.rsp /out:Wrapping\Generators\Python\itk\ITKCommon-6.0.dll /implib:lib\ITKCommon-6.0.lib /pdb:Wrapping\Generators\Python\itk\ITKCommon-6.0.pdb /dll /version:1.0 /machine:x64 /INCREMENTAL:NO /MANIFEST:EMBED,ID=2" failed (exit code 1104) with the following output:
LINK : fatal error LNK1104: cannot open file 'python311.lib'

Closes #5075.
Using float space precision is not supported with wrapping python.
The python wrapping assumes a limited number of types, and those
types would need to be aliased for supporting float space
continuous indexes (and other types)
Need to match precision for types used to allow building.
In a few cases double precision was assumed for values
related to spacing precision.
Tested by means of `CheckConstexprBeginAndEndOfContainer()`. Note that these
default-constructors were already `constexpr` _implicitly_, as implied by
`= default`, when `ITK_FUTURE_LEGACY_REMOVE` would be enabled.

Used the expression `Superclass(Superclass())` as a workaround for a compiler
bug from GCC 9.4.0, causing warnings like:

  In file included from itkNumericTraitsTest.cxx:42:
  itkNumericTraitsRGBPixel.h: In function 'CheckVariableLengthArrayTraits(const T&) [with T = itk::RGBPixel<char>]':
  itkNumericTraitsRGBPixel.h:118:17: warning: '<anonymous>' may be used uninitialized in this function [-Wmaybe-uninitialized]
Core/Transform/test/itkTransformTest.cxx:224:46: error:
default initialization of an object of const type 'const
itk::itkTransformTestHelpers::TransformTester<double, 3,
3>::InputSymmetricSecondRankTensorType' (aka 'const
SymmetricSecondRankTensor<double, 3U>') without a user-provided default
constructor const InputSymmetricSecondRankTensorType ssrten;
                                                     ^
                                                     {}
Hide additional HDF5 cmake variables by marking them as internal and
prevent deeper CMake files from force setting otherwise.
COMP: Address non-const operations when TBB enabled in test
The behavior of setting individual m_ShrinkFactor elements
should be the same as setting from an array of shrinkFactors.
BUG: GenerateImageSource sets Size from ReferenceImage
Replace non-portable "long" type with "int".
…ageMetric

Weights caching is used for derivative calculation to reduce registration time with BSplineTransforms. Currently only implemented for MeanSquaresImageToImageMetric, other metrics to be added at a later date.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet