Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overload the stream insertion operator for types that are missing it #513

jhlegarreta opened this Issue Feb 16, 2019 · 0 comments


None yet
1 participant
Copy link

jhlegarreta commented Feb 16, 2019


Overload the stream insertion operator for types that are missing it.

Expected behavior

To be able to print any data structure with a single line, e.g.:

os << indent << "MyStructure : " << m_MyStructure << std::endl;

Actual behavior

Developer's are forced to iterate over such structures to get them printed (usually in the PrintSelf method), e.g.:

  while( it != m_CirclesList.end() )
    os << indent << "[" << i << "]: " << *it << std::endl;

Additional information

Some fundamental ITK types (e.g. IndexTypes, SizeType, SpacingType, OffsetType, DirectionType, OffsetTable, RegionType) either seem not to have such an overload or it is just because some filters (itkImageConstIteratorWithIndex.h, itkImageIORegion.h, itkNeighborhood.h, itkImportImageFilter.h, itkConstNeighborhoodIterator.h , itkImportImageFilter.hxx, itkDisplacementFieldJacobianDeterminantFilter.h, itkGaussianBlurImageFunction.h, itkEllipsoidInteriorExteriorSpatialFunction.h`) that declare ivars of such types are not using the correct types, since it looks weird that such fundamental types do not have the stream insertion operator overload.

Other more exotic type aliases (GradientType, StrideTable, SeedsContainerType, WeightsType, ErrorArrayType, ExtentArrayType) would also deserve some investigation, as well as other aliases that are not consistent with the toolkit convention for the intended use (e.g. InputType in itkEllipsoidInteriorExteriorSpatialFunction.h).

Finally, other data structures that are also missing such an overload are regular arrays, e.g.

double m_Sigma[ImageDimension2];

in itkBSplineControlPointImageFunction.h or itkGaussianDerivativeImageFuncton.h


double          m_Scale[NDimensions];

in itkScalableAffineTransform.h.

std::list types (e.g. itkHoughTransform2DCirclesImageFilter.h or itkHoughTransform2DLinesImageFilter.h).

Or vnl_matrix matrix (e.g. itkBSplineScatteredDataPointSetToImageFilter.h).

This is related to #512.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.