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)
```
hjmjohnson and others added 26 commits November 22, 2024 10:43
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.
Don't use imported CMath::CMath target, use raw library to avoid
having to export library in ITK.
COMP: itktiff - Use raw math library
BUG: Address race condition with threaded copying input to output
Aims to make template parameter names for coordinate types clearer.

Following the ITKSoftwareGuide/CodingStyleGuide guideline on Naming Conventions,
saying, "Names are generally spelled out; use of abbreviations is discouraged".
Multiple declarations in a single statement reduces readability.

Detect local variable declaration statements and update to have only one
statement per declaration.

The clang-tidy readability-isolate-declaration check with fix options automatically
identified these changes.
Addresses warning about undefined GDCM_MAJOR_VERSION.
COMP: Move GDCM version check to cxx file
Code extracted from:

    https://github.com/Kitware/MetaIO.git

at commit 56c9257467fa901e51e67ca5934711869ed84e49 (master).
# By MetaIO Maintainers
* upstream-MetaIO:
  MetaIO 2024-11-29 (56c92574)
"CoordinateType" appears more readable than "CoordRepType".

Using Notepad++, Replace in Files, doing:

    Find what: ( [ ]+)using CoordRepType = (\w+);
    Replace with: $1using CoordinateType = $2;\r\n$1using CoordRepType = CoordinateType;
    Filters: itk*.h
    Directory: D:\src\ITK\Modules
    [v] Match case
    (*) Regular expression

Manually excluded "itkQuadEdgeMeshEulerOperatorsTestHelper.h", as it only
declares `CoordRepType` locally inside a function.

- Follow-up to pull request #4995
commit c1d9ff5
"STYLE: Rename `TCoordRep` template parameters to `TCoordinate`"
hjmjohnson and others added 30 commits December 17, 2024 19:21
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.
Declare variables when they can be initialized immediately.

Localize loop variable initialization using regex to find common
patterns to minimize:

REPLACE: (^\s*)([a-z]*) ([a-z])\;\n(\s*)for \(\3 \= ([0-9]+)\;
   WITH: $4for ($2 $3= $5;

SEARCH:  for \([a-zA-Z]+ =
         Manually review and replace loop indicies
When the state of an object changes through a
Set##membervar( T value) function, the object
must have this->Modified() called to indicate
that it needs to be re-run.

A few Set##membervar functions were missing
the this->Modified() call.

There was a lot of code that was the same
across many of these Set##membervar functions.
The common code was converted to a template
function to remove redundancy.

The template function variant of the code
was simplified to perform the element-wise
sameness check, setting a flag to indicate
a change of state, and return true/false
to indicate state change allows for reduced
code redundancy.
The SpatialObjectToImageFilter::SetSpacing has a specialized behavior
when zeros are passed for the spacing size.

It is unclear what the intended behavior is.

Expanded the test suite to demonstrate that sending all zeros as the
spacing values to update results in no changes to the state of
itkSpatialObjectToImageFilter, but does trigger a Modified status on the
Object.
Non-positive spacing values are not allowed.  Make
the SpatialObjectToImage filter behave the same
way as itkImageBase when attempting to set a
non-positive spacing value.
C++11 Range based for loops can be used in

Used as a more readable equivalent to the traditional for loop operating over a
range of values, such as all elements in a container, in the forward direction..

Range based loops are more explicit for only computing the
end location once for containers.

Changed variable names for modified loops.
Prefer auto (or const auto) to explicit type designation.
Find and remove redundant void argument lists.
…ant-void

STYLE: Remove redundant void argument lists
The check flags insertions to an STL-style container done by calling the
push_back method with an explicitly-constructed temporary of the container
element type. In this case, the corresponding emplace_back method results in
less verbose and potentially more efficient code.
Describe function overrides using the override keyword from C++11.

-----
https://stackoverflow.com/questions/39932391/virtual-override-or-both-c
When you override a function you don't technically need to write either virtual
or override.

The original base class declaration needs the keyword virtual to mark it as
virtual.

In the derived class the function is virtual by way of having the ¹same type as
the base class function.

However, an override can help avoid bugs by producing a compilation error when
the intended override isn't technically an override. For instance, the function
type isn't exactly like the base class function. Or that a maintenance of the
base class changes that function's type, e.g. adding a defaulted argument.

In the same way, a virtual keyword in the derived class can make such a bug
more subtle by ensuring that the function is still virtual in the further
derived classes.

So the general advice is,

Use virtual for the base class function declaration.  This is technically
necessary.

Use override (only) for a derived class' override.  This helps maintenance.
-----

Remove 'virtual' is implied when 'override' is specified, so remove the
redundant specification.

cd ${BLDDIR}
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-override  -header-filter=.* -fix
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
The variable name s was used as an input and a loop variable.
Split the names to clearly indicate the iteration variable
intent.
Replaces explicit calls to the constructor in a return with a braced
initializer list. This way the return type is not needlessly duplicated in the
function definition and the return statement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.