Skip to content

Commit

Permalink
STYLE: Improve the ivar printing in PrintSelf methods
Browse files Browse the repository at this point in the history
Improve the ivar printing in `PrintSelf` methods for the operator classes
in the `Common` module: use the style dictated by the ITK SW Guide.

Take advantage of the commit to:
- Change the `Indent` argument variable name to `indent` for the sake of
  consistency across the toolkit.
- Remove the method documentation since `PrintSelf` is an inherited
  method whose purpose does not change in inherited members.
  • Loading branch information
jhlegarreta authored and dzenanz committed Oct 4, 2021
1 parent 36bb69d commit 286fca2
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 43 deletions.
21 changes: 14 additions & 7 deletions Modules/Core/Common/include/itkAnnulusOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,22 @@ class ITK_TEMPLATE_EXPORT AnnulusOperator : public NeighborhoodOperator<TPixel,
return m_ExteriorValue;
}

/** Prints some debugging information */
void
PrintSelf(std::ostream & os, Indent i) const override
PrintSelf(std::ostream & os, Indent indent) const override
{
os << i << "AnnulusOperator { this=" << this << ", m_InnerRadius = " << m_InnerRadius
<< ", m_Thickness = " << m_Thickness << ", m_Spacing = " << m_Spacing << ", m_Normalize = " << m_Normalize
<< ", m_BrightCenter = " << m_BrightCenter << ", m_InteriorValue = " << m_InteriorValue
<< ", m_ExteriorValue = " << m_ExteriorValue << "}" << std::endl;
Superclass::PrintSelf(os, i.GetNextIndent());
Superclass::PrintSelf(os, indent);

os << indent << "InnerRadius: " << m_InnerRadius << std::endl;
os << indent << "Thickness: " << m_Thickness << std::endl;
os << indent << "Normalize: " << m_Normalize << std::endl;
os << indent << "BrightCenter: " << m_BrightCenter << std::endl;
os << indent << "InteriorValue: " << static_cast<typename NumericTraits<PixelType>::PrintType>(m_InteriorValue)
<< std::endl;
os << indent << "AnnulusValue: " << static_cast<typename NumericTraits<PixelType>::PrintType>(m_AnnulusValue)
<< std::endl;
os << indent << "ExteriorValue: " << static_cast<typename NumericTraits<PixelType>::PrintType>(m_ExteriorValue)
<< std::endl;
os << indent << "Spacing: " << static_cast<typename NumericTraits<SpacingType>::PrintType>(m_Spacing) << std::endl;
}

protected:
Expand Down
8 changes: 4 additions & 4 deletions Modules/Core/Common/include/itkDerivativeOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ class ITK_TEMPLATE_EXPORT DerivativeOperator : public NeighborhoodOperator<TPixe
return m_Order;
}

/** Prints some debugging information */
void
PrintSelf(std::ostream & os, Indent i) const override
PrintSelf(std::ostream & os, Indent indent) const override
{
os << i << "DerivativeOperator { this=" << this << ", m_Order = " << m_Order << "}" << std::endl;
Superclass::PrintSelf(os, i.GetNextIndent());
Superclass::PrintSelf(os, indent);

os << indent << "Order: " << m_Order << std::endl;
}

protected:
Expand Down
3 changes: 1 addition & 2 deletions Modules/Core/Common/include/itkGaussianDerivativeOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,8 @@ class ITK_TEMPLATE_EXPORT GaussianDerivativeOperator : public NeighborhoodOperat
return m_Order;
}

/** Prints member variables */
void
PrintSelf(std::ostream & os, Indent i) const override;
PrintSelf(std::ostream & os, Indent indent) const override;

protected:
/** Type alias support for coefficient vector type.*/
Expand Down
15 changes: 9 additions & 6 deletions Modules/Core/Common/include/itkGaussianDerivativeOperator.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,16 @@ GaussianDerivativeOperator<TPixel, VDimension, TAllocator>::ModifiedBesselI(int

template <typename TPixel, unsigned int VDimension, typename TAllocator>
void
GaussianDerivativeOperator<TPixel, VDimension, TAllocator>::PrintSelf(std::ostream & os, Indent i) const
GaussianDerivativeOperator<TPixel, VDimension, TAllocator>::PrintSelf(std::ostream & os, Indent indent) const
{
os << i << "GaussianDerivativeOperator { this=" << this << ", m_NormalizeAcrossScale = " << m_NormalizeAcrossScale
<< ", m_Order = " << m_Order << ", m_Spacing = " << m_Spacing << ", m_Variance = " << m_Variance
<< ", m_MaximumError = " << m_MaximumError << ", m_MaximumKernelWidth = " << m_MaximumKernelWidth << "} "
<< std::endl;
Superclass::PrintSelf(os, i.GetNextIndent());
Superclass::PrintSelf(os, indent);

os << indent << "NormalizeAcrossScale: " << m_NormalizeAcrossScale << std::endl;
os << indent << "Variance: " << m_Variance << std::endl;
os << indent << "MaximumError: " << m_MaximumError << std::endl;
os << indent << "MaximumKernelWidth: " << m_MaximumKernelWidth << std::endl;
os << indent << "Order: " << m_Order << std::endl;
os << indent << "Spacing: " << m_Spacing << std::endl;
}

} // end namespace itk
Expand Down
11 changes: 6 additions & 5 deletions Modules/Core/Common/include/itkGaussianOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ class ITK_TEMPLATE_EXPORT GaussianOperator : public NeighborhoodOperator<TPixel,
return m_MaximumKernelWidth;
}

/** Prints some debugging information. */
void
PrintSelf(std::ostream & os, Indent i) const override
PrintSelf(std::ostream & os, Indent indent) const override
{
os << i << "GaussianOperator { this=" << this << ", m_Variance = " << m_Variance
<< ", m_MaximumError = " << m_MaximumError << "} " << std::endl;
Superclass::PrintSelf(os, i.GetNextIndent());
Superclass::PrintSelf(os, indent);

os << indent << "Variance: " << m_Variance << std::endl;
os << indent << "MaximumError: " << m_MaximumError << std::endl;
os << indent << "MaximumKernelWidth: " << m_MaximumKernelWidth << std::endl;
}

public:
Expand Down
6 changes: 2 additions & 4 deletions Modules/Core/Common/include/itkImageKernelOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@ class ITK_TEMPLATE_EXPORT ImageKernelOperator : public NeighborhoodOperator<TPix
const ImageType *
GetImageKernel() const;

/** Prints information about the object. */
void
PrintSelf(std::ostream & os, Indent i) const override
PrintSelf(std::ostream & os, Indent indent) const override
{
os << i << "ImageKernelOperator { this=" << this << "} " << std::endl;
Superclass::PrintSelf(os, i.GetNextIndent());
Superclass::PrintSelf(os, indent);
}

protected:
Expand Down
8 changes: 4 additions & 4 deletions Modules/Core/Common/include/itkLaplacianOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ class ITK_TEMPLATE_EXPORT LaplacianOperator : public NeighborhoodOperator<TPixel
void
CreateOperator();

/** Prints some debugging information */
void
PrintSelf(std::ostream & os, Indent i) const override
PrintSelf(std::ostream & os, Indent indent) const override
{
os << i << "LaplacianOperator { this=" << this << "}" << std::endl;
Superclass::PrintSelf(os, i.GetNextIndent());
Superclass::PrintSelf(os, indent);

os << indent << "DerivativeScalings: " << m_DerivativeScalings << std::endl;
}

/** Sets the weights that are applied to the derivative in each axial
Expand Down
8 changes: 4 additions & 4 deletions Modules/Core/Common/include/itkNeighborhoodOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ class ITK_TEMPLATE_EXPORT NeighborhoodOperator : public Neighborhood<TPixel, VDi
virtual void
FlipAxes();

/** Prints some debugging information. */
void
PrintSelf(std::ostream & os, Indent i) const override
PrintSelf(std::ostream & os, Indent indent) const override
{
os << i << "NeighborhoodOperator { this=" << this << " Direction = " << m_Direction << " }" << std::endl;
Superclass::PrintSelf(os, i.GetNextIndent());
Superclass::PrintSelf(os, indent);

os << indent << "Direction: " << m_Direction << std::endl;
}

/** Multiplies all of the coefficients of the kernel by a single scalar value.
Expand Down
9 changes: 2 additions & 7 deletions Modules/Core/Common/include/itkSobelOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,10 @@ class ITK_TEMPLATE_EXPORT SobelOperator : public NeighborhoodOperator<TPixel, VD
* \sa CreateDirectional \sa Fill */
// virtual void CreateToRadius(const unsigned long);


/**
* Prints some debugging information
*/
void
PrintSelf(std::ostream & os, Indent i) const override
PrintSelf(std::ostream & os, Indent indent) const override
{
os << i << "SobelOperator { this=" << this << "}" << std::endl;
Superclass::PrintSelf(os, i.GetNextIndent());
Superclass::PrintSelf(os, indent);
}

protected:
Expand Down

0 comments on commit 286fca2

Please sign in to comment.