Skip to content

Commit

Permalink
STYLE: Improve ivar printing style
Browse files Browse the repository at this point in the history
Improve ivar printing style. Specifically:
- Use `indent.GetNextIndent()` to get the next indent value when
  printing the elements of a list or array.
- Add missing calls to indentation.
- Do not print unnecessary characters (e.g. `">>>>>>>>>"`).
  • Loading branch information
jhlegarreta committed Jul 24, 2023
1 parent 9baa34b commit 4ca8106
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Expand Up @@ -25,14 +25,14 @@ ConstShapedNeighborhoodIterator<TImage, TBoundaryCondition>::PrintSelf(std::ostr
{
Superclass::PrintSelf(os, indent);

os << "ActiveIndexList: [";
os << indent << "ActiveIndexList: [";
for (auto it = m_ActiveIndexList.begin(); it != m_ActiveIndexList.end(); ++it)
{
os << *it << ' ';
os << indent.GetNextIndent() << *it << ' ';
}
os << "] ";

os << "CenterIsActive: " << (m_CenterIsActive ? "On" : "Off") << std::endl;
os << indent << "CenterIsActive: " << (m_CenterIsActive ? "On" : "Off") << std::endl;
}

template <typename TImage, typename TBoundaryCondition>
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkNeighborhood.hxx
Expand Up @@ -133,14 +133,14 @@ Neighborhood<TPixel, VDimension, TContainer>::PrintSelf(std::ostream & os, Inden
os << indent << "StrideTable: [ ";
for (DimensionValueType i = 0; i < VDimension; ++i)
{
os << m_StrideTable[i] << ' ';
os << indent.GetNextIndent() << m_StrideTable[i] << ' ';
}
os << ']' << std::endl;

os << indent << "OffsetTable: [ ";
for (DimensionValueType i = 0; i < m_OffsetTable.size(); ++i)
{
os << m_OffsetTable[i] << ' ';
os << indent.GetNextIndent() << m_OffsetTable[i] << ' ';
}
os << ']' << std::endl;
}
Expand Down
6 changes: 3 additions & 3 deletions Modules/Core/Transform/include/itkCompositeTransform.hxx
Expand Up @@ -963,16 +963,16 @@ CompositeTransform<TParametersValueType, VDimension>::PrintSelf(std::ostream & o
os << indent << "TransformsToOptimizeFlags: " << std::endl << indent << indent;
for (auto it = m_TransformsToOptimizeFlags.begin(); it != m_TransformsToOptimizeFlags.end(); ++it)
{
os << *it << ' ';
os << indent.GetNextIndent() << *it << ' ';
}
os << std::endl;

os << indent << "TransformsToOptimizeQueue: " << std::endl;
typename TransformQueueType::const_iterator cit;
for (cit = m_TransformsToOptimizeQueue.begin(); cit != m_TransformsToOptimizeQueue.end(); ++cit)
{
os << indent << ">>>>>>>>>" << std::endl;
(*cit)->Print(os, indent);
(*cit)->Print(os, indent.GetNextIndent());
os << std::endl;
}

os << indent << "PreviousTransformsToOptimizeUpdateTime: "
Expand Down
Expand Up @@ -1168,7 +1168,7 @@ FlatStructuringElement<VDimension>::PrintSelf(std::ostream & os, Indent indent)
os << "Lines: " << std::endl;
for (unsigned int i = 0; i < m_Lines.size(); ++i)
{
os << indent << m_Lines[i] << std::endl;
os << indent.GetNextIndent() << m_Lines[i] << std::endl;
}

os << indent << "RadiusIsParametric: " << (m_RadiusIsParametric ? "On" : "Off") << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions Modules/Numerics/Statistics/include/itkHistogram.hxx
Expand Up @@ -689,7 +689,7 @@ Histogram<TMeasurement, TFrequencyContainer>::PrintSelf(std::ostream & os, Inden
{
for (const auto & elem : elemVec)
{
os << indent << "[" << &elem - &*(elemVec.begin())
os << indent.GetNextIndent() << "[" << &elem - &*(elemVec.begin())
<< "]: " << static_cast<typename NumericTraits<MeasurementType>::PrintType>(elem) << std::endl;
}
}
Expand All @@ -699,7 +699,7 @@ Histogram<TMeasurement, TFrequencyContainer>::PrintSelf(std::ostream & os, Inden
{
for (const auto & elem : elemVec)
{
os << indent << "[" << &elem - &*(elemVec.begin())
os << indent.GetNextIndent() << "[" << &elem - &*(elemVec.begin())
<< "]: " << static_cast<typename NumericTraits<MeasurementType>::PrintType>(elem) << std::endl;
}
}
Expand Down
Expand Up @@ -1202,7 +1202,7 @@ ImageRegistrationMethodv4<TFixedImage, TMovingImage, TTransform, TVirtualImage,
os << indent << "TransformParametersAdaptorsPerLevel: ";
for (const auto & val : m_TransformParametersAdaptorsPerLevel)
{
os << val << " ";
os << indent.GetNextIndent() << val << " ";
}
os << std::endl;

Expand Down
Expand Up @@ -43,7 +43,7 @@ ClassifierBase<TDataContainer>::PrintSelf(std::ostream & os, Indent indent) cons
os << indent << "MembershipFunctions: " << std::endl;
for (unsigned int i = 0; i < m_MembershipFunctions.size(); ++i)
{
os << indent << m_MembershipFunctions[i] << std::endl;
os << indent.GetNextIndent() << m_MembershipFunctions[i] << std::endl;
}
}

Expand Down

0 comments on commit 4ca8106

Please sign in to comment.