Skip to content

Commit 286fca2

Browse files
jhlegarretadzenanz
authored andcommitted
STYLE: Improve the ivar printing in PrintSelf methods
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.
1 parent 36bb69d commit 286fca2

9 files changed

+46
-43
lines changed

Modules/Core/Common/include/itkAnnulusOperator.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,22 @@ class ITK_TEMPLATE_EXPORT AnnulusOperator : public NeighborhoodOperator<TPixel,
210210
return m_ExteriorValue;
211211
}
212212

213-
/** Prints some debugging information */
214213
void
215-
PrintSelf(std::ostream & os, Indent i) const override
214+
PrintSelf(std::ostream & os, Indent indent) const override
216215
{
217-
os << i << "AnnulusOperator { this=" << this << ", m_InnerRadius = " << m_InnerRadius
218-
<< ", m_Thickness = " << m_Thickness << ", m_Spacing = " << m_Spacing << ", m_Normalize = " << m_Normalize
219-
<< ", m_BrightCenter = " << m_BrightCenter << ", m_InteriorValue = " << m_InteriorValue
220-
<< ", m_ExteriorValue = " << m_ExteriorValue << "}" << std::endl;
221-
Superclass::PrintSelf(os, i.GetNextIndent());
216+
Superclass::PrintSelf(os, indent);
217+
218+
os << indent << "InnerRadius: " << m_InnerRadius << std::endl;
219+
os << indent << "Thickness: " << m_Thickness << std::endl;
220+
os << indent << "Normalize: " << m_Normalize << std::endl;
221+
os << indent << "BrightCenter: " << m_BrightCenter << std::endl;
222+
os << indent << "InteriorValue: " << static_cast<typename NumericTraits<PixelType>::PrintType>(m_InteriorValue)
223+
<< std::endl;
224+
os << indent << "AnnulusValue: " << static_cast<typename NumericTraits<PixelType>::PrintType>(m_AnnulusValue)
225+
<< std::endl;
226+
os << indent << "ExteriorValue: " << static_cast<typename NumericTraits<PixelType>::PrintType>(m_ExteriorValue)
227+
<< std::endl;
228+
os << indent << "Spacing: " << static_cast<typename NumericTraits<SpacingType>::PrintType>(m_Spacing) << std::endl;
222229
}
223230

224231
protected:

Modules/Core/Common/include/itkDerivativeOperator.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ class ITK_TEMPLATE_EXPORT DerivativeOperator : public NeighborhoodOperator<TPixe
9393
return m_Order;
9494
}
9595

96-
/** Prints some debugging information */
9796
void
98-
PrintSelf(std::ostream & os, Indent i) const override
97+
PrintSelf(std::ostream & os, Indent indent) const override
9998
{
100-
os << i << "DerivativeOperator { this=" << this << ", m_Order = " << m_Order << "}" << std::endl;
101-
Superclass::PrintSelf(os, i.GetNextIndent());
99+
Superclass::PrintSelf(os, indent);
100+
101+
os << indent << "Order: " << m_Order << std::endl;
102102
}
103103

104104
protected:

Modules/Core/Common/include/itkGaussianDerivativeOperator.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,8 @@ class ITK_TEMPLATE_EXPORT GaussianDerivativeOperator : public NeighborhoodOperat
205205
return m_Order;
206206
}
207207

208-
/** Prints member variables */
209208
void
210-
PrintSelf(std::ostream & os, Indent i) const override;
209+
PrintSelf(std::ostream & os, Indent indent) const override;
211210

212211
protected:
213212
/** Type alias support for coefficient vector type.*/

Modules/Core/Common/include/itkGaussianDerivativeOperator.hxx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,16 @@ GaussianDerivativeOperator<TPixel, VDimension, TAllocator>::ModifiedBesselI(int
281281

282282
template <typename TPixel, unsigned int VDimension, typename TAllocator>
283283
void
284-
GaussianDerivativeOperator<TPixel, VDimension, TAllocator>::PrintSelf(std::ostream & os, Indent i) const
284+
GaussianDerivativeOperator<TPixel, VDimension, TAllocator>::PrintSelf(std::ostream & os, Indent indent) const
285285
{
286-
os << i << "GaussianDerivativeOperator { this=" << this << ", m_NormalizeAcrossScale = " << m_NormalizeAcrossScale
287-
<< ", m_Order = " << m_Order << ", m_Spacing = " << m_Spacing << ", m_Variance = " << m_Variance
288-
<< ", m_MaximumError = " << m_MaximumError << ", m_MaximumKernelWidth = " << m_MaximumKernelWidth << "} "
289-
<< std::endl;
290-
Superclass::PrintSelf(os, i.GetNextIndent());
286+
Superclass::PrintSelf(os, indent);
287+
288+
os << indent << "NormalizeAcrossScale: " << m_NormalizeAcrossScale << std::endl;
289+
os << indent << "Variance: " << m_Variance << std::endl;
290+
os << indent << "MaximumError: " << m_MaximumError << std::endl;
291+
os << indent << "MaximumKernelWidth: " << m_MaximumKernelWidth << std::endl;
292+
os << indent << "Order: " << m_Order << std::endl;
293+
os << indent << "Spacing: " << m_Spacing << std::endl;
291294
}
292295

293296
} // end namespace itk

Modules/Core/Common/include/itkGaussianOperator.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,14 @@ class ITK_TEMPLATE_EXPORT GaussianOperator : public NeighborhoodOperator<TPixel,
132132
return m_MaximumKernelWidth;
133133
}
134134

135-
/** Prints some debugging information. */
136135
void
137-
PrintSelf(std::ostream & os, Indent i) const override
136+
PrintSelf(std::ostream & os, Indent indent) const override
138137
{
139-
os << i << "GaussianOperator { this=" << this << ", m_Variance = " << m_Variance
140-
<< ", m_MaximumError = " << m_MaximumError << "} " << std::endl;
141-
Superclass::PrintSelf(os, i.GetNextIndent());
138+
Superclass::PrintSelf(os, indent);
139+
140+
os << indent << "Variance: " << m_Variance << std::endl;
141+
os << indent << "MaximumError: " << m_MaximumError << std::endl;
142+
os << indent << "MaximumKernelWidth: " << m_MaximumKernelWidth << std::endl;
142143
}
143144

144145
public:

Modules/Core/Common/include/itkImageKernelOperator.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,10 @@ class ITK_TEMPLATE_EXPORT ImageKernelOperator : public NeighborhoodOperator<TPix
6868
const ImageType *
6969
GetImageKernel() const;
7070

71-
/** Prints information about the object. */
7271
void
73-
PrintSelf(std::ostream & os, Indent i) const override
72+
PrintSelf(std::ostream & os, Indent indent) const override
7473
{
75-
os << i << "ImageKernelOperator { this=" << this << "} " << std::endl;
76-
Superclass::PrintSelf(os, i.GetNextIndent());
74+
Superclass::PrintSelf(os, indent);
7775
}
7876

7977
protected:

Modules/Core/Common/include/itkLaplacianOperator.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ class ITK_TEMPLATE_EXPORT LaplacianOperator : public NeighborhoodOperator<TPixel
8888
void
8989
CreateOperator();
9090

91-
/** Prints some debugging information */
9291
void
93-
PrintSelf(std::ostream & os, Indent i) const override
92+
PrintSelf(std::ostream & os, Indent indent) const override
9493
{
95-
os << i << "LaplacianOperator { this=" << this << "}" << std::endl;
96-
Superclass::PrintSelf(os, i.GetNextIndent());
94+
Superclass::PrintSelf(os, indent);
95+
96+
os << indent << "DerivativeScalings: " << m_DerivativeScalings << std::endl;
9797
}
9898

9999
/** Sets the weights that are applied to the derivative in each axial

Modules/Core/Common/include/itkNeighborhoodOperator.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ class ITK_TEMPLATE_EXPORT NeighborhoodOperator : public Neighborhood<TPixel, VDi
129129
virtual void
130130
FlipAxes();
131131

132-
/** Prints some debugging information. */
133132
void
134-
PrintSelf(std::ostream & os, Indent i) const override
133+
PrintSelf(std::ostream & os, Indent indent) const override
135134
{
136-
os << i << "NeighborhoodOperator { this=" << this << " Direction = " << m_Direction << " }" << std::endl;
137-
Superclass::PrintSelf(os, i.GetNextIndent());
135+
Superclass::PrintSelf(os, indent);
136+
137+
os << indent << "Direction: " << m_Direction << std::endl;
138138
}
139139

140140
/** Multiplies all of the coefficients of the kernel by a single scalar value.

Modules/Core/Common/include/itkSobelOperator.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,10 @@ class ITK_TEMPLATE_EXPORT SobelOperator : public NeighborhoodOperator<TPixel, VD
120120
* \sa CreateDirectional \sa Fill */
121121
// virtual void CreateToRadius(const unsigned long);
122122

123-
124-
/**
125-
* Prints some debugging information
126-
*/
127123
void
128-
PrintSelf(std::ostream & os, Indent i) const override
124+
PrintSelf(std::ostream & os, Indent indent) const override
129125
{
130-
os << i << "SobelOperator { this=" << this << "}" << std::endl;
131-
Superclass::PrintSelf(os, i.GetNextIndent());
126+
Superclass::PrintSelf(os, indent);
132127
}
133128

134129
protected:

0 commit comments

Comments
 (0)