Skip to content

Commit

Permalink
STYLE: Remove const_cast<const ITKBaseType *> from TransformBase (3x)
Browse files Browse the repository at this point in the history
These casts appear entirely superfluous, as GetAsITKBaseType() already returns a `const ITKBaseType *`.
  • Loading branch information
N-Dekker committed Nov 10, 2022
1 parent 5e8b027 commit cf02734
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Core/ComponentBaseClasses/elxTransformBase.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ TransformBase<TElastix>::GenerateDeformationFieldImage() const -> typename Defor
defGenerator->SetOutputOrigin(resampleImageFilter.GetOutputOrigin());
defGenerator->SetOutputStartIndex(resampleImageFilter.GetOutputStartIndex());
defGenerator->SetOutputDirection(resampleImageFilter.GetOutputDirection());
defGenerator->SetTransform(const_cast<const ITKBaseType *>(this->GetAsITKBaseType()));
defGenerator->SetTransform(this->GetAsITKBaseType());

/** Possibly change direction cosines to their original value, as specified
* in the tp-file, or by the fixed image. This is only necessary when
Expand Down Expand Up @@ -1065,7 +1065,7 @@ TransformBase<TElastix>::ComputeDeterminantOfSpatialJacobian() const

/** Create an setup Jacobian generator. */
const auto jacGenerator = itk::TransformToDeterminantOfSpatialJacobianSource<JacobianImageType, CoordRepType>::New();
jacGenerator->SetTransform(const_cast<const ITKBaseType *>(this->GetAsITKBaseType()));
jacGenerator->SetTransform(this->GetAsITKBaseType());
jacGenerator->SetOutputSize(resampleImageFilter.GetSize());
jacGenerator->SetOutputSpacing(resampleImageFilter.GetOutputSpacing());
jacGenerator->SetOutputOrigin(resampleImageFilter.GetOutputOrigin());
Expand Down Expand Up @@ -1143,7 +1143,7 @@ TransformBase<TElastix>::ComputeSpatialJacobian() const

/** Create an setup Jacobian generator. */
const auto jacGenerator = itk::TransformToSpatialJacobianSource<JacobianImageType, CoordRepType>::New();
jacGenerator->SetTransform(const_cast<const ITKBaseType *>(this->GetAsITKBaseType()));
jacGenerator->SetTransform(this->GetAsITKBaseType());
jacGenerator->SetOutputSize(resampleImageFilter.GetSize());
jacGenerator->SetOutputSpacing(resampleImageFilter.GetOutputSpacing());
jacGenerator->SetOutputOrigin(resampleImageFilter.GetOutputOrigin());
Expand Down

0 comments on commit cf02734

Please # to comment.