diff --git a/Common/itkComputeDisplacementDistribution.hxx b/Common/itkComputeDisplacementDistribution.hxx index 5bf68b170..9905ba459 100644 --- a/Common/itkComputeDisplacementDistribution.hxx +++ b/Common/itkComputeDisplacementDistribution.hxx @@ -143,10 +143,13 @@ ComputeDisplacementDistribution::ComputeSingleThreaded( */ DerivativeType Jgg(outdim); Jgg.Fill(0.0); + std::vector JGG_k; - double globalDeformation = 0.0; - const double sqrt2 = std::sqrt(static_cast(2.0)); - JacobianType jacjjacj(outdim, outdim); + JGG_k.reserve(nrofsamples); + + double globalDeformation = 0.0; + const double sqrt2 = std::sqrt(static_cast(2.0)); + JacobianType jacjjacj(outdim, outdim); samplenr = 0; for (const auto & sample : *sampleContainer) @@ -511,8 +514,11 @@ ComputeDisplacementDistribution::ComputeUsingSearchDire */ DerivativeType Jgg(outdim); Jgg.Fill(0.0); + std::vector JGG_k; - double globalDeformation = 0.0; + JGG_k.reserve(nrofsamples); + + double globalDeformation = 0.0; samplenr = 0; for (const auto & sample : *sampleContainer)