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

Simplify use of NonZeroJacobianIndices in Common/itkCompute*.hxx, let SampleFixedImageForJacobianTerms() return std::vector, etc #1275

Merged
merged 10 commits into from
Dec 5, 2024

Conversation

N-Dekker
Copy link
Member

@N-Dekker N-Dekker commented Dec 5, 2024

No description provided.

Removed assignment to data members from its default-constructor. Removed duplicated `this->m_FixedImageMask = nullptr` statement.

Following C++ Core Guidelines, Oct 3, 2024, "Prefer initialization to assignment in constructors", http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-initialize
Removed `this->` when ComputeDisplacementDistribution directly accesses its own data.

Also replaced this->m_ScaledCostFunction with Superclass::m_ScaledCostFunction, to make clearer where that data member is from.
`NonZeroJacobianIndicesType` has always been defined as `std::vector` of integers, in itkAdvancedTransform.h, looking at commit 3b50076 (27 Oct 2008), so it's not necessary to manually zero-initialize its elements.
Removed unnecessary `if (region != m_FixedImageRegion)` checks.
Removed unnecessary `bandcov.set_size(0, 0)` call.

Following C++ Core Guidelines, Oct 3, 2024, Keep scopes small https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-scope
Each of these local typedefs is only used once.
`std::vector<ImageSampleType>` is in general more efficient than
`ImageSampleContainerType::Pointer` (which managers an `itk::VectorContainer`,
which has an `std::vector<ImageSampleType>` inside).
@N-Dekker N-Dekker merged commit d3a9a86 into main Dec 5, 2024
7 of 8 checks passed
@N-Dekker N-Dekker deleted the NonZeroJacobianIndicesType branch December 5, 2024 17:35
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.

1 participant