diff --git a/Modules/Core/Common/include/itkAnnulusOperator.h b/Modules/Core/Common/include/itkAnnulusOperator.h index 4c1888f7ab5..4cbade05ced 100644 --- a/Modules/Core/Common/include/itkAnnulusOperator.h +++ b/Modules/Core/Common/include/itkAnnulusOperator.h @@ -96,11 +96,7 @@ class ITK_TEMPLATE_EXPORT AnnulusOperator : public NeighborhoodOperatorSetNormalize(true); - } - void - NormalizeOff() - { - this->SetNormalize(false); - } + itkGetConstNonVirtualMacro(Normalize, bool); + itkBooleanNonVirtualMacro(Normalize); /** If Normalize is on, you define the annulus to have a bright * center or a dark center. */ @@ -159,21 +134,8 @@ class ITK_TEMPLATE_EXPORT AnnulusOperator : public NeighborhoodOperatorSetBrightCenter(true); - } - void - BrightCenterOff() - { - this->SetBrightCenter(false); - } + itkGetConstNonVirtualMacro(BrightCenter, bool); + itkBooleanNonVirtualMacro(BrightCenter); /** If Normalize is off, the interior to annulus, the * annulus (region between the two circles), and the region exterior to the @@ -184,31 +146,19 @@ class ITK_TEMPLATE_EXPORT AnnulusOperator : public NeighborhoodOperatorm_Order = order; } - - /** Returns the order of the derivative. */ - unsigned int - GetOrder() const - { - return m_Order; - } + itkGetConstNonVirtualMacro(Order, unsigned int); void PrintSelf(std::ostream & os, Indent indent) const override @@ -116,7 +110,6 @@ class ITK_TEMPLATE_EXPORT DerivativeOperator : public NeighborhoodOperatorm_##name; } \ ITK_MACROEND_NOOP_STATEMENT +/** Get built-in type. Creates a non-virtual member Get"name"() (e.g., GetVisibility()); + * This is the "non-virtual, const" form of the itkGetMacro. It should be used unless + * the member can be changed through the "Get" access routine and in situations where the + * method is not required to be overriden. */ +#define itkGetConstNonVirtualMacro(name, type) \ + type Get##name() const { return this->m_##name; } \ + ITK_MACROEND_NOOP_STATEMENT + /** Get built-in type. Creates member Get"name"() (e.g., GetVisibility()); * This is the "const" form of the itkGetMacro. It should be used unless * the member can be changed through the "Get" access routine. - * This versions returns a const reference to the variable. */ + * This version returns a const reference to the variable. */ #define itkGetConstReferenceMacro(name, type) \ virtual const type & Get##name() const { return this->m_##name; } \ ITK_MACROEND_NOOP_STATEMENT +/** Get built-in type. Creates member Get"name"() (e.g., GetVisibility()); + * This is the "non-virtual, const" form of the itkGetMacro. It should be used unless + * the member can be changed through the "Get" access routine and in situations where the + * method is not required to be overriden. + * This version returns a const reference to the variable. */ +#define itkGetConstNonVirtualReferenceMacro(name, type) \ + const type & Get##name() const { return this->m_##name; } \ + ITK_MACROEND_NOOP_STATEMENT + +/** Get built-in type. Creates a non-virtual member Get"name"() (e.g., GetVisibility()); + * This is the "non-virtual" form of the itkGetMacro. It should be used in situations where the + * method is not required to be overriden. */ +#define itkGetNonVirtualMacro(name, type) \ + type Get##name() { return this->m_##name; } \ + ITK_MACROEND_NOOP_STATEMENT + /** Set built-in type. Creates member Set"name"() (e.g., SetVisibility()); * This should be used when the type is an enum. It is used to avoid warnings on * some compilers with non specified enum types passed to @@ -1200,6 +1224,12 @@ compilers. virtual void name##Off() { this->Set##name(false); } \ ITK_MACROEND_NOOP_STATEMENT +/** Create non-virtual members "name"On() and "name"Off() (e.g., DebugOn() DebugOff()). + * Set method must be defined to use this macro. */ +#define itkBooleanNonVirtualMacro(name) \ + void name##On() { this->Set##name(true); } \ + void name##Off() { this->Set##name(false); } + // clang-format off /** General set vector macro creates a single method that copies specified * number of values into object. diff --git a/Modules/Core/Common/include/itkNeighborhoodOperator.h b/Modules/Core/Common/include/itkNeighborhoodOperator.h index 55232f9e845..4a36802f093 100644 --- a/Modules/Core/Common/include/itkNeighborhoodOperator.h +++ b/Modules/Core/Common/include/itkNeighborhoodOperator.h @@ -89,7 +89,7 @@ class ITK_TEMPLATE_EXPORT NeighborhoodOperator : public Neighborhood::RealType; - /** Sets the dimensional direction of a directional operator. */ + /** Set/Get the direction (dimension number) of a directional operator. */ void SetDirection(const unsigned long direction) { @@ -100,13 +100,7 @@ class ITK_TEMPLATE_EXPORT NeighborhoodOperator : public Neighborhood