Skip to content

Commit

Permalink
ENH: Refactor AverageAffineTransformFunction (remove NoRigid variant)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzenanz committed Feb 27, 2024
1 parent fc0e56d commit e9ec28e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 548 deletions.
5 changes: 3 additions & 2 deletions Examples/AverageAffineTransformNoRigid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "itkMatrixOffsetTransformBase.h"
#include "itkTransformFactory.h"

#include "itkAverageAffineTransformNoRigidFunction.h"
#include "itkAverageAffineTransformFunction.h"

#include "itkTransformFileReader.h"
#include "itkTransformFileWriter.h"
Expand Down Expand Up @@ -118,7 +118,7 @@ AverageAffineTransformNoRigid(char * output_affine_txt, char * reference_affine_
// typedef itk::WarpImageMultiTransformFilter<ImageType, ImageType,
// DisplacementFieldType, AffineTransformType> WarperType;

using WarperType = itk::AverageAffineTransformNoRigidFunction<AffineTransformType>;
using WarperType = itk::AverageAffineTransformFunction<AffineTransformType>;

itk::TransformFactory<AffineTransformType>::RegisterTransform();

Expand All @@ -129,6 +129,7 @@ AverageAffineTransformNoRigid(char * output_affine_txt, char * reference_affine_
// typename ImageFileReaderType::Pointer reader_img_ref = ImageFileReaderType::New();

WarperType average_func;
average_func.useRigid = false;
// warper->SetInput(img_mov);
// warper->SetEdgePaddingValue( 0);
// VectorType pad;
Expand Down
3 changes: 3 additions & 0 deletions Utilities/itkAverageAffineTransformFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ class AverageAffineTransformFunction
void
AverageMultipleAffineTransform(const PointType & center_output, GenericAffineTransformPointerType & affine_output);

/** Set to false to ignore rotation and translation. */
bool useRigid = true;

#ifdef ITK_USE_CONCEPT_CHECKING
/** Begin concept checking */
itkConceptMacro(SameDimensionCheck1, (Concept::SameDimension<InputSpaceDimension, OutputSpaceDimension>));
Expand Down
7 changes: 5 additions & 2 deletions Utilities/itkAverageAffineTransformFunction.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,11 @@ AverageAffineTransformFunction<TTransform>::AverageMultipleAffineTransform(

HelperType::ComputeAverageScaleParameters(m_InternalTransformList, average_parameters);
HelperType::ComputeAverageShearingParameters(m_InternalTransformList, average_parameters);
HelperType::ComputeAverageRotationParameters(m_InternalTransformList, average_parameters);
HelperType::ComputeAverageTranslationParameters(m_InternalTransformList, average_parameters);
if (useRigid)
{
HelperType::ComputeAverageRotationParameters(m_InternalTransformList, average_parameters);
HelperType::ComputeAverageTranslationParameters(m_InternalTransformList, average_parameters);
}

average_iaff->SetParameters(average_parameters);
average_iaff->SetCenter(reference_center);
Expand Down
200 changes: 0 additions & 200 deletions Utilities/itkAverageAffineTransformNoRigidFunction.h

This file was deleted.

Loading

0 comments on commit e9ec28e

Please sign in to comment.