From 3dc2c47e46069c4ecb16c71bb0de0f651bc538f8 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 9 Apr 2024 15:12:24 +0200 Subject: [PATCH] STYLE: Remove ` == true` from Boolean expressions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to ITK pull request https://github.com/InsightSoftwareConsortium/ITK/pull/4502 commit https://github.com/InsightSoftwareConsortium/ITK/commit/e7a60b6ca764f1d19a69f20b61c311d700ff0105 Following C++ Core Guidelines, February 15, 2024, "Don’t add redundant `==` or `!=` to conditions", http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es87-dont-add-redundant--or--to-conditions --- .../itkStatisticalShapePointPenalty.hxx | 2 +- .../elxAdaptiveStochasticGradientDescent.hxx | 2 +- .../AdaptiveStochasticLBFGS/elxAdaptiveStochasticLBFGS.hxx | 4 ++-- .../elxAdaptiveStochasticVarianceReducedGradient.hxx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Components/Metrics/StatisticalShapePenalty/itkStatisticalShapePointPenalty.hxx b/Components/Metrics/StatisticalShapePenalty/itkStatisticalShapePointPenalty.hxx index eec04114e..d702df269 100644 --- a/Components/Metrics/StatisticalShapePenalty/itkStatisticalShapePointPenalty.hxx +++ b/Components/Metrics/StatisticalShapePenalty/itkStatisticalShapePointPenalty.hxx @@ -178,7 +178,7 @@ StatisticalShapePointPenalty::Initialize() } case 1: // decomposed covariance (uniform regularization) { - if (this->m_NormalizedShapeModel == true) + if (this->m_NormalizedShapeModel) { itkExceptionMacro("ShapeModelCalculation option 1 is only implemented for NormalizedShapeModel = false"); } diff --git a/Components/Optimizers/AdaptiveStochasticGradientDescent/elxAdaptiveStochasticGradientDescent.hxx b/Components/Optimizers/AdaptiveStochasticGradientDescent/elxAdaptiveStochasticGradientDescent.hxx index 4554da926..c943d5f6b 100644 --- a/Components/Optimizers/AdaptiveStochasticGradientDescent/elxAdaptiveStochasticGradientDescent.hxx +++ b/Components/Optimizers/AdaptiveStochasticGradientDescent/elxAdaptiveStochasticGradientDescent.hxx @@ -719,7 +719,7 @@ AdaptiveStochasticGradientDescent::AutomaticParameterEstimationUsingDi configuration.ReadParameter(this->m_UseNoiseCompensation, "NoiseCompensation", this->GetComponentLabel(), 0, 0); /** Use noise compensation factor or not. */ - if (this->m_UseNoiseCompensation == true) + if (this->m_UseNoiseCompensation) { double sigma4 = 0.0; double gg = 0.0; diff --git a/Components/Optimizers/AdaptiveStochasticLBFGS/elxAdaptiveStochasticLBFGS.hxx b/Components/Optimizers/AdaptiveStochasticLBFGS/elxAdaptiveStochasticLBFGS.hxx index 989de95b9..e4647ed82 100644 --- a/Components/Optimizers/AdaptiveStochasticLBFGS/elxAdaptiveStochasticLBFGS.hxx +++ b/Components/Optimizers/AdaptiveStochasticLBFGS/elxAdaptiveStochasticLBFGS.hxx @@ -1124,7 +1124,7 @@ AdaptiveStochasticLBFGS::AutomaticParameterEstimationUsingDisplacement configuration.ReadParameter(this->m_UseNoiseCompensation, "NoiseCompensation", this->GetComponentLabel(), 0, 0); /** Use noise Compensation factor or not. */ - if (this->m_UseNoiseCompensation == true) + if (this->m_UseNoiseCompensation) { double sigma4 = 0.0; double gg = 0.0; @@ -1231,7 +1231,7 @@ AdaptiveStochasticLBFGS::AutomaticLBFGSStepsizeEstimation() configuration.ReadParameter(this->m_UseNoiseCompensation, "NoiseCompensation", this->GetComponentLabel(), 0, 0); /** Use noise Compensation factor or not. */ - if (this->m_UseNoiseCompensation == true) + if (this->m_UseNoiseCompensation) { /** This use the time t_k = 0. */ a = delta * std::pow(A + 1.0, alpha) / jacg * this->m_NoiseFactor; diff --git a/Components/Optimizers/AdaptiveStochasticVarianceReducedGradient/elxAdaptiveStochasticVarianceReducedGradient.hxx b/Components/Optimizers/AdaptiveStochasticVarianceReducedGradient/elxAdaptiveStochasticVarianceReducedGradient.hxx index 06c6c2c54..13ec2126c 100644 --- a/Components/Optimizers/AdaptiveStochasticVarianceReducedGradient/elxAdaptiveStochasticVarianceReducedGradient.hxx +++ b/Components/Optimizers/AdaptiveStochasticVarianceReducedGradient/elxAdaptiveStochasticVarianceReducedGradient.hxx @@ -981,7 +981,7 @@ AdaptiveStochasticVarianceReducedGradient::AutomaticParameterEstimatio configuration.ReadParameter(this->m_UseNoiseCompensation, "NoiseCompensation", this->GetComponentLabel(), 0, 0); /** Use noise Compensation factor or not. */ - if (this->m_UseNoiseCompensation == true) + if (this->m_UseNoiseCompensation) { double sigma4 = 0.0; double gg = 0.0;