Skip to content

Commit

Permalink
PERF: Call FastEvaluateMovingImageValueAndDerivative in 4 more metrics
Browse files Browse the repository at this point in the history
Replace `this->EvaluateMovingImageValueAndDerivative(...)` calls by `this->FastEvaluateMovingImageValueAndDerivative(..., threadId)` in four more metrics:

   itkAdvancedKappaStatisticImageToImageMetric
   itkParzenWindowMutualInformationImageToImageMetric
   itkAdvancedMeanSquaresImageToImageMetric
   itkPCAMetric_F_multithreaded

Follow-up to pull request #556 commit c8c4a6a "PERF: Make AdvancedNormalizedCorrelationImageToImageMetric faster"
  • Loading branch information
N-Dekker committed Nov 27, 2021
1 parent 9462491 commit a57e282
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,8 @@ AdvancedKappaStatisticImageToImageMetric<TFixedImage, TMovingImage>::ThreadedGet
MovingImageDerivativeType movingImageDerivative;
if (sampleOk)
{
sampleOk = this->EvaluateMovingImageValueAndDerivative(mappedPoint, movingImageValue, &movingImageDerivative);
sampleOk = this->FastEvaluateMovingImageValueAndDerivative(
mappedPoint, movingImageValue, &movingImageDerivative, threadId);
}

/** Do the actual calculation of the metric value. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,8 @@ ParzenWindowMutualInformationImageToImageMetric<TFixedImage, TMovingImage>::Thre
*/
if (sampleOk)
{
sampleOk = this->EvaluateMovingImageValueAndDerivative(mappedPoint, movingImageValue, &movingImageDerivative);
sampleOk = this->FastEvaluateMovingImageValueAndDerivative(
mappedPoint, movingImageValue, &movingImageDerivative, threadId);
}

if (sampleOk)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ AdvancedMeanSquaresImageToImageMetric<TFixedImage, TMovingImage>::ThreadedGetVal
*/
if (sampleOk)
{
sampleOk = this->EvaluateMovingImageValueAndDerivative(mappedPoint, movingImageValue, nullptr);
sampleOk = this->FastEvaluateMovingImageValueAndDerivative(mappedPoint, movingImageValue, nullptr, threadId);
}

if (sampleOk)
Expand Down Expand Up @@ -677,7 +677,8 @@ AdvancedMeanSquaresImageToImageMetric<TFixedImage, TMovingImage>::ThreadedGetVal
*/
if (sampleOk)
{
sampleOk = this->EvaluateMovingImageValueAndDerivative(mappedPoint, movingImageValue, &movingImageDerivative);
sampleOk = this->FastEvaluateMovingImageValueAndDerivative(
mappedPoint, movingImageValue, &movingImageDerivative, threadId);
}

if (sampleOk)
Expand Down
4 changes: 2 additions & 2 deletions Components/Metrics/PCAMetric/itkPCAMetric_F_multithreaded.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ PCAMetric<TFixedImage, TMovingImage>::ThreadedGetSamples(ThreadIdType threadId)
if (sampleOk)

{
sampleOk = this->EvaluateMovingImageValueAndDerivative(mappedPoint, movingImageValue, nullptr);
sampleOk = this->FastEvaluateMovingImageValueAndDerivative(mappedPoint, movingImageValue, nullptr, threadId);
}

if (sampleOk)
Expand Down Expand Up @@ -991,7 +991,7 @@ PCAMetric<TFixedImage, TMovingImage>::ThreadedComputeDerivative(ThreadIdType thr
this->GetFixedImage()->TransformContinuousIndexToPhysicalPoint(voxelCoord, fixedPoint);
this->TransformPoint(fixedPoint, mappedPoint);

this->EvaluateMovingImageValueAndDerivative(mappedPoint, movingImageValue, &movingImageDerivative);
this->FastEvaluateMovingImageValueAndDerivative(mappedPoint, movingImageValue, &movingImageDerivative, threadId);

/** Get the TransformJacobian dT/dmu */
this->EvaluateTransformJacobian(fixedPoint, jacobian, nzjis);
Expand Down

0 comments on commit a57e282

Please sign in to comment.