Skip to content

Commit

Permalink
COMP: Replace Get/Set macro calls by the corresponding itkVirtual call
Browse files Browse the repository at this point in the history
Only for those Get/Set member functions that actually have an override.
  • Loading branch information
N-Dekker committed Oct 13, 2021
1 parent b4a0c71 commit 970aa45
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 42 deletions.
8 changes: 4 additions & 4 deletions Modules/Core/Common/include/itkImageBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class ITK_TEMPLATE_EXPORT ImageBase : public DataObject
* coordinates of the image origin (pixel [0,0]). It is stored internally
* as SpacePrecisionType but may be set from float or double.
* \sa GetOrigin() */
itkSetMacro(Origin, PointType);
itkVirtualSetMacro(Origin, PointType);
virtual void
SetOrigin(const double origin[VImageDimension]);
virtual void
Expand Down Expand Up @@ -213,7 +213,7 @@ class ITK_TEMPLATE_EXPORT ImageBase : public DataObject
/** Get the direction cosines of the image. The direction cosines
* are vectors that point from one pixel to the next.
* For ImageBase and Image, the default direction is identity. */
itkGetConstReferenceMacro(Direction, DirectionType);
itkVirtualGetConstReferenceMacro(Direction, DirectionType);

/** Get the inverse direction cosines of the image.
* These are calculated automatically in SetDirection, thus there
Expand All @@ -224,13 +224,13 @@ class ITK_TEMPLATE_EXPORT ImageBase : public DataObject
* spacing is the geometric distance between image samples along
* each dimension. The value returned is a Vector<double, VImageDimension>.
* For ImageBase and Image, the default data spacing is unity. */
itkGetConstReferenceMacro(Spacing, SpacingType);
itkVirtualGetConstReferenceMacro(Spacing, SpacingType);

/** Get the origin of the image. The origin is the geometric
* coordinates of the index (0,0). The value returned is a
* Point<double, VImageDimension>. For ImageBase and Image, the
* default origin is 0. */
itkGetConstReferenceMacro(Origin, PointType);
itkVirtualGetConstReferenceMacro(Origin, PointType);

/** Allocate the image memory. The size of the image must
* already be set, e.g. by calling SetRegions() or SetBufferedRegion().
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkImageSink.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ class ImageSink

/** Set the number of pieces to divide the input. The upstream pipeline
* will be executed this many times. */
itkSetMacro(NumberOfStreamDivisions, unsigned int);
itkVirtualSetMacro(NumberOfStreamDivisions, unsigned int);

/** Get the number of pieces to divide the input. The upstream pipeline
* will be executed this many times. */
itkGetConstMacro(NumberOfStreamDivisions, unsigned int);
itkVirtualGetConstMacro(NumberOfStreamDivisions, unsigned int);

/** Set/Get Helper class for dividing the input into regions for
* streaming */
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkProcessObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ class ITKCommon_EXPORT ProcessObject : public Object
itkBooleanMacro(ReleaseDataBeforeUpdateFlag);

/** Get/Set the number of work units to create when executing. */
itkSetClampMacro(NumberOfWorkUnits, ThreadIdType, 1, ITK_MAX_THREADS);
itkVirtualSetClampMacro(NumberOfWorkUnits, ThreadIdType, 1, ITK_MAX_THREADS);
itkGetConstReferenceMacro(NumberOfWorkUnits, ThreadIdType);

#if !defined(ITK_LEGACY_REMOVE) || defined(ITKV4_COMPATIBILITY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class ITK_TEMPLATE_EXPORT FiniteDifferenceImageFilter : public InPlaceImageFilte
itkSetObjectMacro(DifferenceFunction, FiniteDifferenceFunctionType);

/** Set/Get the number of iterations that the filter will run. */
itkSetMacro(NumberOfIterations, IdentifierType);
itkVirtualSetMacro(NumberOfIterations, IdentifierType);
itkGetConstReferenceMacro(NumberOfIterations, IdentifierType);

/** Use the image spacing information in calculations. Use this option if you
Expand All @@ -193,13 +193,13 @@ class ITK_TEMPLATE_EXPORT FiniteDifferenceImageFilter : public InPlaceImageFilte

/** Set/Get the maximum error allowed in the solution. This may not be
defined for all solvers and its meaning may change with the application. */
itkSetMacro(MaximumRMSError, double);
itkVirtualSetMacro(MaximumRMSError, double);
itkGetConstReferenceMacro(MaximumRMSError, double);

/** Set/Get the root mean squared change of the previous iteration. May not
be used by all solvers. */
itkSetMacro(RMSChange, double);
itkGetConstReferenceMacro(RMSChange, double);
itkVirtualGetConstReferenceMacro(RMSChange, double);

/** Require the filter to be manually reinitialized (by calling
SetStateToUninitialized() */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class ITK_TEMPLATE_EXPORT STAPLEImageFilter : public ImageToImageFilter<TInputIm
/** Set/Get the maximum number of iterations after which the STAPLE algorithm
* will be considered to have converged. In general this SHOULD NOT be set and
* the algorithm should be allowed to converge on its own. */
itkSetMacro(MaximumIterations, unsigned int);
itkVirtualSetMacro(MaximumIterations, unsigned int);
itkGetConstMacro(MaximumIterations, unsigned int);

/** Scales the estimated prior probability that a pixel will be inside the
Expand Down
2 changes: 1 addition & 1 deletion Modules/IO/ImageBase/include/itkImageIOBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ITKIOImageBase_EXPORT ImageIOBase : public LightProcessObject
itkTypeMacro(ImageIOBase, Superclass);

/** Set/Get the name of the file to be read. */
itkSetStringMacro(FileName);
itkVirtualSetStringMacro(FileName);
itkGetStringMacro(FileName);

/** Types for managing image size and image index components. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ITK_TEMPLATE_EXPORT GradientDescentOptimizerBasev4Template
itkGetConstReferenceMacro(Gradient, DerivativeType);

/** Get stop condition enum */
itkGetConstReferenceMacro(StopCondition, StopConditionObjectToObjectOptimizerEnum);
itkVirtualGetConstReferenceMacro(StopCondition, StopConditionObjectToObjectOptimizerEnum);

/** Start and run the optimization */
void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class ITK_TEMPLATE_EXPORT GradientDescentOptimizerv4Template
* tests. It is suggested to use 1e-6 for less stringent convergence
* checking.
*/
itkSetMacro(MinimumConvergenceValue, TInternalComputationValueType);
itkVirtualSetMacro(MinimumConvergenceValue, TInternalComputationValueType);

/** Window size for the convergence checker.
* The convergence checker calculates convergence value by fitting to
Expand All @@ -163,12 +163,12 @@ class ITK_TEMPLATE_EXPORT GradientDescentOptimizerv4Template
* tests. It is suggested to use 10 for less stringent convergence
* checking.
*/
itkSetMacro(ConvergenceWindowSize, SizeValueType);
itkVirtualSetMacro(ConvergenceWindowSize, SizeValueType);

/** Get current convergence value.
* WindowConvergenceMonitoringFunction always returns output convergence
* value in 'TInternalComputationValueType' precision. */
itkGetConstReferenceMacro(ConvergenceValue, TInternalComputationValueType);
itkVirtualGetConstReferenceMacro(ConvergenceValue, TInternalComputationValueType);

/** Flag. Set to have the optimizer track and return the best
* best metric value and corresponding best parameters that were
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ class ITK_TEMPLATE_EXPORT ObjectToObjectMetric : public ObjectToObjectMetricBase
UpdateTransformParameters(const DerivativeType & derivative, TParametersValueType factor) override;

/** Connect the fixed transform. */
itkSetObjectMacro(FixedTransform, FixedTransformType);
itkVirtualSetObjectMacro(FixedTransform, FixedTransformType);

/** Get a pointer to the fixed transform. */
itkGetModifiableObjectMacro(FixedTransform, FixedTransformType);

/** Connect the moving transform. */
itkSetObjectMacro(MovingTransform, MovingTransformType);
itkVirtualSetObjectMacro(MovingTransform, MovingTransformType);

/** Get a pointer to the moving transform. */
itkGetModifiableObjectMacro(MovingTransform, MovingTransformType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ class ITK_TEMPLATE_EXPORT ObjectToObjectMetricBaseTemplate
using ObjectConstPointer = typename ObjectType::ConstPointer;

/** Get/Set the Fixed Object. */
itkSetConstObjectMacro(FixedObject, ObjectType);
itkVirtualSetConstObjectMacro(FixedObject, ObjectType);
itkGetConstObjectMacro(FixedObject, ObjectType);

/** Get/Set the Moving Object. */
itkSetConstObjectMacro(MovingObject, ObjectType);
itkVirtualSetConstObjectMacro(MovingObject, ObjectType);
itkGetConstObjectMacro(MovingObject, ObjectType);

using GradientSourceEnum = itk::ObjectToObjectMetricBaseTemplateEnums::GradientSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class ITK_TEMPLATE_EXPORT ObjectToObjectOptimizerBaseTemplate : public Object
using StopConditionDescriptionType = std::ostringstream;

/** Accessors for Metric */
itkSetObjectMacro(Metric, MetricType);
itkVirtualSetObjectMacro(Metric, MetricType);
itkGetModifiableObjectMacro(Metric, MetricType);

/** Accessor for metric value. Returns the value
Expand Down Expand Up @@ -237,10 +237,10 @@ class ITK_TEMPLATE_EXPORT ObjectToObjectOptimizerBaseTemplate : public Object
itkGetConstMacro(CurrentIteration, SizeValueType);

/** Set the number of iterations. */
itkSetMacro(NumberOfIterations, SizeValueType);
itkVirtualSetMacro(NumberOfIterations, SizeValueType);

/** Get the number of iterations. */
itkGetConstMacro(NumberOfIterations, SizeValueType);
itkVirtualGetConstMacro(NumberOfIterations, SizeValueType);

/** Get a reference to the current position of the optimization.
* This returns the parameters from the assigned metric, since the optimizer
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Statistics/include/itkSample.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class Sample : public DataObject
}

/** Get method for the length of the measurement vector */
itkGetConstMacro(MeasurementVectorSize, MeasurementVectorSizeType);
itkVirtualGetConstMacro(MeasurementVectorSize, MeasurementVectorSizeType);

/** Method to graft another sample */
void
Expand Down
2 changes: 1 addition & 1 deletion Modules/Numerics/Statistics/include/itkSubsamplerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ITK_TEMPLATE_EXPORT SubsamplerBase : public Object
/** Provide an interface to set the seed.
* The seed value will be used by subclasses where appropriate.
*/
itkSetMacro(Seed, SeedType);
itkVirtualSetMacro(Seed, SeedType);
itkGetConstReferenceMacro(Seed, SeedType);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class ITK_TEMPLATE_EXPORT ImageToImageMetric : public SingleValuedCostFunction
itkGetConstObjectMacro(MovingImage, MovingImageType);

/** Connect the Transform. */
itkSetObjectMacro(Transform, TransformType);
itkVirtualSetObjectMacro(Transform, TransformType);

/** Get a pointer to the Transform. */
itkGetModifiableObjectMacro(Transform, TransformType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class ITK_TEMPLATE_EXPORT ImageToSpatialObjectMetric : public SingleValuedCostFu
itkGetConstObjectMacro(FixedImage, FixedImageType);

/** Get/Set the MovingSpatialObject */
itkSetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
itkVirtualSetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
itkGetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);

/** Connect the Interpolator. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class TransformParametersAdaptorBase : public Object
SetTransform(TransformBaseType * _arg, void * priorityLower = nullptr) = 0;

/** Set the fixed parameters */
itkSetMacro(RequiredFixedParameters, FixedParametersType);
itkVirtualSetMacro(RequiredFixedParameters, FixedParametersType);

/** Get the fixed parameters */
itkGetConstReferenceMacro(RequiredFixedParameters, FixedParametersType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ class ITK_TEMPLATE_EXPORT VotingBinaryImageFilter : public ImageToImageFilter<TI

/** Birth threshold. Pixels that are OFF will turn ON when the number of
* neighbors ON is larger than the value defined in this threshold. */
itkGetConstReferenceMacro(BirthThreshold, unsigned int);
itkSetMacro(BirthThreshold, unsigned int);
itkVirtualGetConstReferenceMacro(BirthThreshold, unsigned int);
itkVirtualSetMacro(BirthThreshold, unsigned int);

/** Survival threshold. Pixels that are ON will turn OFF when the number of
* neighbors ON is smaller than the value defined in this survival threshold. */
itkGetConstReferenceMacro(SurvivalThreshold, unsigned int);
itkSetMacro(SurvivalThreshold, unsigned int);
itkVirtualGetConstReferenceMacro(SurvivalThreshold, unsigned int);
itkVirtualSetMacro(SurvivalThreshold, unsigned int);

/** VotingBinaryImageFilter needs a larger input requested region than
* the output requested region. As such, VotingBinaryImageFilter needs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class ITK_TEMPLATE_EXPORT SparseFieldLevelSetImageFilter : public FiniteDifferen
/** Set/Get the number of layers to use in the sparse field. Argument is the
* number of layers on ONE side of the active layer, so the total layers in
* the sparse field is 2 * NumberOfLayers +1 */
itkSetMacro(NumberOfLayers, unsigned int);
itkVirtualSetMacro(NumberOfLayers, unsigned int);
itkGetConstMacro(NumberOfLayers, unsigned int);

/** Set/Get the value of the isosurface to use in the input image. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ class ITK_TEMPLATE_EXPORT MRFImageFilter : public ImageToImageFilter<TInputImage
SetClassifier(typename ClassifierType::Pointer ptrToClassifier);

/** Set/Get the number of classes. */
itkSetMacro(NumberOfClasses, unsigned int);
itkGetConstMacro(NumberOfClasses, unsigned int);
itkVirtualSetMacro(NumberOfClasses, unsigned int);
itkVirtualGetConstMacro(NumberOfClasses, unsigned int);

/** Set/Get the number of iteration of the Iterated Conditional Mode
* (ICM) algorithm. A default value is set at 50 iterations. */
itkSetMacro(MaximumNumberOfIterations, unsigned int);
itkGetConstMacro(MaximumNumberOfIterations, unsigned int);
itkVirtualSetMacro(MaximumNumberOfIterations, unsigned int);
itkVirtualGetConstMacro(MaximumNumberOfIterations, unsigned int);

/** Set/Get the error tolerance level which is used as a threshold
* to quit the iterations */
Expand Down
10 changes: 5 additions & 5 deletions Modules/Video/Core/include/itkTemporalProcessObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ class ITKVideoCore_EXPORT TemporalProcessObject : public ProcessObject
virtual TemporalRegion
GenerateDefaultLargestPossibleTemporalRegion();

itkSetMacro(UnitInputNumberOfFrames, SizeValueType);
itkSetMacro(UnitOutputNumberOfFrames, SizeValueType);
itkSetMacro(FrameSkipPerOutput, OffsetValueType);
itkSetMacro(InputStencilCurrentFrameIndex, SizeValueType);
itkGetMacro(InputStencilCurrentFrameIndex, SizeValueType);
itkVirtualSetMacro(UnitInputNumberOfFrames, SizeValueType);
itkVirtualSetMacro(UnitOutputNumberOfFrames, SizeValueType);
itkVirtualSetMacro(FrameSkipPerOutput, OffsetValueType);
itkVirtualSetMacro(InputStencilCurrentFrameIndex, SizeValueType);
itkVirtualGetMacro(InputStencilCurrentFrameIndex, SizeValueType);

/*-PROTECTED MEMBERS-------------------------------------------------------*/

Expand Down

0 comments on commit 970aa45

Please sign in to comment.