Skip to content

Commit

Permalink
STYLE: Remove as_ref() when calling is_equal on direction matrices
Browse files Browse the repository at this point in the history
The `vnl_matrix_fixed::as_ref()` calls are no longer necessary, now that
`vnl_matrix_fixed` directly supports `is_equal`:

- VXL pull request vxl/vxl#317
 commit vxl/vxl@aa373fc
 "ENH: Encourage unified container interface.", Davis Vigneault, June 16, 2016
  • Loading branch information
N-Dekker authored and hjmjohnson committed Mar 1, 2024
1 parent 28f84ab commit 69626af
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
3 changes: 1 addition & 2 deletions Modules/Core/Common/include/itkImageBase.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,7 @@ ImageBase<VImageDimension>::IsCongruentImageGeometry(const ImageBase * otherImag

return this->GetOrigin().GetVnlVector().is_equal(otherImage->GetOrigin().GetVnlVector(), coordinateTol) &&
this->GetSpacing().GetVnlVector().is_equal(otherImage->GetSpacing().GetVnlVector(), coordinateTol) &&
this->GetDirection().GetVnlMatrix().as_ref().is_equal(otherImage->GetDirection().GetVnlMatrix().as_ref(),
directionTolerance);
this->GetDirection().GetVnlMatrix().is_equal(otherImage->GetDirection().GetVnlMatrix(), directionTolerance);
}


Expand Down
8 changes: 4 additions & 4 deletions Modules/Core/Common/include/itkImageSink.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ ImageSink<TInputImage>::VerifyInputInformation() ITKv5_CONST

if (!inputPtr1->GetOrigin().GetVnlVector().is_equal(inputPtrN->GetOrigin().GetVnlVector(), coordinateTol) ||
!inputPtr1->GetSpacing().GetVnlVector().is_equal(inputPtrN->GetSpacing().GetVnlVector(), coordinateTol) ||
!inputPtr1->GetDirection().GetVnlMatrix().as_ref().is_equal(inputPtrN->GetDirection().GetVnlMatrix().as_ref(),
this->m_DirectionTolerance))
!inputPtr1->GetDirection().GetVnlMatrix().is_equal(inputPtrN->GetDirection().GetVnlMatrix(),
this->m_DirectionTolerance))
{
std::ostringstream originString, spacingString, directionString;
if (!inputPtr1->GetOrigin().GetVnlVector().is_equal(inputPtrN->GetOrigin().GetVnlVector(), coordinateTol))
Expand All @@ -227,8 +227,8 @@ ImageSink<TInputImage>::VerifyInputInformation() ITKv5_CONST
<< " Spacing: " << inputPtrN->GetSpacing() << std::endl;
spacingString << "\tTolerance: " << coordinateTol << std::endl;
}
if (!inputPtr1->GetDirection().GetVnlMatrix().as_ref().is_equal(
inputPtrN->GetDirection().GetVnlMatrix().as_ref(), this->m_DirectionTolerance))
if (!inputPtr1->GetDirection().GetVnlMatrix().is_equal(inputPtrN->GetDirection().GetVnlMatrix(),
this->m_DirectionTolerance))
{
directionString.setf(std::ios::scientific);
directionString.precision(7);
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkImageToImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ ImageToImageFilter<TInputImage, TOutputImage>::VerifyInputInformation() ITKv5_CO
<< " Spacing: " << inputPtrN->GetSpacing() << std::endl;
spacingString << "\tTolerance: " << coordinateTol << std::endl;
}
if (!inputPtr1->GetDirection().GetVnlMatrix().as_ref().is_equal(
inputPtrN->GetDirection().GetVnlMatrix().as_ref(), this->m_DirectionTolerance))
if (!inputPtr1->GetDirection().GetVnlMatrix().is_equal(inputPtrN->GetDirection().GetVnlMatrix(),
this->m_DirectionTolerance))
{
directionString.setf(std::ios::scientific);
directionString.precision(7);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,7 @@ DisplacementFieldTransform<TParametersValueType, VDimension>::VerifyFixedParamet
originString << "InverseDisplacementField Spacing: " << inverseFieldSpacing
<< ", DisplacementField Spacing: " << fieldSpacing << std::endl;
}
if (!inverseFieldDirection.GetVnlMatrix().as_ref().is_equal(fieldDirection.GetVnlMatrix().as_ref(),
directionTolerance))
if (!inverseFieldDirection.GetVnlMatrix().is_equal(fieldDirection.GetVnlMatrix(), directionTolerance))
{
unequalDirections = true;
originString << "InverseDisplacementField Direction: " << inverseFieldDirection
Expand Down
4 changes: 2 additions & 2 deletions Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ WarpImageFilter<TInputImage, TOutputImage, TDisplacementField>::GenerateInputReq
this->m_DefFieldSameInformation =
(outputPtr->GetOrigin().GetVnlVector().is_equal(fieldPtr->GetOrigin().GetVnlVector(), coordinateTol)) &&
(outputPtr->GetSpacing().GetVnlVector().is_equal(fieldPtr->GetSpacing().GetVnlVector(), coordinateTol)) &&
(outputPtr->GetDirection().GetVnlMatrix().as_ref().is_equal(fieldPtr->GetDirection().GetVnlMatrix().as_ref(),
this->GetDirectionTolerance()));
(outputPtr->GetDirection().GetVnlMatrix().is_equal(fieldPtr->GetDirection().GetVnlMatrix(),
this->GetDirectionTolerance()));

if (this->m_DefFieldSameInformation)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,7 @@ ObjectToObjectMetric<TFixedDimension, TMovingDimension, TVirtualImage, TParamete

if (!this->GetVirtualOrigin().GetVnlVector().is_equal(field->GetOrigin().GetVnlVector(), coordinateTol) ||
!this->GetVirtualSpacing().GetVnlVector().is_equal(field->GetSpacing().GetVnlVector(), coordinateTol) ||
!this->GetVirtualDirection().GetVnlMatrix().as_ref().is_equal(field->GetDirection().GetVnlMatrix().as_ref(),
directionTol))
!this->GetVirtualDirection().GetVnlMatrix().is_equal(field->GetDirection().GetVnlMatrix(), directionTol))
{
std::ostringstream originString, spacingString, directionString;
originString << "Virtual Origin: " << this->GetVirtualOrigin()
Expand Down

0 comments on commit 69626af

Please sign in to comment.