Skip to content

Commit

Permalink
ENH: Control AverageAffineTransformFunction's verbosity via an ivar
Browse files Browse the repository at this point in the history
Verbose is off by default in the class.
Executables turn on verbosity for backwards compatibility.
  • Loading branch information
dzenanz committed Feb 28, 2024
1 parent e9ec28e commit 911eadf
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 61 deletions.
1 change: 1 addition & 0 deletions Examples/AverageAffineTransform.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ AverageAffineTransform(char * output_affine_txt, char * reference_affine_txt, TR
// typename ImageFileReaderType::Pointer reader_img_ref = ImageFileReaderType::New();

WarperType average_func;
average_func.verbose = true;
// warper->SetInput(img_mov);
// warper->SetEdgePaddingValue( 0);
// VectorType pad;
Expand Down
1 change: 1 addition & 0 deletions Examples/AverageAffineTransformNoRigid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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.verbose = true;
average_func.useRigid = false;
// warper->SetInput(img_mov);
// warper->SetEdgePaddingValue( 0);
Expand Down
21 changes: 12 additions & 9 deletions Utilities/itkAverageAffineTransformFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct HelperCommonType
ComputeAveragePartialParameters(InternalTransformListType & transform_list,
ParametersType & average_parameters,
unsigned int iStart,
unsigned int iEnd);
unsigned int iEnd, bool verbose);
};

template <typename T, typename TParametersValueType>
Expand All @@ -77,16 +77,16 @@ class HelperType<Dispatcher<2>, TParametersValueType>
typedef typename HelperCommonType<InternalAffineTransformType>::ParametersType ParametersType;

static void
ComputeAverageScaleParameters(InternalTransformListType & transform_list, ParametersType & average_parameters);
ComputeAverageScaleParameters(InternalTransformListType & transform_list, ParametersType & average_parameters, bool verbose);

static void
ComputeAverageShearingParameters(InternalTransformListType & transform_list, ParametersType & average_parameters);
ComputeAverageShearingParameters(InternalTransformListType & transform_list, ParametersType & average_parameters, bool verbose);

static void
ComputeAverageRotationParameters(InternalTransformListType & transform_list, ParametersType & average_parameters);
ComputeAverageRotationParameters(InternalTransformListType & transform_list, ParametersType & average_parameters, bool verbose);

static void
ComputeAverageTranslationParameters(InternalTransformListType & transform_list, ParametersType & average_parameters);
ComputeAverageTranslationParameters(InternalTransformListType & transform_list, ParametersType & average_parameters, bool verbose);
};

// explicit specialization for 3D affine transform
Expand All @@ -104,16 +104,16 @@ class HelperType<Dispatcher<3>, TParametersValueType>
typedef typename HelperCommonType<InternalAffineTransformType>::ParametersType ParametersType;

static void
ComputeAverageScaleParameters(InternalTransformListType & transform_list, ParametersType & average_parameters);
ComputeAverageScaleParameters(InternalTransformListType & transform_list, ParametersType & average_parameters, bool verbose);

static void
ComputeAverageShearingParameters(InternalTransformListType & transform_list, ParametersType & average_parameters);
ComputeAverageShearingParameters(InternalTransformListType & transform_list, ParametersType & average_parameters, bool verbose);

static void
ComputeAverageRotationParameters(InternalTransformListType & transform_list, ParametersType & average_parameters);
ComputeAverageRotationParameters(InternalTransformListType & transform_list, ParametersType & average_parameters, bool verbose);

static void
ComputeAverageTranslationParameters(InternalTransformListType & transform_list, ParametersType & average_parameters);
ComputeAverageTranslationParameters(InternalTransformListType & transform_list, ParametersType & average_parameters, bool verbose);
};
} // namespace AverageAffineTransformFunctionHelperNameSpace

Expand Down Expand Up @@ -160,6 +160,9 @@ class AverageAffineTransformFunction
void
AverageMultipleAffineTransform(const PointType & center_output, GenericAffineTransformPointerType & affine_output);

/** Whether progress and debugging information are printed to standard output (cout). */
bool verbose = false;

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

Expand Down
Loading

0 comments on commit 911eadf

Please sign in to comment.