Skip to content

Commit

Permalink
Merge pull request #3 from jhlegarreta/PreferC++1TypeAliasOverTypedef
Browse files Browse the repository at this point in the history
STYLE: Prefer C++11 type alias over typedef.
  • Loading branch information
dzenanz authored Oct 23, 2018
2 parents 9053049 + 16e2971 commit 0081829
Show file tree
Hide file tree
Showing 13 changed files with 146 additions and 157 deletions.
37 changes: 18 additions & 19 deletions include/itkBSplineApproximationGradientImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,37 +55,36 @@ class ITK_TEMPLATE_EXPORT BSplineApproximationGradientImageFilter:

itkStaticConstMacro( ImageDimension, unsigned int, TInputImage::ImageDimension );

typedef BSplineApproximationGradientImageFilter Self;
using Self = BSplineApproximationGradientImageFilter;

typedef TInputImage InputImageType;
typedef Image< CovariantVector< TOutputValueType, ImageDimension >, ImageDimension > OutputImageType;
typedef typename OutputImageType::Pointer OutputImagePointer;
using InputImageType = TInputImage;
using OutputImageType = Image< CovariantVector< TOutputValueType, ImageDimension >, ImageDimension >;
using OutputImagePointer = typename OutputImageType::Pointer;

typedef ImageToImageFilter< InputImageType, OutputImageType > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
using Superclass = ImageToImageFilter< InputImageType, OutputImageType >;
using Pointer = SmartPointer< Self >;
using ConstPointer = SmartPointer< const Self >;

itkNewMacro( Self );

itkTypeMacro( BSplineApproximationGradientImageFilter, ImageToImageFilter );

typedef TOutputValueType OutputValueType;
typedef typename InputImageType::PixelType InputPixelType;
typedef PointSet< InputPixelType, itkGetStaticConstMacro(ImageDimension) > PointSetType;
using OutputValueType = TOutputValueType;
using InputPixelType = typename InputImageType::PixelType;
using PointSetType = PointSet< InputPixelType, itkGetStaticConstMacro(ImageDimension) >;

itkStaticConstMacro( InputVectorDimension, unsigned int, InputPixelType::Dimension );

/** Internal filter type */
/** Internal filter type */
typedef BSplineScatteredDataPointSetToGradientImageFilter< PointSetType, OutputValueType >
PointSetToGradientFilterType;
typedef typename PointSetToGradientFilterType::Pointer PointSetToGradientFilterPointerType;
typedef typename PointSetToGradientFilterType::ArrayType ArrayType;
typedef Mesh< InputPixelType, ImageDimension > MeshType;
typedef ImageToPointSetFilter< InputImageType, MeshType > ImageToPointSetFilterType;
typedef typename ImageToPointSetFilterType::Pointer ImageToPointSetFilterPointerType;

typedef FixedArray< double, itkGetStaticConstMacro(ImageDimension) > ControlPointSpacingRatioType;
using PointSetToGradientFilterType = BSplineScatteredDataPointSetToGradientImageFilter< PointSetType, OutputValueType >;
using PointSetToGradientFilterPointerType = typename PointSetToGradientFilterType::Pointer;
using ArrayType = typename PointSetToGradientFilterType::ArrayType;
using MeshType = Mesh< InputPixelType, ImageDimension >;
using ImageToPointSetFilterType = ImageToPointSetFilter< InputImageType, MeshType >;
using ImageToPointSetFilterPointerType = typename ImageToPointSetFilterType::Pointer;

using ControlPointSpacingRatioType = FixedArray< double, itkGetStaticConstMacro(ImageDimension) >;

/** Set/Get number of levels. This is the number of levels used in the
* BSplineScatteredDataPointSetToImageFilter for calculating the BSpline grid.
Expand Down
45 changes: 21 additions & 24 deletions include/itkBSplineGradientImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,35 +50,33 @@ class ITK_TEMPLATE_EXPORT BSplineGradientImageFilter :
/** Extract dimension from input image. */
itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);

/** Standard class typedefs. */
typedef BSplineGradientImageFilter Self;
/** Standard class type alias. */
using Self = BSplineGradientImageFilter;

/** Convenient typedefs for simplifying declarations. */
typedef TInputImage InputImageType;
typedef typename InputImageType::Pointer InputImagePointer;
typedef Image< CovariantVector<
/** Convenient type alias for simplifying declarations. */
using InputImageType = TInputImage;
using InputImagePointer = typename InputImageType::Pointer;
using OutputImageType = Image< CovariantVector<
TOutputValueType, ImageDimension >,
ImageDimension >
OutputImageType;
ImageDimension >;

/** Standard class typedefs. */
typedef ImageToImageFilter< InputImageType, OutputImageType > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Standard class type alias. */
using Superclass = ImageToImageFilter< InputImageType, OutputImageType >;
using Pointer = SmartPointer< Self >;
using ConstPointer = SmartPointer< const Self >;

/** Method for creation through the object factory. */
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkTypeMacro(BSplineGradientImageFilter, ImageToImageFilter);

/** Image typedef support. */
typedef typename InputImageType::PixelType InputPixelType;
typedef TOutputValueType OutputValueType;
typedef CovariantVector<
OutputValueType, itkGetStaticConstMacro(OutputImageDimension) >
OutputPixelType;
typedef typename OutputImageType::RegionType OutputImageRegionType;
/** Image type alias support. */
using InputPixelType = typename InputImageType::PixelType;
using OutputValueType = TOutputValueType;
using OutputPixelType = CovariantVector<
OutputValueType, itkGetStaticConstMacro(OutputImageDimension) >;
using OutputImageRegionType = typename OutputImageType::RegionType;

#ifdef ITK_USE_CONCEPT_CHECKING
/** Begin concept checking */
Expand All @@ -90,11 +88,10 @@ class ITK_TEMPLATE_EXPORT BSplineGradientImageFilter :
#endif

/** Typedefs for the interpolator. */
typedef TCoordRep CoordRepType;
typedef TCoefficientType CoefficientType;
typedef itk::BSplineInterpolateImageFunction< InputImageType, CoordRepType, CoefficientType >
InterpolatorType;
typedef typename InterpolatorType::Pointer InterpolatorPointerType;
using CoordRepType = TCoordRep;
using CoefficientType = TCoefficientType;
using InterpolatorType = itk::BSplineInterpolateImageFunction< InputImageType, CoordRepType, CoefficientType >;
using InterpolatorPointerType = typename InterpolatorType::Pointer;

protected:
BSplineGradientImageFilter();
Expand Down
2 changes: 1 addition & 1 deletion include/itkBSplineGradientImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ BSplineGradientImageFilter< TInputImage, TOutputValueType,
// This will calculate the coefficients.
interpolator->SetInputImage( inputPtr );

typedef typename itk::ImageRegionIteratorWithIndex< OutputImageType > IteratorType;
using IteratorType = typename itk::ImageRegionIteratorWithIndex< OutputImageType >;
typename OutputImageType::IndexType index;
typename InterpolatorType::ContinuousIndexType contIndex;
unsigned int i;
Expand Down
57 changes: 28 additions & 29 deletions include/itkBSplineScatteredDataPointSetToGradientImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,46 +62,45 @@ class BSplineScatteredDataPointSetToGradientImageFilter :
itkStaticConstMacro( PointSetDimension, unsigned int, TInputPointSet::PointDimension );
itkStaticConstMacro( ImageDimension, unsigned int, TInputPointSet::PointDimension );

/** Standard class typedefs. */
typedef BSplineScatteredDataPointSetToGradientImageFilter Self;

/** Convenient typedefs for simplifying declarations. */
typedef TInputPointSet InputPointSetType;
typedef typename InputPointSetType::Pointer InputPointSetPointer;
typedef Image< CovariantVector< TOutputValueType, itkGetStaticConstMacro(ImageDimension) >,
itkGetStaticConstMacro(ImageDimension) >
OutputImageType;
typedef typename OutputImageType::Pointer OutputImagePointer;

/** Standard class typedefs. */
typedef PointSetToImageFilter< InputPointSetType, OutputImageType > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Standard class type alias. */
using Self = BSplineScatteredDataPointSetToGradientImageFilter;

/** Convenient type alias for simplifying declarations. */
using InputPointSetType = TInputPointSet;
using InputPointSetPointer = typename InputPointSetType::Pointer;
using OutputImageType = Image< CovariantVector< TOutputValueType, itkGetStaticConstMacro(ImageDimension) >,
itkGetStaticConstMacro(ImageDimension) >;
using OutputImagePointer = typename OutputImageType::Pointer;

/** Standard class type alias. */
using Superclass = PointSetToImageFilter< InputPointSetType, OutputImageType >;
using Pointer = SmartPointer< Self >;
using ConstPointer = SmartPointer< const Self >;

/** Method for creation through the object factory. */
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkTypeMacro( BSplineScatteredDataPointSetToGradientImageFilter, PointSetToImageFilter );

/** Image typedef support. */
typedef typename InputPointSetType::PixelType InputPixelType;
/** Image type alias support. */
using InputPixelType = typename InputPointSetType::PixelType;
itkStaticConstMacro( InputVectorDimension, unsigned int, InputPixelType::Dimension );

typedef typename InputPointSetType::PointType InputPointType;
typedef TOutputValueType OutputValueType;
typedef CovariantVector< OutputValueType, ImageDimension > OutputPixelType;
typedef typename OutputImageType::RegionType OutputImageRegionType;
typedef typename itk::Image< InputPixelType, ImageDimension > InternalImageType;
using InputPointType = typename InputPointSetType::PointType;
using OutputValueType = TOutputValueType;
using OutputPixelType = CovariantVector< OutputValueType, ImageDimension >;
using OutputImageRegionType = typename OutputImageType::RegionType;
using InternalImageType = typename itk::Image< InputPixelType, ImageDimension >;

/** Internal filter type. */
typedef typename itk::BSplineScatteredDataPointSetToImageFilter< InputPointSetType,
InternalImageType > BSplineScatteredDataFilterType;
typedef typename BSplineScatteredDataFilterType::Pointer BSplineScatteredDataFilterPointerType;
using BSplineScatteredDataFilterType =
typename itk::BSplineScatteredDataPointSetToImageFilter< InputPointSetType, InternalImageType >;
using BSplineScatteredDataFilterPointerType = typename BSplineScatteredDataFilterType::Pointer;

typedef typename BSplineScatteredDataFilterType::ArrayType ArrayType;
using ArrayType = typename BSplineScatteredDataFilterType::ArrayType;

typedef BSplineControlPointImageFunction< InternalImageType > BSplineControlPointImageFunctionType;
using BSplineControlPointImageFunctionType = BSplineControlPointImageFunction< InternalImageType >;

void SetNumberOfLevels( unsigned int levels )
{
Expand Down Expand Up @@ -130,13 +129,13 @@ class BSplineScatteredDataPointSetToGradientImageFilter :


/** Type of the outputs. */
typedef ProcessObject::DataObjectPointerArray DataObjectPointerArray;
using DataObjectPointerArray = ProcessObject::DataObjectPointerArray;

protected:
/** This is not a CovariantVector, but a VariableSizeMatrix where every row
* corresponds to components of the input data vector, and every column
* corresponds to the gradient component in each direction. */
typedef typename BSplineControlPointImageFunctionType::GradientType InternalGradientType;
using InternalGradientType = typename BSplineControlPointImageFunctionType::GradientType;

BSplineScatteredDataPointSetToGradientImageFilter();
virtual ~BSplineScatteredDataPointSetToGradientImageFilter() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ BSplineScatteredDataPointSetToGradientImageFilter< TInputPointSet, TOutputValueT
bspliner->SetOrigin( this->m_BSplineScatteredDataFilter->GetOrigin() );
bspliner->SetInputImage( this->m_BSplineScatteredDataFilter->GetPhiLattice() );

typedef typename itk::ImageRegionIteratorWithIndex< OutputImageType >
OutputIteratorType;
using OutputIteratorType = typename itk::ImageRegionIteratorWithIndex< OutputImageType >;
InternalGradientType gradient;
OutputPixelType gradientPixel;
typename OutputImageType::PointType point;
Expand All @@ -147,8 +146,8 @@ BSplineScatteredDataPointSetToGradientImageFilter< TInputPointSet, TOutputValueT
// We check to make sure we not ad the boundary of the image, because we get
// weird edge effects and sometime we try to evaluate outside the BSpline
// grid.
typedef typename NeighborhoodAlgorithm::
ImageBoundaryFacesCalculator< OutputImageType > FaceCalculatorType;
using FaceCalculatorType = typename NeighborhoodAlgorithm::
ImageBoundaryFacesCalculator< OutputImageType >;
FaceCalculatorType faceCalculator;
typename FaceCalculatorType::RadiusType radius;
radius.Fill( 1 );
Expand Down
22 changes: 11 additions & 11 deletions include/itkImageToImageOfVectorsFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,25 @@ class ITK_TEMPLATE_EXPORT ImageToImageOfVectorsFilter :
public:
ITK_DISALLOW_COPY_AND_ASSIGN(ImageToImageOfVectorsFilter);

typedef ImageToImageFilter< TInputImage,
using Superclass = ImageToImageFilter< TInputImage,
Image< Vector< typename TInputImage::InternalPixelType,
NComponents >, TInputImage::ImageDimension > > Superclass;
typedef ImageToImageOfVectorsFilter Self;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
NComponents >, TInputImage::ImageDimension > >;
using Self = ImageToImageOfVectorsFilter;
using Pointer = SmartPointer< Self >;
using ConstPointer = SmartPointer< const Self >;
itkNewMacro( Self );
itkTypeMacro( ImageToImageOfVectorsFilter, ImageToImageFilter );

typedef TInputImage InputImageType;
using InputImageType = TInputImage;
itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);

typedef typename InputImageType::InternalPixelType InputPixelType;
using InputPixelType = typename InputImageType::InternalPixelType;

typedef Vector< InputPixelType, NComponents > OutputPixelType;
typedef Image< OutputPixelType, ImageDimension > OutputImageType;
typedef typename OutputImageType::RegionType RegionType;
using OutputPixelType = Vector< InputPixelType, NComponents >;
using OutputImageType = Image< OutputPixelType, ImageDimension >;
using RegionType = typename OutputImageType::RegionType;

typedef typename Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
using DataObjectPointerArraySizeType = typename Superclass::DataObjectPointerArraySizeType;

virtual void SetNthInput(DataObjectPointerArraySizeType idx, const InputImageType *inputImage)
{ this->SetInput(idx, inputImage); }
Expand Down
2 changes: 1 addition & 1 deletion include/itkImageToImageOfVectorsFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ImageToImageOfVectorsFilter< TInputImage, NComponents >
ImageRegionIterator< OutputImageType > oit( outputImage, outputRegionForThread );
oit.GoToBegin();

typedef ImageRegionConstIterator< InputImageType > InputIteratorType;
using InputIteratorType = ImageRegionConstIterator< InputImageType >;
std::vector< InputIteratorType * > inputItContainer;

for ( unsigned int i = 0; i < NComponents; i++ )
Expand Down
42 changes: 21 additions & 21 deletions include/itkImageToPointSetFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,35 @@ class ITK_TEMPLATE_EXPORT ImageToPointSetFilter: public ImageToMeshFilter< TInpu
public:
ITK_DISALLOW_COPY_AND_ASSIGN(ImageToPointSetFilter);

/** Standard class typedefs. */
typedef ImageToPointSetFilter Self;
typedef ImageToMeshFilter< TInputImage, TOutputMesh > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Standard class type alias. */
using Self = ImageToPointSetFilter;
using Superclass = ImageToMeshFilter< TInputImage, TOutputMesh >;
using Pointer = SmartPointer< Self >;
using ConstPointer = SmartPointer< const Self >;

/** Method for creation through the object factory. */
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkTypeMacro(ImageToPointSetFilter, ImageToMeshFilter);

/** Some convenient typedefs. */
typedef TInputImage InputImageType;
typedef typename InputImageType::ConstPointer InputImageConstPointer;
typedef typename InputImageType::RegionType InputImageRegionType;
typedef typename InputImageType::PixelType InputImagePixelType;
/** Some convenient type alias. */
using InputImageType = TInputImage;
using InputImageConstPointer = typename InputImageType::ConstPointer;
using InputImageRegionType = typename InputImageType::RegionType;
using InputImagePixelType = typename InputImageType::PixelType;

/** Some typedefs associated with the output mesh. */
typedef TOutputMesh OutputMeshType;
typedef typename OutputMeshType::PointType PointType;
typedef typename OutputMeshType::Pointer OutputMeshPointer;
typedef typename OutputMeshType::PointsContainer PointsContainer;
typedef typename OutputMeshType::PointIdentifier PointIdentifier;
typedef typename PointsContainer::Pointer PointsContainerPointer;
typedef typename PointsContainer::Iterator PointsContainerIterator;
typedef typename OutputMeshType::PointDataContainer PointDataContainer;
typedef typename PointDataContainer::Pointer PointDataContainerPointer;
typedef typename PointDataContainer::Iterator PointDataContainerIterator;
/** Some type alias associated with the output mesh. */
using OutputMeshType = TOutputMesh;
using PointType = typename OutputMeshType::PointType;
using OutputMeshPointer = typename OutputMeshType::Pointer;
using PointsContainer = typename OutputMeshType::PointsContainer;
using PointIdentifier = typename OutputMeshType::PointIdentifier;
using PointsContainerPointer = typename PointsContainer::Pointer;
using PointsContainerIterator = typename PointsContainer::Iterator;
using PointDataContainer = typename OutputMeshType::PointDataContainer;
using PointDataContainerPointer = typename PointDataContainer::Pointer;
using PointDataContainerIterator = typename PointDataContainer::Iterator;

/** The dimension of the output mesh. */
itkStaticConstMacro(PointDimension, unsigned int, TOutputMesh::PointDimension);
Expand Down
Loading

0 comments on commit 0081829

Please sign in to comment.