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

replace itkstaticconstmacro with constexpr #1833

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Examples/antsCommandIterationUpdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class antsCommandIterationUpdate : public itk::Command
/**
* Run-time type information (and related methods).
*/
itkTypeMacro(antsCommandIterationUpdate, itk::Command);
itkOverrideGetNameOfClassMacro(antsCommandIterationUpdate);


/**
Expand Down
2 changes: 1 addition & 1 deletion Examples/itkantsRegistrationHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ class RegistrationHelper final : public itk::Object
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkTypeMacro(RegistrationHelper, Object);
itkOverrideGetNameOfClassMacro(RegistrationHelper);

/** Dimension of the image. This constant is used by functions that are
* templated over image type (as opposed to being templated over pixel type
Expand Down
4 changes: 2 additions & 2 deletions ImageRegistration/itkANTSAffine3DTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class ANTSAffine3DTransform final : public MatrixOffsetTransformBase<TScalarType
itkNewMacro(Self);

/** Run-time type information (and related methods). */
// itkTypeMacro( ANTSAffine3DTransform, Rigid3DTransform );
itkTypeMacro(ANTSAffine3DTransform, MatrixOffsetTransformBase);
// itkOverrideGetNameOfClassMacro( ANTSAffine3DTransform);
itkOverrideGetNameOfClassMacro(ANTSAffine3DTransform);

/** Dimension of parameters */
static constexpr unsigned int InputSpaceDimension = 3;
Expand Down
4 changes: 2 additions & 2 deletions ImageRegistration/itkANTSCenteredAffine2DTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class ANTSCenteredAffine2DTransform final
typedef SmartPointer<const Self> ConstPointer;

/** Run-time type information (and related methods). */
// itkTypeMacro( Rigid2DTransform, MatrixOffsetTransformBase );
itkTypeMacro(ANTSCenteredAffine2DTransform, MatrixOffsetTransformBase);
// itkOverrideGetNameOfClassMacro( Rigid2DTransform);
itkOverrideGetNameOfClassMacro(ANTSCenteredAffine2DTransform);

/** New macro for creation of through a Smart Pointer */
itkNewMacro(Self);
Expand Down
4 changes: 2 additions & 2 deletions ImageRegistration/itkANTSImageRegistrationOptimizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ ANTSImageRegistrationOptimizer<TDimension, TReal>::ComposeDiffs(DisplacementFiel
DisplacementFieldPointer fieldout,
TReal timesign)
{
typedef Point<TReal, itkGetStaticConstMacro(ImageDimension)> VPointType;
typedef Point<TReal, Self::ImageDimension> VPointType;

// field->SetSpacing( fieldtowarpby->GetSpacing() );
// field->SetOrigin( fieldtowarpby->GetOrigin() );
Expand Down Expand Up @@ -2597,7 +2597,7 @@ ANTSImageRegistrationOptimizer<TDimension, TReal>::IntegratePointVelocity(TReal
TReal finishtimein,
IndexType velind)
{
typedef Point<TReal, itkGetStaticConstMacro(ImageDimension + 1)> xPointType;
typedef Point<TReal, Self::ImageDimension + 1> xPointType;
this->m_Debug = false;


Expand Down
8 changes: 4 additions & 4 deletions ImageRegistration/itkANTSImageRegistrationOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ class ANTSImageRegistrationOptimizer final : public Object
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkTypeMacro(ANTSImageRegistrationOptimizer, Object);
itkOverrideGetNameOfClassMacro(ANTSImageRegistrationOptimizer);
static constexpr unsigned int Dimension = TDimension;
static constexpr unsigned int ImageDimension = TDimension;

typedef double TComp;
typedef TReal RealType;

typedef Image<RealType, itkGetStaticConstMacro(Dimension)> ImageType;
typedef Image<RealType, Self::Dimension> ImageType;
typedef typename ImageType::Pointer ImagePointer;

typedef itk::MatrixOffsetTransformBase<TComp, ImageDimension, ImageDimension> TransformType;
Expand Down Expand Up @@ -106,10 +106,10 @@ class ANTSImageRegistrationOptimizer final : public Object
typedef typename ParserType::OptionType OptionType;

typedef GeneralToBSplineDisplacementFieldFilter<DisplacementFieldType> BSplineFilterType;
typedef FixedArray<RealType, itkGetStaticConstMacro(ImageDimension)> ArrayType;
typedef FixedArray<RealType, Self::ImageDimension> ArrayType;

/** Typedefs for similarity metrics */
typedef ANTSSimilarityMetric<itkGetStaticConstMacro(Dimension), TReal> SimilarityMetricType;
typedef ANTSSimilarityMetric<Self::Dimension, TReal> SimilarityMetricType;
typedef typename SimilarityMetricType::Pointer SimilarityMetricPointer;
typedef std::vector<SimilarityMetricPointer> SimilarityMetricListType;

Expand Down
4 changes: 2 additions & 2 deletions ImageRegistration/itkANTSImageTransformation.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ class ANTSImageTransformation final : public Object

typedef double TComp;
/** Run-time type information (and related methods). */
itkTypeMacro(ANTSImageTransformation, Object);
itkOverrideGetNameOfClassMacro(ANTSImageTransformation);
static constexpr unsigned int Dimension = TDimension;
static constexpr unsigned int ImageDimension = TDimension;

typedef TReal RealType;
typedef Image<RealType, itkGetStaticConstMacro(Dimension)> ImageType;
typedef Image<RealType, Self::Dimension> ImageType;
/** declare transformation types */

typedef itk::MatrixOffsetTransformBase<TComp, TDimension, TDimension> AffineTransformType;
Expand Down
8 changes: 4 additions & 4 deletions ImageRegistration/itkANTSLabeledPointSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ class ANTSLabeledPointSet : public Object
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkTypeMacro(ANTSLabeledPointSet, Object);
itkOverrideGetNameOfClassMacro(ANTSLabeledPointSet);
static constexpr unsigned int Dimension = TDimension;

typedef float RealType;
typedef Image<RealType, itkGetStaticConstMacro(Dimension)> ImageType;
typedef Image<RealType, Self::Dimension> ImageType;
typedef typename ImageType::Pointer ImagePointer;
typedef Vector<RealType, itkGetStaticConstMacro(Dimension)> VectorType;
typedef Image<VectorType, itkGetStaticConstMacro(Dimension)> DisplacementFieldType;
typedef Vector<RealType, Self::Dimension> VectorType;
typedef Image<VectorType, Self::Dimension> DisplacementFieldType;

/** Point Types for landmarks and labeled point-sets */
typedef long PointDataVectorType;
Expand Down
8 changes: 4 additions & 4 deletions ImageRegistration/itkANTSSimilarityMetric.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ class ANTSSimilarityMetric final : public Object
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkTypeMacro(ANTSSimilarityMetric, Object);
itkOverrideGetNameOfClassMacro(ANTSSimilarityMetric);
static constexpr unsigned int Dimension = TDimension;

typedef TReal RealType;
typedef Image<RealType, itkGetStaticConstMacro(Dimension)> ImageType;
typedef Image<RealType, Self::Dimension> ImageType;
typedef typename ImageType::Pointer ImagePointer;
typedef Vector<RealType, itkGetStaticConstMacro(Dimension)> VectorType;
typedef Image<VectorType, itkGetStaticConstMacro(Dimension)> DisplacementFieldType;
typedef Vector<RealType, Self::Dimension> VectorType;
typedef Image<VectorType, Self::Dimension> DisplacementFieldType;

/** Point Types for landmarks and labeled point-sets */
typedef itk::ANTSLabeledPointSet<Dimension> LabeledPointSetType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class AvantsMutualInformationRegistrationFunction final
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkTypeMacro(AvantsMutualInformationRegistrationFunction, AvantsPDEDeformableRegistrationFunction);
itkOverrideGetNameOfClassMacro(AvantsMutualInformationRegistrationFunction);

/** MovingImage image type. */
typedef typename Superclass::MovingImageType MovingImageType;
Expand Down Expand Up @@ -172,7 +172,7 @@ class AvantsMutualInformationRegistrationFunction final
// DefaultInterpolatorType;

/** Covariant vector type. */
typedef CovariantVector<double, itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;
typedef CovariantVector<double, Self::ImageDimension> CovariantVectorType;

/** Gradient calculator type. */
typedef CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
Expand Down Expand Up @@ -227,8 +227,8 @@ class AvantsMutualInformationRegistrationFunction final

/** Types inherited from Superclass. */
typedef TranslationTransform<CoordinateRepresentationType,
// itkGetStaticConstMacro(ImageDimension),
itkGetStaticConstMacro(ImageDimension)>
// Self::ImageDimension,
Self::ImageDimension>
TransformType;

typedef ImageToImageMetric<TFixedImage, TMovingImage> Metricclass;
Expand Down Expand Up @@ -738,7 +738,7 @@ modified to round. 6- The normalization is done based on NomberOfHistogramBins-1
* image derivatives from the BSpline interpolator. Otherwise,
* image derivatives are computed using central differencing.
*/
typedef CovariantVector<double, itkGetStaticConstMacro(ImageDimension)> ImageDerivativesType;
typedef CovariantVector<double, Self::ImageDimension> ImageDerivativesType;

/** Boolean to indicate if the interpolator BSpline. */
bool m_InterpolatorIsBSpline;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AvantsPDEDeformableRegistrationFunction
typedef SmartPointer<const Self> ConstPointer;

/** Run-time type information (and related methods) */
itkTypeMacro(AvantsPDEDeformableRegistrationFunction, PDEDeformableRegistrationFunction);
itkOverrideGetNameOfClassMacro(AvantsPDEDeformableRegistrationFunction);

/** MovingImage image type. */
typedef TMovingImage MovingImageType;
Expand Down
10 changes: 5 additions & 5 deletions ImageRegistration/itkCrossCorrelationRegistrationFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CrossCorrelationRegistrationFunction final
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkTypeMacro(CrossCorrelationRegistrationFunction, AvantsPDEDeformableRegistrationFunction);
itkOverrideGetNameOfClassMacro(CrossCorrelationRegistrationFunction);

/** MovingImage image type. */
typedef typename Superclass::MovingImageType MovingImageType;
Expand All @@ -84,12 +84,12 @@ class CrossCorrelationRegistrationFunction final
typedef typename Superclass::DisplacementFieldTypePointer DisplacementFieldTypePointer;
typedef typename TDisplacementField::PixelType VectorType;

typedef CovariantVector<float, itkGetStaticConstMacro(ImageDimension)> GradientPixelType;
typedef Image<GradientPixelType, itkGetStaticConstMacro(ImageDimension)> GradientImageType;
typedef CovariantVector<float, Self::ImageDimension> GradientPixelType;
typedef Image<GradientPixelType, Self::ImageDimension> GradientImageType;
typedef SmartPointer<GradientImageType> GradientImagePointer;
typedef GradientRecursiveGaussianImageFilter<MetricImageType, GradientImageType> GradientImageFilterType;
typedef typename GradientImageFilterType::Pointer GradientImageFilterPointer;
typedef Image<float, itkGetStaticConstMacro(ImageDimension)> BinaryImageType;
typedef Image<float, Self::ImageDimension> BinaryImageType;
typedef typename BinaryImageType::Pointer BinaryImagePointer;

/** Inherit some enums from the superclass. */
Expand All @@ -111,7 +111,7 @@ class CrossCorrelationRegistrationFunction final
typedef LinearInterpolateImageFunction<MovingImageType, CoordRepType> DefaultInterpolatorType;

/** Covariant vector type. */
typedef CovariantVector<double, itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;
typedef CovariantVector<double, Self::ImageDimension> CovariantVectorType;

/** Gradient calculator type. */
typedef CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ExpectationBasedPointSetRegistrationFunction final
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkTypeMacro(ExpectationBasedPointSetRegistrationFunction, PDEDeformableRegistrationFunction);
itkOverrideGetNameOfClassMacro(ExpectationBasedPointSetRegistrationFunction);

/** MovingImage image type. */
using MovingImageType = typename Superclass::MovingImageType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class JensenHavrdaCharvatTsallisLabeledPointSetMetric : public PointSetToPointSe
itkNewMacro(Self);

/** Run-time type information (and related methods) */
itkTypeMacro(JensenHavrdaCharvatTsallisLabeledPointSetMetric, PointSetToLabelPointSetMetric);
itkOverrideGetNameOfClassMacro(JensenHavrdaCharvatTsallisLabeledPointSetMetric);

itkStaticConstMacro(PointDimension, unsigned int, TPointSet::PointDimension);
static constexpr unsigned int PointDimension = TPointSet::PointDimension;

/** Types transferred from the base class */
typedef typename Superclass::TransformType TransformType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class JensenHavrdaCharvatTsallisPointSetMetric : public PointSetToPointSetMetric
itkNewMacro(Self);

/** Run-time type information (and related methods) */
itkTypeMacro(JensenHavrdaCharvatTsallisPointSetMetric, PointSetToPointSetMetric);
itkOverrideGetNameOfClassMacro(JensenHavrdaCharvatTsallisPointSetMetric);

itkStaticConstMacro(PointDimension, unsigned int, TPointSet::PointDimension);
static constexpr unsigned int PointDimension = TPointSet::PointDimension;

/** Types transferred from the base class */
typedef typename Superclass::TransformType TransformType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class JensenTsallisBSplineRegistrationFunction
itkNewMacro(Self);

/** Run-time type information (and related methods) */
itkTypeMacro(JensenTsallisBSplineRegistrationFunction, AvantsPDEDeformableRegistrationFunction);
itkOverrideGetNameOfClassMacro(JensenTsallisBSplineRegistrationFunction);

/**
* Inherit some enums from the superclass.
*/
itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
itkStaticConstMacro(PointDimension, unsigned int, TFixedPointSet::PointDimension);
static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
static constexpr unsigned int PointDimension = TFixedPointSet::PointDimension;

typedef typename Superclass::NeighborhoodType NeighborhoodType;
typedef typename Superclass::FloatOffsetType FloatOffsetType;
Expand Down Expand Up @@ -87,7 +87,7 @@ class JensenTsallisBSplineRegistrationFunction
* BSpline typedefs
*/
/** Typedefs for B-spline filter */
typedef PointSet<VectorType, itkGetStaticConstMacro(ImageDimension)> BSplinePointSetType;
typedef PointSet<VectorType, Self::ImageDimension> BSplinePointSetType;
typedef BSplineScatteredDataPointSetToImageFilter<BSplinePointSetType, DisplacementFieldType> BSplineFilterType;
typedef typename BSplineFilterType::WeightsContainerType BSplineWeightsType;
typedef typename BSplineFilterType::PointDataImageType ControlPointLatticeType;
Expand Down
6 changes: 3 additions & 3 deletions ImageRegistration/itkPICSLAdvancedNormalizationToolKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ class PICSLAdvancedNormalizationToolKit final : public Object
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkTypeMacro(PICSLAdvancedNormalizationToolKit, Object);
itkOverrideGetNameOfClassMacro(PICSLAdvancedNormalizationToolKit);
static constexpr unsigned int Dimension = TDimension;
typedef double TComp;
typedef TReal RealType;
typedef Image<RealType, itkGetStaticConstMacro(Dimension)> ImageType;
typedef Image<RealType, Self::Dimension> ImageType;
typedef typename ImageType::Pointer ImagePointer;
typedef typename ImageType::PixelType PixelType;

Expand All @@ -63,7 +63,7 @@ class PICSLAdvancedNormalizationToolKit final : public Object
typedef typename LabeledPointSetType::PointSetType PointSetType;

/** Typedefs for similarity metrics */
typedef ANTSSimilarityMetric<itkGetStaticConstMacro(Dimension), TReal> SimilarityMetricType;
typedef ANTSSimilarityMetric<Self::Dimension, TReal> SimilarityMetricType;
typedef typename SimilarityMetricType::Pointer SimilarityMetricPointer;
typedef std::vector<SimilarityMetricPointer> SimilarityMetricListType;
typedef typename SimilarityMetricType::MetricType MetricBaseType;
Expand Down
10 changes: 5 additions & 5 deletions ImageRegistration/itkProbabilisticRegistrationFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ProbabilisticRegistrationFunction final
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkTypeMacro(ProbabilisticRegistrationFunction, AvantsPDEDeformableRegistrationFunction);
itkOverrideGetNameOfClassMacro(ProbabilisticRegistrationFunction);

/** MovingImage image type. */
typedef typename Superclass::MovingImageType MovingImageType;
Expand All @@ -84,12 +84,12 @@ class ProbabilisticRegistrationFunction final
typedef typename Superclass::DisplacementFieldTypePointer DisplacementFieldTypePointer;
typedef typename TDisplacementField::PixelType VectorType;

typedef CovariantVector<float, itkGetStaticConstMacro(ImageDimension)> GradientPixelType;
typedef Image<GradientPixelType, itkGetStaticConstMacro(ImageDimension)> GradientImageType;
typedef CovariantVector<float, Self::ImageDimension> GradientPixelType;
typedef Image<GradientPixelType, Self::ImageDimension> GradientImageType;
typedef SmartPointer<GradientImageType> GradientImagePointer;
typedef GradientRecursiveGaussianImageFilter<MetricImageType, GradientImageType> GradientImageFilterType;
typedef typename GradientImageFilterType::Pointer GradientImageFilterPointer;
typedef Image<float, itkGetStaticConstMacro(ImageDimension)> BinaryImageType;
typedef Image<float, Self::ImageDimension> BinaryImageType;
typedef typename BinaryImageType::Pointer BinaryImagePointer;

/** Inherit some enums from the superclass. */
Expand All @@ -111,7 +111,7 @@ class ProbabilisticRegistrationFunction final
typedef LinearInterpolateImageFunction<MovingImageType, CoordRepType> DefaultInterpolatorType;

/** Covariant vector type. */
typedef CovariantVector<double, itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;
typedef CovariantVector<double, Self::ImageDimension> CovariantVectorType;

/** Gradient calculator type. */
typedef CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
Expand Down
Loading
Loading