From 80dd6c2836cca7005e3a5b03090fd6d42db50caf Mon Sep 17 00:00:00 2001 From: Victor Poughon <victor.poughon@cnes.fr> Date: Wed, 15 May 2019 16:50:29 +0200 Subject: [PATCH] STYLE: prefer using to typedef in examples --- Examples/Application/ApplicationExample.cxx | 8 +- .../BasicFilters/BandMathFilterExample.cxx | 25 ++-- .../BandMathXImageFilterExample.cxx | 10 +- Examples/BasicFilters/DEMToRainbowExample.cxx | 36 ++--- Examples/BasicFilters/FrostImageFilter.cxx | 12 +- Examples/BasicFilters/HillShadingExample.cxx | 44 +++--- Examples/BasicFilters/IndexedToRGBExample.cxx | 28 ++-- Examples/BasicFilters/LeeImageFilter.cxx | 12 +- .../MeanShiftSegmentationFilterExample.cxx | 36 ++--- .../PrintableImageFilterExample.cxx | 14 +- .../BasicFilters/ScalingFilterExample.cxx | 24 ++-- Examples/ChangeDetection/CorrelChDet.cxx | 24 ++-- Examples/ChangeDetection/DiffChDet.cxx | 26 ++-- .../KullbackLeiblerDistanceChDet.cxx | 20 +-- .../KullbackLeiblerProfileChDet.cxx | 22 +-- .../MultivariateAlterationDetector.cxx | 22 +-- Examples/ChangeDetection/RatioChDet.cxx | 24 ++-- ...ClassificationMapRegularizationExample.cxx | 16 +-- ...haferFusionOfClassificationMapsExample.cxx | 30 ++--- .../SOMImageClassificationExample.cxx | 20 +-- .../SupervisedImageClassificationExample.cxx | 20 +-- Examples/DimensionReduction/ICAExample.cxx | 22 +-- Examples/DimensionReduction/MNFExample.cxx | 24 ++-- .../MaximumAutocorrelationFactor.cxx | 18 +-- Examples/DimensionReduction/NAPCAExample.cxx | 24 ++-- Examples/DimensionReduction/PCAExample.cxx | 22 +-- .../FineRegistrationImageFilterExample.cxx | 50 +++---- .../NCCRegistrationFilterExample.cxx | 50 +++---- .../StereoReconstructionExample.cxx | 44 +++--- .../AsymmetricFusionOfLineDetectorExample.cxx | 16 +-- .../CloudDetectionExample.cxx | 32 ++--- .../ComplexMomentPathExample.cxx | 8 +- .../ComplexMomentsImageFunctionExample.cxx | 12 +- .../CorrelationLineDetectorExample.cxx | 16 +-- .../FeatureExtraction/EdgeDensityExample.cxx | 22 +-- .../FlusserMomentsImageFunctionExample.cxx | 12 +- Examples/FeatureExtraction/HarrisExample.cxx | 34 ++--- .../HuMomentsImageFunctionExample.cxx | 12 +- .../LineSegmentDetectorExample.cxx | 14 +- Examples/FeatureExtraction/PanTexExample.cxx | 18 +-- .../RatioLineDetectorExample.cxx | 16 +-- .../RightAngleDetectionExample.cxx | 18 +-- Examples/FeatureExtraction/SFSExample.cxx | 16 +-- Examples/FeatureExtraction/SURFExample.cxx | 24 ++-- Examples/FeatureExtraction/TextureExample.cxx | 30 ++--- .../ThresholdToPointSetExample.cxx | 24 ++-- .../TouziEdgeDetectorExample.cxx | 16 +-- Examples/Filtering/CompositeFilterExample.cxx | 24 ++-- .../DanielssonDistanceMapImageFilter.cxx | 24 ++-- ...DerivativeRecursiveGaussianImageFilter.cxx | 16 +-- Examples/Fusion/BayesianFusionImageFilter.cxx | 34 ++--- Examples/Fusion/PanSharpeningExample.cxx | 34 ++--- .../HyperspectralUnmixingExample.cxx | 30 ++--- Examples/IO/ComplexImageReadWrite.cxx | 8 +- Examples/IO/DEMToImageGenerator.cxx | 26 ++-- Examples/IO/ExtractROI.cxx | 20 +-- Examples/IO/ImageReadCastWrite.cxx | 16 +-- .../IO/ImageReadRegionOfInterestWrite.cxx | 16 +-- Examples/IO/ImageReadWrite.cxx | 10 +- Examples/IO/ImageSeriesIOExample.cxx | 18 +-- Examples/IO/MetadataExample.cxx | 8 +- Examples/IO/MultibandImageReadWrite.cxx | 10 +- Examples/IO/VectorDataIOExample.cxx | 18 +-- Examples/Image/Image1.cxx | 4 +- Examples/Image/Image2.cxx | 8 +- Examples/Image/Image3.cxx | 4 +- Examples/Image/Image4.cxx | 6 +- Examples/Image/Image5.cxx | 12 +- Examples/Image/ImageListExample.cxx | 12 +- Examples/Image/VectorImage.cxx | 6 +- Examples/Installation/HelloWorld.cxx | 2 +- .../ImageLinearIteratorWithIndex.cxx | 12 +- .../ImageLinearIteratorWithIndex2.cxx | 36 ++--- .../ImageRandomConstIteratorWithIndex.cxx | 8 +- Examples/Iterators/ImageRegionIterator.cxx | 12 +- .../ImageRegionIteratorWithIndex.cxx | 10 +- .../Iterators/ImageSliceIteratorWithIndex.cxx | 14 +- Examples/Iterators/NeighborhoodIterators1.cxx | 18 +-- Examples/Iterators/NeighborhoodIterators2.cxx | 18 +-- Examples/Iterators/NeighborhoodIterators3.cxx | 20 +-- Examples/Iterators/NeighborhoodIterators4.cxx | 20 +-- Examples/Iterators/NeighborhoodIterators5.cxx | 20 +-- Examples/Iterators/NeighborhoodIterators6.cxx | 20 +-- .../ShapedNeighborhoodIterators1.cxx | 16 +-- .../ShapedNeighborhoodIterators2.cxx | 14 +- .../Learning/GenerateTrainingImageExample.cxx | 22 +-- .../Learning/SEMModelEstimatorExample.cxx | 26 ++-- Examples/Learning/SOMClassifierExample.cxx | 28 ++-- Examples/Learning/SOMExample.cxx | 46 +++---- ...ageEstimatorClassificationMultiExample.cxx | 38 +++--- ...nMachineLearningModelFromImagesExample.cxx | 24 ++-- ...MachineLearningModelFromSamplesExample.cxx | 14 +- .../Markov/MarkovClassification1Example.cxx | 26 ++-- .../Markov/MarkovClassification2Example.cxx | 28 ++-- .../Markov/MarkovClassification3Example.cxx | 40 +++--- .../Markov/MarkovRegularizationExample.cxx | 26 ++-- Examples/Markov/MarkovRestorationExample.cxx | 28 ++-- Examples/OBIA/HooverMetricsEstimation.cxx | 24 ++-- Examples/OBIA/LabelMapToVectorData.cxx | 20 +-- ...ometricAttributesLabelMapFilterExample.cxx | 52 ++++---- Examples/Patented/SIFTDensityExample.cxx | 24 ++-- .../Patented/SIFTDisparityMapEstimation.cxx | 48 +++---- Examples/Patented/SIFTExample.cxx | 22 +-- Examples/Patented/SIFTFastExample.cxx | 24 ++-- .../EstimateRPCSensorModelExample.cxx | 10 +- .../GeometriesProjectionExample.cxx | 14 +- .../Projections/OrthoRectificationExample.cxx | 17 +-- .../VectorDataExtractROIExample.cxx | 20 +-- .../VectorDataProjectionExample.cxx | 22 +-- ...lRAndBAndNIRVegetationIndexImageFilter.cxx | 34 ++--- ...lRAndGAndNIRVegetationIndexImageFilter.cxx | 34 ++--- .../AtmosphericCorrectionSequencement.cxx | 48 +++---- .../LAIAndPROSAILToSensorResponse.cxx | 125 +++++++++--------- .../Simulation/LAIFromNDVIImageTransform.cxx | 22 +-- Examples/Simulation/ProsailModel.cxx | 17 +-- Examples/Tutorials/FilteringPipeline.cxx | 14 +- Examples/Tutorials/HelloWorldOTB.cxx | 2 +- Examples/Tutorials/Multispectral.cxx | 30 ++--- Examples/Tutorials/OrthoFusion.cxx | 28 ++-- Examples/Tutorials/Pipeline.cxx | 10 +- Examples/Tutorials/ScalingPipeline.cxx | 24 ++-- 121 files changed, 1350 insertions(+), 1352 deletions(-) diff --git a/Examples/Application/ApplicationExample.cxx b/Examples/Application/ApplicationExample.cxx index b6ba4c7728..4c4f2179c4 100644 --- a/Examples/Application/ApplicationExample.cxx +++ b/Examples/Application/ApplicationExample.cxx @@ -42,10 +42,10 @@ public: // Class declaration is followed by \code{ITK} public types for the class, the superclass and // smart pointers. - typedef ApplicationExample Self; - typedef Application Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; + using Self = ApplicationExample; + using Superclass = Application; + using Pointer = itk::SmartPointer<Self>; + using ConstPointer = itk::SmartPointer<const Self>; // Following macros are necessary to respect ITK object factory mechanisms. Please report // to \ref{sec:FilterConventions} for additional information. diff --git a/Examples/BasicFilters/BandMathFilterExample.cxx b/Examples/BasicFilters/BandMathFilterExample.cxx index 98d13618c6..baaa6b931f 100644 --- a/Examples/BasicFilters/BandMathFilterExample.cxx +++ b/Examples/BasicFilters/BandMathFilterExample.cxx @@ -53,16 +53,16 @@ int main(int argc, char* argv[]) // writing the images. The BandMathImageFilter class // works with Image as input, so we need to define additional // filters to extract each layer of the multispectral image. - typedef double PixelType; - typedef otb::VectorImage<PixelType, 2> InputImageType; - typedef otb::Image<PixelType, 2> OutputImageType; - typedef otb::ImageList<OutputImageType> ImageListType; - typedef otb::VectorImageToImageListFilter<InputImageType, ImageListType> VectorImageToImageListType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using PixelType = double; + using InputImageType = otb::VectorImage<PixelType, 2>; + using OutputImageType = otb::Image<PixelType, 2>; + using ImageListType = otb::ImageList<OutputImageType>; + using VectorImageToImageListType = otb::VectorImageToImageListFilter<InputImageType, ImageListType>; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; // We can now define the type for the filter - typedef otb::BandMathImageFilter<OutputImageType> FilterType; + using FilterType = otb::BandMathImageFilter<OutputImageType>; // We instantiate the filter, the reader, and the writer ReaderType::Pointer reader = ReaderType::New(); @@ -107,11 +107,12 @@ int main(int argc, char* argv[]) writer->Update(); // The muParser library also provides the possibility to extend existing built-in functions. For example, - // you can use the OTB expression "ndvi(b3, b4)" with the filter. In this instance, the mathematical expression would be "if(ndvi(b3, b4)>0.4, 255, 0)", which would return the same result. + // you can use the OTB expression "ndvi(b3, b4)" with the filter. In this instance, the mathematical expression would be "if(ndvi(b3, b4)>0.4, 255, 0)", which + // would return the same result. - typedef otb::Image<unsigned char, 2> OutputPrettyImageType; - typedef otb::ImageFileWriter<OutputPrettyImageType> PrettyImageFileWriterType; - typedef itk::CastImageFilter<OutputImageType, OutputPrettyImageType> CastImageFilterType; + using OutputPrettyImageType = otb::Image<unsigned char, 2>; + using PrettyImageFileWriterType = otb::ImageFileWriter<OutputPrettyImageType>; + using CastImageFilterType = itk::CastImageFilter<OutputImageType, OutputPrettyImageType>; PrettyImageFileWriterType::Pointer prettyWriter = PrettyImageFileWriterType::New(); CastImageFilterType::Pointer caster = CastImageFilterType::New(); diff --git a/Examples/BasicFilters/BandMathXImageFilterExample.cxx b/Examples/BasicFilters/BandMathXImageFilterExample.cxx index 7978a9c30b..0837e9f4af 100644 --- a/Examples/BasicFilters/BandMathXImageFilterExample.cxx +++ b/Examples/BasicFilters/BandMathXImageFilterExample.cxx @@ -67,15 +67,15 @@ int main(int argc, char* argv[]) // writing the images. The \doxygen{otb}{BandMathXImageFilter} class // works with \doxygen{otb}{VectorImage}. - typedef double PixelType; - typedef otb::VectorImage<PixelType, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using PixelType = double; + using ImageType = otb::VectorImage<PixelType, 2>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; // We can now define the type for the filter: - typedef otb::BandMathXImageFilter<ImageType> FilterType; + using FilterType = otb::BandMathXImageFilter<ImageType>; // We instantiate the filter, the reader, and the writer: diff --git a/Examples/BasicFilters/DEMToRainbowExample.cxx b/Examples/BasicFilters/DEMToRainbowExample.cxx index fcceeae63c..7f8d627b63 100644 --- a/Examples/BasicFilters/DEMToRainbowExample.cxx +++ b/Examples/BasicFilters/DEMToRainbowExample.cxx @@ -52,23 +52,23 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - typedef double PixelType; - typedef unsigned char UCharPixelType; - typedef itk::RGBPixel<UCharPixelType> RGBPixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::Image<RGBPixelType, 2> RGBImageType; - typedef otb::ImageFileWriter<RGBImageType> WriterType; + using PixelType = double; + using UCharPixelType = unsigned char; + using RGBPixelType = itk::RGBPixel<UCharPixelType>; + using ImageType = otb::Image<PixelType, 2>; + using RGBImageType = otb::Image<RGBPixelType, 2>; + using WriterType = otb::ImageFileWriter<RGBImageType>; WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[1]); - typedef otb::DEMToImageGenerator<ImageType> DEMToImageGeneratorType; + using DEMToImageGeneratorType = otb::DEMToImageGenerator<ImageType>; DEMToImageGeneratorType::Pointer demToImage = DEMToImageGeneratorType::New(); - typedef DEMToImageGeneratorType::SizeType SizeType; - typedef DEMToImageGeneratorType::SpacingType SpacingType; - typedef DEMToImageGeneratorType::PointType PointType; + using SizeType = DEMToImageGeneratorType::SizeType; + using SpacingType = DEMToImageGeneratorType::SpacingType; + using PointType = DEMToImageGeneratorType::PointType; otb::DEMHandler::Instance()->OpenDEMDirectory(argv[8]); @@ -94,14 +94,14 @@ int main(int argc, char* argv[]) // the filter in charge of calling the functor we specify to do the work for // each pixel. Here it is the ScalarToRainbowRGBPixelFunctor. - typedef itk::ScalarToRGBColormapImageFilter<ImageType, RGBImageType> ColorMapFilterType; - ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); + using ColorMapFilterType = itk::ScalarToRGBColormapImageFilter<ImageType, RGBImageType>; + ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); colormapper->UseInputImageExtremaForScalingOff(); if (argc == 9) { - typedef otb::Functor::ScalarToRainbowRGBPixelFunctor<PixelType, RGBPixelType> ColorMapFunctorType; - ColorMapFunctorType::Pointer colormap = ColorMapFunctorType::New(); + using ColorMapFunctorType = otb::Functor::ScalarToRainbowRGBPixelFunctor<PixelType, RGBPixelType>; + ColorMapFunctorType::Pointer colormap = ColorMapFunctorType::New(); colormap->SetMinimumInputValue(0); colormap->SetMaximumInputValue(4000); colormapper->SetColormap(colormap); @@ -111,16 +111,16 @@ int main(int argc, char* argv[]) { if (strcmp(argv[9], "hot") == 0) { - typedef itk::Function::HotColormapFunction<PixelType, RGBPixelType> ColorMapFunctorType; - ColorMapFunctorType::Pointer colormap = ColorMapFunctorType::New(); + using ColorMapFunctorType = itk::Function::HotColormapFunction<PixelType, RGBPixelType>; + ColorMapFunctorType::Pointer colormap = ColorMapFunctorType::New(); colormap->SetMinimumInputValue(0); colormap->SetMaximumInputValue(4000); colormapper->SetColormap(colormap); } else { - typedef otb::Functor::ReliefColormapFunctor<PixelType, RGBPixelType> ColorMapFunctorType; - ColorMapFunctorType::Pointer colormap = ColorMapFunctorType::New(); + using ColorMapFunctorType = otb::Functor::ReliefColormapFunctor<PixelType, RGBPixelType>; + ColorMapFunctorType::Pointer colormap = ColorMapFunctorType::New(); colormap->SetMinimumInputValue(0); colormap->SetMaximumInputValue(4000); colormapper->SetColormap(colormap); diff --git a/Examples/BasicFilters/FrostImageFilter.cxx b/Examples/BasicFilters/FrostImageFilter.cxx index 913ac71a27..500daaa5f3 100644 --- a/Examples/BasicFilters/FrostImageFilter.cxx +++ b/Examples/BasicFilters/FrostImageFilter.cxx @@ -39,14 +39,14 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - typedef unsigned char PixelType; - typedef otb::Image<PixelType, 2> InputImageType; - typedef otb::Image<PixelType, 2> OutputImageType; + using PixelType = unsigned char; + using InputImageType = otb::Image<PixelType, 2>; + using OutputImageType = otb::Image<PixelType, 2>; // The filter can be instantiated using the image types defined previously. - typedef otb::FrostImageFilter<InputImageType, OutputImageType> FilterType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using FilterType = otb::FrostImageFilter<InputImageType, OutputImageType>; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; ReaderType::Pointer reader = ReaderType::New(); FilterType::Pointer filter = FilterType::New(); diff --git a/Examples/BasicFilters/HillShadingExample.cxx b/Examples/BasicFilters/HillShadingExample.cxx index a281e9aef8..053767bcad 100644 --- a/Examples/BasicFilters/HillShadingExample.cxx +++ b/Examples/BasicFilters/HillShadingExample.cxx @@ -48,14 +48,14 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - typedef double PixelType; - typedef unsigned char UCharPixelType; - typedef itk::RGBPixel<UCharPixelType> RGBPixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::Image<RGBPixelType, 2> RGBImageType; - typedef otb::Image<UCharPixelType, 2> ScalarImageType; - typedef otb::ImageFileWriter<RGBImageType> WriterType; - typedef otb::ImageFileWriter<ScalarImageType> ScalarWriterType; + using PixelType = double; + using UCharPixelType = unsigned char; + using RGBPixelType = itk::RGBPixel<UCharPixelType>; + using ImageType = otb::Image<PixelType, 2>; + using RGBImageType = otb::Image<RGBPixelType, 2>; + using ScalarImageType = otb::Image<UCharPixelType, 2>; + using WriterType = otb::ImageFileWriter<RGBImageType>; + using ScalarWriterType = otb::ImageFileWriter<ScalarImageType>; ScalarWriterType::Pointer writer = ScalarWriterType::New(); writer->SetFileName(argv[1]); @@ -63,13 +63,13 @@ int main(int argc, char* argv[]) WriterType::Pointer writer2 = WriterType::New(); writer2->SetFileName(argv[2]); - typedef otb::DEMToImageGenerator<ImageType> DEMToImageGeneratorType; + using DEMToImageGeneratorType = otb::DEMToImageGenerator<ImageType>; DEMToImageGeneratorType::Pointer demToImage = DEMToImageGeneratorType::New(); - typedef DEMToImageGeneratorType::SizeType SizeType; - typedef DEMToImageGeneratorType::SpacingType SpacingType; - typedef DEMToImageGeneratorType::PointType PointType; + using SizeType = DEMToImageGeneratorType::SizeType; + using SpacingType = DEMToImageGeneratorType::SpacingType; + using PointType = DEMToImageGeneratorType::PointType; otb::DEMHandler::Instance()->OpenDEMDirectory(argv[9]); @@ -113,35 +113,35 @@ int main(int argc, char* argv[]) // operations in its neighborhood. A convenient filter called \doxygen{otb}{HillShadingFilter} // is defined around this mechanism. - typedef otb::HillShadingFilter<ImageType, ImageType> HillShadingFilterType; - HillShadingFilterType::Pointer hillShading = HillShadingFilterType::New(); + using HillShadingFilterType = otb::HillShadingFilter<ImageType, ImageType>; + HillShadingFilterType::Pointer hillShading = HillShadingFilterType::New(); hillShading->SetRadius(1); hillShading->SetInput(demToImage->GetOutput()); hillShading->GetFunctor().SetXRes(res); hillShading->GetFunctor().SetYRes(res); - typedef itk::ShiftScaleImageFilter<ImageType, ScalarImageType> RescalerType; - RescalerType::Pointer rescaler = RescalerType::New(); + using RescalerType = itk::ShiftScaleImageFilter<ImageType, ScalarImageType>; + RescalerType::Pointer rescaler = RescalerType::New(); rescaler->SetScale(255.0); rescaler->SetInput(hillShading->GetOutput()); writer->SetInput(rescaler->GetOutput()); - typedef itk::ScalarToRGBColormapImageFilter<ImageType, RGBImageType> ColorMapFilterType; - ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); + using ColorMapFilterType = itk::ScalarToRGBColormapImageFilter<ImageType, RGBImageType>; + ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); colormapper->UseInputImageExtremaForScalingOff(); - typedef otb::Functor::ReliefColormapFunctor<PixelType, RGBPixelType> ColorMapFunctorType; - ColorMapFunctorType::Pointer colormap = ColorMapFunctorType::New(); + using ColorMapFunctorType = otb::Functor::ReliefColormapFunctor<PixelType, RGBPixelType>; + ColorMapFunctorType::Pointer colormap = ColorMapFunctorType::New(); colormap->SetMinimumInputValue(0); colormap->SetMaximumInputValue(4000); colormapper->SetColormap(colormap); colormapper->SetInput(demToImage->GetOutput()); - typedef itk::BinaryFunctorImageFilter<RGBImageType, ImageType, RGBImageType, otb::Functor::HillShadeModulationFunctor<RGBPixelType, PixelType, RGBPixelType>> - MultiplyFilterType; + using MultiplyFilterType = + itk::BinaryFunctorImageFilter<RGBImageType, ImageType, RGBImageType, otb::Functor::HillShadeModulationFunctor<RGBPixelType, PixelType, RGBPixelType>>; MultiplyFilterType::Pointer multiply = MultiplyFilterType::New(); multiply->SetInput1(colormapper->GetOutput()); diff --git a/Examples/BasicFilters/IndexedToRGBExample.cxx b/Examples/BasicFilters/IndexedToRGBExample.cxx index d7a8226949..05a1e15bee 100644 --- a/Examples/BasicFilters/IndexedToRGBExample.cxx +++ b/Examples/BasicFilters/IndexedToRGBExample.cxx @@ -43,37 +43,37 @@ int main(int argc, char* argv[]) const char* outputRGBFilename = argv[2]; const char* outputScaledFilename = argv[3]; - typedef otb::Image<unsigned long, 2> ImageType; - typedef otb::Image<itk::RGBPixel<unsigned char>, 2> RGBImageType; + using ImageType = otb::Image<unsigned long, 2>; + using RGBImageType = otb::Image<itk::RGBPixel<unsigned char>, 2>; - typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); + using ReaderType = otb::ImageFileReader<ImageType>; + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFilename); // The UnaryFunctorImageFilter is the filter in charge of calling the functor // we specify to do the work for each pixel. Here it is the ScalarToRGBPixelFunctor - typedef itk::Functor::ScalarToRGBPixelFunctor<unsigned long> ColorMapFunctorType; - typedef itk::UnaryFunctorImageFilter<ImageType, RGBImageType, ColorMapFunctorType> ColorMapFilterType; - ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); + using ColorMapFunctorType = itk::Functor::ScalarToRGBPixelFunctor<unsigned long>; + using ColorMapFilterType = itk::UnaryFunctorImageFilter<ImageType, RGBImageType, ColorMapFunctorType>; + ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); colormapper->SetInput(reader->GetOutput()); - typedef otb::ImageFileWriter<RGBImageType> WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = otb::ImageFileWriter<RGBImageType>; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outputRGBFilename); writer->SetInput(colormapper->GetOutput()); writer->Update(); // The following is just to produce the input image for the software guide - typedef otb::Image<unsigned char, 2> OutputImageType; - typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> RescalerType; - RescalerType::Pointer rescaler = RescalerType::New(); + using OutputImageType = otb::Image<unsigned char, 2>; + using RescalerType = itk::RescaleIntensityImageFilter<ImageType, OutputImageType>; + RescalerType::Pointer rescaler = RescalerType::New(); rescaler->SetInput(reader->GetOutput()); - typedef otb::ImageFileWriter<OutputImageType> UCharWriterType; - UCharWriterType::Pointer writer2 = UCharWriterType::New(); + using UCharWriterType = otb::ImageFileWriter<OutputImageType>; + UCharWriterType::Pointer writer2 = UCharWriterType::New(); writer2->SetFileName(outputScaledFilename); writer2->SetInput(rescaler->GetOutput()); writer2->Update(); diff --git a/Examples/BasicFilters/LeeImageFilter.cxx b/Examples/BasicFilters/LeeImageFilter.cxx index d8c7aa947d..2a1be0839f 100644 --- a/Examples/BasicFilters/LeeImageFilter.cxx +++ b/Examples/BasicFilters/LeeImageFilter.cxx @@ -38,22 +38,22 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - typedef unsigned char PixelType; + using PixelType = unsigned char; // The images are defined using the pixel type and the dimension. - typedef otb::Image<PixelType, 2> InputImageType; - typedef otb::Image<PixelType, 2> OutputImageType; + using InputImageType = otb::Image<PixelType, 2>; + using OutputImageType = otb::Image<PixelType, 2>; // The filter can be instantiated using the image types defined above. - typedef otb::LeeImageFilter<InputImageType, OutputImageType> FilterType; + using FilterType = otb::LeeImageFilter<InputImageType, OutputImageType>; // An ImageFileReader class is also instantiated in order to read // image data from a file. - typedef otb::ImageFileReader<InputImageType> ReaderType; + using ReaderType = otb::ImageFileReader<InputImageType>; // An ImageFileWriter is instantiated in order to write the // output image to a file. - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using WriterType = otb::ImageFileWriter<OutputImageType>; // Both the filter and the reader are created by invoking their New() // methods and assigning the result to SmartPointers. diff --git a/Examples/BasicFilters/MeanShiftSegmentationFilterExample.cxx b/Examples/BasicFilters/MeanShiftSegmentationFilterExample.cxx index 9e665a35f2..ce3897a3a3 100644 --- a/Examples/BasicFilters/MeanShiftSegmentationFilterExample.cxx +++ b/Examples/BasicFilters/MeanShiftSegmentationFilterExample.cxx @@ -63,19 +63,19 @@ int main(int argc, char* argv[]) const unsigned int Dimension = 2; - typedef float PixelType; - typedef unsigned int LabelPixelType; - typedef itk::RGBPixel<unsigned char> ColorPixelType; + using PixelType = float; + using LabelPixelType = unsigned int; + using ColorPixelType = itk::RGBPixel<unsigned char>; - typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef otb::Image<LabelPixelType, Dimension> LabelImageType; - typedef otb::Image<ColorPixelType, Dimension> RGBImageType; + using ImageType = otb::VectorImage<PixelType, Dimension>; + using LabelImageType = otb::Image<LabelPixelType, Dimension>; + using RGBImageType = otb::Image<ColorPixelType, Dimension>; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::ImageFileWriter<LabelImageType> LabelWriterType; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; + using LabelWriterType = otb::ImageFileWriter<LabelImageType>; - typedef otb::MeanShiftSegmentationFilter<ImageType, LabelImageType, ImageType> FilterType; + using FilterType = otb::MeanShiftSegmentationFilter<ImageType, LabelImageType, ImageType>; // We instantiate the filter, the reader, and 2 writers (for the // labeled and clustered images). @@ -118,15 +118,15 @@ int main(int argc, char* argv[]) writer1->Update(); writer2->Update(); - typedef otb::PrintableImageFilter<ImageType> PrintableFilterType; - PrintableFilterType::Pointer printableImageFilter = PrintableFilterType::New(); + using PrintableFilterType = otb::PrintableImageFilter<ImageType>; + PrintableFilterType::Pointer printableImageFilter = PrintableFilterType::New(); printableImageFilter->SetChannel(1); printableImageFilter->SetChannel(2); printableImageFilter->SetChannel(3); - typedef PrintableFilterType::OutputImageType OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> PrettyWriterType; + using OutputImageType = PrintableFilterType::OutputImageType; + using PrettyWriterType = otb::ImageFileWriter<OutputImageType>; PrettyWriterType::Pointer prettyWriter = PrettyWriterType::New(); @@ -135,14 +135,14 @@ int main(int argc, char* argv[]) prettyWriter->SetInput(printableImageFilter->GetOutput()); prettyWriter->Update(); - typedef otb::ImageFileWriter<RGBImageType> LabelRGBWriterType; + using LabelRGBWriterType = otb::ImageFileWriter<RGBImageType>; LabelRGBWriterType::Pointer labelRGBWriter = LabelRGBWriterType::New(); // Label to RGB image - typedef itk::Functor::ScalarToRGBPixelFunctor<LabelPixelType> FunctorType; - typedef itk::UnaryFunctorImageFilter<LabelImageType, RGBImageType, FunctorType> ColorLabelFilterType; - ColorLabelFilterType::Pointer labelToRGB = ColorLabelFilterType::New(); + using FunctorType = itk::Functor::ScalarToRGBPixelFunctor<LabelPixelType>; + using ColorLabelFilterType = itk::UnaryFunctorImageFilter<LabelImageType, RGBImageType, FunctorType>; + ColorLabelFilterType::Pointer labelToRGB = ColorLabelFilterType::New(); labelToRGB->SetInput(filter->GetLabelOutput()); diff --git a/Examples/BasicFilters/PrintableImageFilterExample.cxx b/Examples/BasicFilters/PrintableImageFilterExample.cxx index f632da523c..cdbc271d42 100644 --- a/Examples/BasicFilters/PrintableImageFilterExample.cxx +++ b/Examples/BasicFilters/PrintableImageFilterExample.cxx @@ -50,20 +50,20 @@ int main(int argc, char* argv[]) int greenChannelNumber = atoi(argv[4]); int blueChannelNumber = atoi(argv[5]); - typedef double InputPixelType; + using InputPixelType = double; const unsigned int Dimension = 2; - typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + using InputImageType = otb::VectorImage<InputPixelType, Dimension>; - typedef otb::ImageFileReader<InputImageType> ReaderType; + using ReaderType = otb::ImageFileReader<InputImageType>; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFilename); // To easily convert the image to a printable format, i.e. 3 bands // unsigned char value, you can use the PrintableImageFilter. - typedef otb::PrintableImageFilter<InputImageType> PrintableFilterType; - PrintableFilterType::Pointer printableImageFilter = PrintableFilterType::New(); + using PrintableFilterType = otb::PrintableImageFilter<InputImageType>; + PrintableFilterType::Pointer printableImageFilter = PrintableFilterType::New(); printableImageFilter->SetInput(reader->GetOutput()); printableImageFilter->SetChannel(redChannelNumber); @@ -72,8 +72,8 @@ int main(int argc, char* argv[]) // When you create the writer to plug at the output of the printableImageFilter // you may want to use the direct type definition as it is a good way to avoid mismatch: - typedef PrintableFilterType::OutputImageType OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using OutputImageType = PrintableFilterType::OutputImageType; + using WriterType = otb::ImageFileWriter<OutputImageType>; WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outputFilename); diff --git a/Examples/BasicFilters/ScalingFilterExample.cxx b/Examples/BasicFilters/ScalingFilterExample.cxx index feef4ec723..adf2ff204c 100644 --- a/Examples/BasicFilters/ScalingFilterExample.cxx +++ b/Examples/BasicFilters/ScalingFilterExample.cxx @@ -40,28 +40,28 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - typedef unsigned short InputPixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<InputPixelType, 2> InputImageType; - typedef otb::Image<OutputPixelType, 2> OutputImageType; + using InputPixelType = unsigned short; + using OutputPixelType = unsigned char; + using InputImageType = otb::Image<InputPixelType, 2>; + using OutputImageType = otb::Image<OutputPixelType, 2>; - typedef otb::ImageFileReader<InputImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); + using ReaderType = otb::ImageFileReader<InputImageType>; + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); // The RescaleIntensityImageFilter is used to rescale the value - typedef itk::RescaleIntensityImageFilter<InputImageType, OutputImageType> RescalerType; - RescalerType::Pointer rescaler = RescalerType::New(); + using RescalerType = itk::RescaleIntensityImageFilter<InputImageType, OutputImageType>; + RescalerType::Pointer rescaler = RescalerType::New(); rescaler->SetInput(reader->GetOutput()); - typedef otb::ImageFileWriter<OutputImageType> WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = otb::ImageFileWriter<OutputImageType>; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[2]); writer->SetInput(rescaler->GetOutput()); writer->Update(); - typedef itk::CastImageFilter<InputImageType, OutputImageType> CasterType; - CasterType::Pointer caster = CasterType::New(); + using CasterType = itk::CastImageFilter<InputImageType, OutputImageType>; + CasterType::Pointer caster = CasterType::New(); caster->SetInput(reader->GetOutput()); writer->SetFileName(argv[3]); diff --git a/Examples/ChangeDetection/CorrelChDet.cxx b/Examples/ChangeDetection/CorrelChDet.cxx index 7c2b477338..c590f04926 100644 --- a/Examples/ChangeDetection/CorrelChDet.cxx +++ b/Examples/ChangeDetection/CorrelChDet.cxx @@ -66,12 +66,12 @@ int main(int argc, char* argv[]) // We start by declaring the types for the two input images, the // change image and the image to be stored in a file for visualization. - typedef float InternalPixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<InternalPixelType, Dimension> InputImageType1; - typedef otb::Image<InternalPixelType, Dimension> InputImageType2; - typedef otb::Image<InternalPixelType, Dimension> ChangeImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + using InternalPixelType = float; + using OutputPixelType = unsigned char; + using InputImageType1 = otb::Image<InternalPixelType, Dimension>; + using InputImageType2 = otb::Image<InternalPixelType, Dimension>; + using ChangeImageType = otb::Image<InternalPixelType, Dimension>; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; // We can now declare the types for the readers. Since the images // can be vey large, we will force the pipeline to use @@ -79,9 +79,9 @@ int main(int argc, char* argv[]) // streamed. This is achieved by using the // \doxygen{otb}{ImageFileWriter} class. - typedef otb::ImageFileReader<InputImageType1> ReaderType1; - typedef otb::ImageFileReader<InputImageType2> ReaderType2; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType1 = otb::ImageFileReader<InputImageType1>; + using ReaderType2 = otb::ImageFileReader<InputImageType2>; + using WriterType = otb::ImageFileWriter<OutputImageType>; // The change detector will give a response which is normalized // between 0 and 1. Before @@ -89,13 +89,13 @@ int main(int argc, char* argv[]) // rescale the results of the change detection in order to use all // the output pixel type range of values. - typedef itk::ShiftScaleImageFilter<ChangeImageType, OutputImageType> RescalerType; + using RescalerType = itk::ShiftScaleImageFilter<ChangeImageType, OutputImageType>; // The \doxygen{otb}{CorrelationChangeDetector} is templated over // the types of the two input images and the type of the generated change // image. - typedef otb::CorrelationChangeDetector<InputImageType1, InputImageType2, ChangeImageType> FilterType; + using FilterType = otb::CorrelationChangeDetector<InputImageType1, InputImageType2, ChangeImageType>; // The different elements of the pipeline can now be instantiated. @@ -134,7 +134,7 @@ int main(int argc, char* argv[]) // command/observer design pattern. This is easily done by // attaching an observer to the filter. - typedef otb::CommandProgressUpdate<FilterType> CommandType; + using CommandType = otb::CommandProgressUpdate<FilterType>; CommandType::Pointer observer = CommandType::New(); filter->AddObserver(itk::ProgressEvent(), observer); diff --git a/Examples/ChangeDetection/DiffChDet.cxx b/Examples/ChangeDetection/DiffChDet.cxx index f28fc422fd..8fab7fcfb1 100644 --- a/Examples/ChangeDetection/DiffChDet.cxx +++ b/Examples/ChangeDetection/DiffChDet.cxx @@ -70,19 +70,19 @@ int main(int argc, char* argv[]) // We start by declaring the types for the two input images, the // change image and the image to be stored in a file for visualization. - typedef float InternalPixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<InternalPixelType, Dimension> InputImageType1; - typedef otb::Image<InternalPixelType, Dimension> InputImageType2; - typedef otb::Image<InternalPixelType, Dimension> ChangeImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + using InternalPixelType = float; + using OutputPixelType = unsigned char; + using InputImageType1 = otb::Image<InternalPixelType, Dimension>; + using InputImageType2 = otb::Image<InternalPixelType, Dimension>; + using ChangeImageType = otb::Image<InternalPixelType, Dimension>; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; // We can now declare the types for the readers and the writer. - typedef otb::ImageFileReader<InputImageType1> ReaderType1; - typedef otb::ImageFileReader<InputImageType2> ReaderType2; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType1 = otb::ImageFileReader<InputImageType1>; + using ReaderType2 = otb::ImageFileReader<InputImageType2>; + using WriterType = otb::ImageFileWriter<OutputImageType>; // The change detector will give positive and negative values // depending on the sign of the difference. We are usually @@ -92,15 +92,15 @@ int main(int argc, char* argv[]) // rescale the results of the change detection in order to use the full range // of values of the output pixel type. - typedef itk::AbsImageFilter<ChangeImageType, ChangeImageType> AbsType; - typedef itk::RescaleIntensityImageFilter<ChangeImageType, OutputImageType> RescalerType; + using AbsType = itk::AbsImageFilter<ChangeImageType, ChangeImageType>; + using RescalerType = itk::RescaleIntensityImageFilter<ChangeImageType, OutputImageType>; // The \doxygen{otb}{MeanDifferenceImageFilter} is templated over // the types of the two input images and the type of the generated change // image. - typedef otb::MeanDifferenceImageFilter<InputImageType1, InputImageType2, ChangeImageType> FilterType; + using FilterType = otb::MeanDifferenceImageFilter<InputImageType1, InputImageType2, ChangeImageType>; // The different elements of the pipeline can now be instantiated. @@ -142,7 +142,7 @@ int main(int argc, char* argv[]) // command/observer design pattern. This is easily done by // attaching an observer to the filter. - typedef otb::CommandProgressUpdate<FilterType> CommandType; + using CommandType = otb::CommandProgressUpdate<FilterType>; CommandType::Pointer observer = CommandType::New(); filter->AddObserver(itk::ProgressEvent(), observer); diff --git a/Examples/ChangeDetection/KullbackLeiblerDistanceChDet.cxx b/Examples/ChangeDetection/KullbackLeiblerDistanceChDet.cxx index e60b6c1b80..696c6fd378 100644 --- a/Examples/ChangeDetection/KullbackLeiblerDistanceChDet.cxx +++ b/Examples/ChangeDetection/KullbackLeiblerDistanceChDet.cxx @@ -99,12 +99,12 @@ int main(int argc, char* argv[]) char* fileNameOut = argv[3]; int winSize = atoi(argv[4]); - const unsigned int Dimension = 2; - typedef double PixelType; - typedef unsigned char OutputPixelType; + const unsigned int Dimension = 2; + using PixelType = double; + using OutputPixelType = unsigned char; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + using ImageType = otb::Image<PixelType, Dimension>; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; // The \doxygen{otb}{KullbackLeiblerDistanceImageFilter} is templated over // the types of the two input images and the type of the generated change @@ -113,13 +113,13 @@ int main(int argc, char* argv[]) // example to perform a change detection through a distance between // distributions... - typedef otb::KullbackLeiblerDistanceImageFilter<ImageType, ImageType, ImageType> FilterType; + using FilterType = otb::KullbackLeiblerDistanceImageFilter<ImageType, ImageType, ImageType>; // The different elements of the pipeline can now be instantiated. Follow the // ratio of means change detector example. - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; ReaderType::Pointer reader1 = ReaderType::New(); reader1->SetFileName(fileName1); @@ -138,8 +138,8 @@ int main(int argc, char* argv[]) filter->SetInput1(reader1->GetOutput()); filter->SetInput2(reader2->GetOutput()); - typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> RescaleFilterType; - RescaleFilterType::Pointer rescaler = RescaleFilterType::New(); + using RescaleFilterType = itk::RescaleIntensityImageFilter<ImageType, OutputImageType>; + RescaleFilterType::Pointer rescaler = RescaleFilterType::New(); rescaler->SetInput(filter->GetOutput()); rescaler->SetOutputMinimum(0); diff --git a/Examples/ChangeDetection/KullbackLeiblerProfileChDet.cxx b/Examples/ChangeDetection/KullbackLeiblerProfileChDet.cxx index 2ec5e68636..b9aafd624e 100644 --- a/Examples/ChangeDetection/KullbackLeiblerProfileChDet.cxx +++ b/Examples/ChangeDetection/KullbackLeiblerProfileChDet.cxx @@ -68,24 +68,24 @@ int main(int argc, char* argv[]) unsigned int gi = atoi(argv[7]); unsigned int bi = atoi(argv[8]); - const unsigned int Dimension = 2; - typedef double PixelType; - typedef unsigned char OutPixelType; + const unsigned int Dimension = 2; + using PixelType = double; + using OutPixelType = unsigned char; // The \doxygen{otb}{KullbackLeiblerProfileImageFilter} is templated over // the types of the two input images and the type of the generated change // image (which is now of multi-components), in a similar way as the // \doxygen{otb}{KullbackLeiblerDistanceImageFilter}. - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::VectorImage<PixelType, Dimension> VectorImageType; - typedef otb::KullbackLeiblerProfileImageFilter<ImageType, ImageType, VectorImageType> FilterType; + using ImageType = otb::Image<PixelType, Dimension>; + using VectorImageType = otb::VectorImage<PixelType, Dimension>; + using FilterType = otb::KullbackLeiblerProfileImageFilter<ImageType, ImageType, VectorImageType>; - typedef otb::VectorImage<OutPixelType, Dimension> OutVectorImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<OutVectorImageType> WriterType; - typedef otb::MultiChannelExtractROI<PixelType, PixelType> ChannelSelecterType; - typedef otb::VectorRescaleIntensityImageFilter<VectorImageType, OutVectorImageType> RescalerType; + using OutVectorImageType = otb::VectorImage<OutPixelType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<OutVectorImageType>; + using ChannelSelecterType = otb::MultiChannelExtractROI<PixelType, PixelType>; + using RescalerType = otb::VectorRescaleIntensityImageFilter<VectorImageType, OutVectorImageType>; ReaderType::Pointer reader1 = ReaderType::New(); reader1->SetFileName(fileName1); diff --git a/Examples/ChangeDetection/MultivariateAlterationDetector.cxx b/Examples/ChangeDetection/MultivariateAlterationDetector.cxx index 3a2f9cb764..e11b76142e 100644 --- a/Examples/ChangeDetection/MultivariateAlterationDetector.cxx +++ b/Examples/ChangeDetection/MultivariateAlterationDetector.cxx @@ -80,10 +80,10 @@ int main(int argc, char* argv[]) // We then define the types for the input images and for the // change image. - typedef unsigned short InputPixelType; - typedef float OutputPixelType; - typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; - typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType; + using InputPixelType = unsigned short; + using OutputPixelType = float; + using InputImageType = otb::VectorImage<InputPixelType, Dimension>; + using OutputImageType = otb::VectorImage<OutputPixelType, Dimension>; // We can now declare the types for the reader. Since the images // can be vey large, we will force the pipeline to use @@ -91,21 +91,21 @@ int main(int argc, char* argv[]) // streamed. This is achieved by using the // \doxygen{otb}{ImageFileWriter} class. - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; // This is for rendering in software guide - typedef otb::PrintableImageFilter<InputImageType, InputImageType> InputPrintFilterType; - typedef otb::PrintableImageFilter<OutputImageType, OutputImageType> OutputPrintFilterType; - typedef InputPrintFilterType::OutputImageType VisuImageType; - typedef otb::ImageFileWriter<VisuImageType> VisuWriterType; + using InputPrintFilterType = otb::PrintableImageFilter<InputImageType, InputImageType>; + using OutputPrintFilterType = otb::PrintableImageFilter<OutputImageType, OutputImageType>; + using VisuImageType = InputPrintFilterType::OutputImageType; + using VisuWriterType = otb::ImageFileWriter<VisuImageType>; // The \doxygen{otb}{MultivariateAlterationDetectorImageFilter} is templated over // the type of the input images and the type of the generated change // image. - typedef otb::MultivariateAlterationDetectorImageFilter<InputImageType, OutputImageType> MADFilterType; + using MADFilterType = otb::MultivariateAlterationDetectorImageFilter<InputImageType, OutputImageType>; // The different elements of the pipeline can now be instantiated. diff --git a/Examples/ChangeDetection/RatioChDet.cxx b/Examples/ChangeDetection/RatioChDet.cxx index c12ffa03b0..e0ea00a986 100644 --- a/Examples/ChangeDetection/RatioChDet.cxx +++ b/Examples/ChangeDetection/RatioChDet.cxx @@ -73,12 +73,12 @@ int main(int argc, char* argv[]) // We start by declaring the types for the two input images, the // change image and the image to be stored in a file for visualization. - typedef float InternalPixelType; - typedef unsigned char OutputPixelType; - typedef otb::Image<InternalPixelType, Dimension> InputImageType1; - typedef otb::Image<InternalPixelType, Dimension> InputImageType2; - typedef otb::Image<InternalPixelType, Dimension> ChangeImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + using InternalPixelType = float; + using OutputPixelType = unsigned char; + using InputImageType1 = otb::Image<InternalPixelType, Dimension>; + using InputImageType2 = otb::Image<InternalPixelType, Dimension>; + using ChangeImageType = otb::Image<InternalPixelType, Dimension>; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; // We can now declare the types for the readers. Since the images // can be vey large, we will force the pipeline to use @@ -86,9 +86,9 @@ int main(int argc, char* argv[]) // streamed. This is achieved by using the // \doxygen{otb}{ImageFileWriter} class. - typedef otb::ImageFileReader<InputImageType1> ReaderType1; - typedef otb::ImageFileReader<InputImageType2> ReaderType2; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType1 = otb::ImageFileReader<InputImageType1>; + using ReaderType2 = otb::ImageFileReader<InputImageType2>; + using WriterType = otb::ImageFileWriter<OutputImageType>; // The change detector will give a normalized result between 0 and @@ -96,14 +96,14 @@ int main(int argc, char* argv[]) // rescale the results of the change detection in order to use all // the output pixel type range of values. - typedef itk::ShiftScaleImageFilter<ChangeImageType, OutputImageType> RescalerType; + using RescalerType = itk::ShiftScaleImageFilter<ChangeImageType, OutputImageType>; // The \doxygen{otb}{MeanRatioImageFilter} is templated over // the types of the two input images and the type of the generated change // image. - typedef otb::MeanRatioImageFilter<InputImageType1, InputImageType2, ChangeImageType> FilterType; + using FilterType = otb::MeanRatioImageFilter<InputImageType1, InputImageType2, ChangeImageType>; // The different elements of the pipeline can now be instantiated. @@ -138,7 +138,7 @@ int main(int argc, char* argv[]) rescaler->SetInput(filter->GetOutput()); writer->SetInput(rescaler->GetOutput()); - typedef otb::CommandProgressUpdate<FilterType> CommandType; + using CommandType = otb::CommandProgressUpdate<FilterType>; CommandType::Pointer observer = CommandType::New(); filter->AddObserver(itk::ProgressEvent(), observer); diff --git a/Examples/Classification/ClassificationMapRegularizationExample.cxx b/Examples/Classification/ClassificationMapRegularizationExample.cxx index 7fa37401fc..7c0c0aa1cd 100644 --- a/Examples/Classification/ClassificationMapRegularizationExample.cxx +++ b/Examples/Classification/ClassificationMapRegularizationExample.cxx @@ -47,14 +47,14 @@ int main(int itkNotUsed(argc), char* argv[]) // single band input image for which each pixel value is a label coded // on 8 bits as an integer between 0 and 255. - typedef unsigned char IOLabelPixelType; // 8 bits - const unsigned int Dimension = 2; + using IOLabelPixelType = unsigned char; // 8 bits + const unsigned int Dimension = 2; // Thus, both input and output images are single band labeled images, // which are composed of the same type of pixels in this example // (unsigned char). - typedef otb::Image<IOLabelPixelType, Dimension> IOLabelImageType; + using IOLabelImageType = otb::Image<IOLabelPixelType, Dimension>; // We can now define the type for the neighborhood majority voting filter, @@ -65,7 +65,7 @@ int main(int itkNotUsed(argc), char* argv[]) // (\doxygen{itk}{BinaryBallStructuringElement}). // Neighborhood majority voting filter type - typedef otb::NeighborhoodMajorityVotingImageFilter<IOLabelImageType> NeighborhoodMajorityVotingFilterType; + using NeighborhoodMajorityVotingFilterType = otb::NeighborhoodMajorityVotingImageFilter<IOLabelImageType>; // Since the \doxygen{otb}{NeighborhoodMajorityVotingImageFilter} is a @@ -77,14 +77,14 @@ int main(int itkNotUsed(argc), char* argv[]) // structuring elements such as ovals. // Binary ball Structuring Element type - typedef NeighborhoodMajorityVotingFilterType::KernelType StructuringType; - typedef StructuringType::RadiusType RadiusType; + using StructuringType = NeighborhoodMajorityVotingFilterType::KernelType; + using RadiusType = StructuringType::RadiusType; // Finally, we define the reader and the writer. - typedef otb::ImageFileReader<IOLabelImageType> ReaderType; - typedef otb::ImageFileWriter<IOLabelImageType> WriterType; + using ReaderType = otb::ImageFileReader<IOLabelImageType>; + using WriterType = otb::ImageFileWriter<IOLabelImageType>; const char* inputFileName = argv[1]; diff --git a/Examples/Classification/DempsterShaferFusionOfClassificationMapsExample.cxx b/Examples/Classification/DempsterShaferFusionOfClassificationMapsExample.cxx index c9cc0a0a5f..ccc0741204 100644 --- a/Examples/Classification/DempsterShaferFusionOfClassificationMapsExample.cxx +++ b/Examples/Classification/DempsterShaferFusionOfClassificationMapsExample.cxx @@ -47,11 +47,11 @@ // into masses of belief for each class label. -typedef unsigned short LabelPixelType; -typedef unsigned long ConfusionMatrixEltType; -typedef itk::VariableSizeMatrix<ConfusionMatrixEltType> ConfusionMatrixType; -typedef otb::ConfusionMatrixToMassOfBelief<ConfusionMatrixType, LabelPixelType> ConfusionMatrixToMassOfBeliefType; -typedef ConfusionMatrixToMassOfBeliefType::MapOfClassesType MapOfClassesType; +using LabelPixelType = unsigned short; +using ConfusionMatrixEltType = unsigned long; +using ConfusionMatrixType = itk::VariableSizeMatrix<ConfusionMatrixEltType>; +using ConfusionMatrixToMassOfBeliefType = otb::ConfusionMatrixToMassOfBelief<ConfusionMatrixType, LabelPixelType>; +using MapOfClassesType = ConfusionMatrixToMassOfBeliefType::MapOfClassesType; int CSVConfusionMatrixFileReader(const std::string fileName, MapOfClassesType& mapOfClassesRefClX, ConfusionMatrixType& confusionMatrixClX) @@ -163,9 +163,9 @@ int CSVConfusionMatrixFileReader(const std::string fileName, MapOfClassesType& m int main(int argc, char* argv[]) { // The input labeled images to be fused are expected to be scalar images. - const unsigned int Dimension = 2; - typedef otb::Image<LabelPixelType, Dimension> LabelImageType; - typedef otb::VectorImage<LabelPixelType, Dimension> VectorImageType; + const unsigned int Dimension = 2; + using LabelImageType = otb::Image<LabelPixelType, Dimension>; + using VectorImageType = otb::VectorImage<LabelPixelType, Dimension>; LabelPixelType nodataLabel = atoi(argv[argc - 3]); LabelPixelType undecidedLabel = atoi(argv[argc - 2]); @@ -178,23 +178,23 @@ int main(int argc, char* argv[]) // input classification maps to be fused as a single VectorImage for which each // band is a classification map. This VectorImage will then be the input of the // Dempster Shafer fusion filter \doxygen{otb}{DSFusionOfClassifiersImageFilter}. - typedef otb::ImageList<LabelImageType> LabelImageListType; - typedef otb::ImageListToVectorImageFilter<LabelImageListType, VectorImageType> ImageListToVectorImageFilterType; + using LabelImageListType = otb::ImageList<LabelImageType>; + using ImageListToVectorImageFilterType = otb::ImageListToVectorImageFilter<LabelImageListType, VectorImageType>; - typedef ConfusionMatrixToMassOfBeliefType::MassOfBeliefDefinitionMethod MassOfBeliefDefinitionMethod; + using MassOfBeliefDefinitionMethod = ConfusionMatrixToMassOfBeliefType::MassOfBeliefDefinitionMethod; // The Dempster Shafer fusion filter \doxygen{otb}{DSFusionOfClassifiersImageFilter} is declared. // Dempster Shafer - typedef otb::DSFusionOfClassifiersImageFilter<VectorImageType, LabelImageType> DSFusionOfClassifiersImageFilterType; + using DSFusionOfClassifiersImageFilterType = otb::DSFusionOfClassifiersImageFilter<VectorImageType, LabelImageType>; - typedef DSFusionOfClassifiersImageFilterType::VectorOfMapOfMassesOfBeliefType VectorOfMapOfMassesOfBeliefType; + using VectorOfMapOfMassesOfBeliefType = DSFusionOfClassifiersImageFilterType::VectorOfMapOfMassesOfBeliefType; // Both reader and writer are defined. Since the images // to classify can be very big, we will use a streamed writer which // will trigger the streaming ability of the fusion filter. - typedef otb::ImageFileReader<LabelImageType> ReaderType; - typedef otb::ImageFileWriter<LabelImageType> WriterType; + using ReaderType = otb::ImageFileReader<LabelImageType>; + using WriterType = otb::ImageFileWriter<LabelImageType>; // The image list of input classification maps is filled. Moreover, the input diff --git a/Examples/Classification/SOMImageClassificationExample.cxx b/Examples/Classification/SOMImageClassificationExample.cxx index 17ef8efc1c..9155a235ca 100644 --- a/Examples/Classification/SOMImageClassificationExample.cxx +++ b/Examples/Classification/SOMImageClassificationExample.cxx @@ -43,28 +43,28 @@ int main(int itkNotUsed(argc), char* argv[]) // We will assume double precision input images and will also define // the type for the labeled pixels. - const unsigned int Dimension = 2; - typedef double PixelType; - typedef unsigned short LabeledPixelType; + const unsigned int Dimension = 2; + using PixelType = double; + using LabeledPixelType = unsigned short; // Our classifier will be generic enough to be able to process images // with any number of bands. We read the images as // \doxygen{otb}{VectorImage}s. The labeled image will be a scalar image. - typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef otb::Image<LabeledPixelType, Dimension> LabeledImageType; + using ImageType = otb::VectorImage<PixelType, Dimension>; + using LabeledImageType = otb::Image<LabeledPixelType, Dimension>; // We can now define the type for the classifier filter, which is // templated over its input and output image types and the SOM type. - typedef otb::SOMMap<ImageType::PixelType> SOMMapType; - typedef otb::SOMImageClassificationFilter<ImageType, LabeledImageType, SOMMapType> ClassificationFilterType; + using SOMMapType = otb::SOMMap<ImageType::PixelType>; + using ClassificationFilterType = otb::SOMImageClassificationFilter<ImageType, LabeledImageType, SOMMapType>; // And finally, we define the readers (for the input image and theSOM) // and the writer. Since the images, // to classify can be very big, we will use a streamed writer which // will trigger the streaming ability of the classifier. - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileReader<SOMMapType> SOMReaderType; - typedef otb::ImageFileWriter<LabeledImageType> WriterType; + using ReaderType = otb::ImageFileReader<ImageType>; + using SOMReaderType = otb::ImageFileReader<SOMMapType>; + using WriterType = otb::ImageFileWriter<LabeledImageType>; // We instantiate the classifier and the reader objects and we set // the existing SOM obtained in a previous training step. diff --git a/Examples/Classification/SupervisedImageClassificationExample.cxx b/Examples/Classification/SupervisedImageClassificationExample.cxx index d48f0678a6..3ccc92cf8e 100644 --- a/Examples/Classification/SupervisedImageClassificationExample.cxx +++ b/Examples/Classification/SupervisedImageClassificationExample.cxx @@ -49,30 +49,30 @@ int main(int itkNotUsed(argc), char* argv[]) // We will assume double precision input images and will also define // the type for the labeled pixels. - const unsigned int Dimension = 2; - typedef double PixelType; - typedef unsigned short LabeledPixelType; + const unsigned int Dimension = 2; + using PixelType = double; + using LabeledPixelType = unsigned short; // Our classifier is generic enough to be able to process images // with any number of bands. We read the input image as a // \doxygen{otb}{VectorImage}. The labeled image will be a scalar image. - typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef otb::Image<LabeledPixelType, Dimension> LabeledImageType; + using ImageType = otb::VectorImage<PixelType, Dimension>; + using LabeledImageType = otb::Image<LabeledPixelType, Dimension>; // We can now define the type for the classifier filter, which is // templated over its input and output image types. - typedef otb::ImageClassificationFilter<ImageType, LabeledImageType> ClassificationFilterType; - typedef ClassificationFilterType::ModelType ModelType; + using ClassificationFilterType = otb::ImageClassificationFilter<ImageType, LabeledImageType>; + using ModelType = ClassificationFilterType::ModelType; // Moreover, it is necessary to define a \doxygen{otb}{MachineLearningModelFactory} // which is templated over its input and output pixel types. This factory is used // to parse the input model file and to define which classification method to use. - typedef otb::MachineLearningModelFactory<PixelType, LabeledPixelType> MachineLearningModelFactoryType; + using MachineLearningModelFactoryType = otb::MachineLearningModelFactory<PixelType, LabeledPixelType>; // And finally, we define the reader and the writer. Since the images // to classify can be very big, we will use a streamed writer which // will trigger the streaming ability of the classifier. - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<LabeledImageType> WriterType; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<LabeledImageType>; // We instantiate the classifier and the reader objects and we set // the existing model obtained in a previous training step. diff --git a/Examples/DimensionReduction/ICAExample.cxx b/Examples/DimensionReduction/ICAExample.cxx index 804950e626..2d55be58de 100644 --- a/Examples/DimensionReduction/ICAExample.cxx +++ b/Examples/DimensionReduction/ICAExample.cxx @@ -57,7 +57,7 @@ int main(int itkNotUsed(argc), char* argv[]) { - typedef double PixelType; + using PixelType = double; const unsigned int Dimension = 2; const char* inputFileName = argv[1]; const char* outputFilename = argv[2]; @@ -74,9 +74,9 @@ int main(int itkNotUsed(argc), char* argv[]) // since we will produce a multi-channel image (the independent // components) from a multi-channel input image. - typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ImageType = otb::VectorImage<PixelType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; // We instantiate now the image reader and we set the image file name. ReaderType::Pointer reader = ReaderType::New(); @@ -87,8 +87,8 @@ int main(int itkNotUsed(argc), char* argv[]) // internal structure of this filter is a filter-to-filter like structure. // We can now the instantiate the filter. - typedef otb::FastICAImageFilter<ImageType, ImageType, otb::Transform::FORWARD> FastICAFilterType; - FastICAFilterType::Pointer FastICAfilter = FastICAFilterType::New(); + using FastICAFilterType = otb::FastICAImageFilter<ImageType, ImageType, otb::Transform::FORWARD>; + FastICAFilterType::Pointer FastICAfilter = FastICAFilterType::New(); // We then set the number of independent // components required as output. We can choose to get less ICs than @@ -122,8 +122,8 @@ int main(int itkNotUsed(argc), char* argv[]) // covariance matrix or the transformation matrix // (which may not be square) has to be given. - typedef otb::FastICAImageFilter<ImageType, ImageType, otb::Transform::INVERSE> InvFastICAFilterType; - InvFastICAFilterType::Pointer invFilter = InvFastICAFilterType::New(); + using InvFastICAFilterType = otb::FastICAImageFilter<ImageType, ImageType, otb::Transform::INVERSE>; + InvFastICAFilterType::Pointer invFilter = InvFastICAFilterType::New(); invFilter->SetMeanValues(FastICAfilter->GetMeanValues()); invFilter->SetStdDevValues(FastICAfilter->GetStdDevValues()); @@ -154,9 +154,9 @@ int main(int itkNotUsed(argc), char* argv[]) // \end{figure} // This is for rendering in software guide - typedef otb::PrintableImageFilter<ImageType, ImageType> PrintFilterType; - typedef PrintFilterType::OutputImageType VisuImageType; - typedef otb::ImageFileWriter<VisuImageType> VisuWriterType; + using PrintFilterType = otb::PrintableImageFilter<ImageType, ImageType>; + using VisuImageType = PrintFilterType::OutputImageType; + using VisuWriterType = otb::ImageFileWriter<VisuImageType>; PrintFilterType::Pointer inputPrintFilter = PrintFilterType::New(); PrintFilterType::Pointer outputPrintFilter = PrintFilterType::New(); diff --git a/Examples/DimensionReduction/MNFExample.cxx b/Examples/DimensionReduction/MNFExample.cxx index 0299f602f7..da9343ba77 100644 --- a/Examples/DimensionReduction/MNFExample.cxx +++ b/Examples/DimensionReduction/MNFExample.cxx @@ -66,7 +66,7 @@ int main(int itkNotUsed(argc), char* argv[]) { - typedef double PixelType; + using PixelType = double; const unsigned int Dimension = 2; const char* inputFileName = argv[1]; const char* outputFilename = argv[2]; @@ -83,9 +83,9 @@ int main(int itkNotUsed(argc), char* argv[]) // since we will produce a multi-channel image (the principal // components) from a multi-channel input image. - typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ImageType = otb::VectorImage<PixelType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; // We instantiate now the image reader and we set the image file name. ReaderType::Pointer reader = ReaderType::New(); @@ -105,7 +105,7 @@ int main(int itkNotUsed(argc), char* argv[]) // We define the type of the noise filter. // SoftwareGuide : BeginCodeSnippet - typedef otb::LocalActivityVectorImageFilter<ImageType, ImageType> NoiseFilterType; + using NoiseFilterType = otb::LocalActivityVectorImageFilter<ImageType, ImageType>; // SoftwareGuide : EndCodeSnippet @@ -114,8 +114,8 @@ int main(int itkNotUsed(argc), char* argv[]) // internal structure of this filter is a filter-to-filter like structure. // We can now the instantiate the filter. - typedef otb::MNFImageFilter<ImageType, ImageType, NoiseFilterType, otb::Transform::FORWARD> MNFFilterType; - MNFFilterType::Pointer MNFfilter = MNFFilterType::New(); + using MNFFilterType = otb::MNFImageFilter<ImageType, ImageType, NoiseFilterType, otb::Transform::FORWARD>; + MNFFilterType::Pointer MNFfilter = MNFFilterType::New(); // We then set the number of principal // components required as output. We can choose to get less PCs than @@ -150,8 +150,8 @@ int main(int itkNotUsed(argc), char* argv[]) // covariance matrix or the transformation matrix // (which may not be square) has to be given. - typedef otb::MNFImageFilter<ImageType, ImageType, NoiseFilterType, otb::Transform::INVERSE> InvMNFFilterType; - InvMNFFilterType::Pointer invFilter = InvMNFFilterType::New(); + using InvMNFFilterType = otb::MNFImageFilter<ImageType, ImageType, NoiseFilterType, otb::Transform::INVERSE>; + InvMNFFilterType::Pointer invFilter = InvMNFFilterType::New(); invFilter->SetMeanValues(MNFfilter->GetMeanValues()); if (normalization) @@ -182,9 +182,9 @@ int main(int itkNotUsed(argc), char* argv[]) // \end{figure} // This is for rendering in software guide - typedef otb::PrintableImageFilter<ImageType, ImageType> PrintFilterType; - typedef PrintFilterType::OutputImageType VisuImageType; - typedef otb::ImageFileWriter<VisuImageType> VisuWriterType; + using PrintFilterType = otb::PrintableImageFilter<ImageType, ImageType>; + using VisuImageType = PrintFilterType::OutputImageType; + using VisuWriterType = otb::ImageFileWriter<VisuImageType>; PrintFilterType::Pointer inputPrintFilter = PrintFilterType::New(); PrintFilterType::Pointer outputPrintFilter = PrintFilterType::New(); diff --git a/Examples/DimensionReduction/MaximumAutocorrelationFactor.cxx b/Examples/DimensionReduction/MaximumAutocorrelationFactor.cxx index 5de6d9be03..c7a3510fa1 100644 --- a/Examples/DimensionReduction/MaximumAutocorrelationFactor.cxx +++ b/Examples/DimensionReduction/MaximumAutocorrelationFactor.cxx @@ -54,8 +54,8 @@ int main(int itkNotUsed(argc), char* argv[]) // We then define the types for the input image and the // output image. - typedef otb::VectorImage<unsigned short, 2> InputImageType; - typedef otb::VectorImage<double, 2> OutputImageType; + using InputImageType = otb::VectorImage<unsigned short, 2>; + using OutputImageType = otb::VectorImage<double, 2>; // We can now declare the types for the reader. Since the images @@ -64,14 +64,14 @@ int main(int itkNotUsed(argc), char* argv[]) // streamed. This is achieved by using the // \doxygen{otb}{ImageFileWriter} class. - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; // The \doxygen{otb}{MultivariateAlterationDetectorImageFilter} is templated over // the type of the input images and the type of the generated change // image. - typedef otb::MaximumAutocorrelationFactorImageFilter<InputImageType, OutputImageType> FilterType; + using FilterType = otb::MaximumAutocorrelationFactorImageFilter<InputImageType, OutputImageType>; // The different elements of the pipeline can now be instantiated. @@ -95,10 +95,10 @@ int main(int itkNotUsed(argc), char* argv[]) writer->Update(); // This is for rendering in software guide - typedef otb::PrintableImageFilter<InputImageType, InputImageType> InputPrintFilterType; - typedef otb::PrintableImageFilter<OutputImageType, OutputImageType> OutputPrintFilterType; - typedef InputPrintFilterType::OutputImageType VisuImageType; - typedef otb::ImageFileWriter<VisuImageType> VisuWriterType; + using InputPrintFilterType = otb::PrintableImageFilter<InputImageType, InputImageType>; + using OutputPrintFilterType = otb::PrintableImageFilter<OutputImageType, OutputImageType>; + using VisuImageType = InputPrintFilterType::OutputImageType; + using VisuWriterType = otb::ImageFileWriter<VisuImageType>; InputPrintFilterType::Pointer inputPrintFilter = InputPrintFilterType::New(); OutputPrintFilterType::Pointer outputPrintFilter = OutputPrintFilterType::New(); diff --git a/Examples/DimensionReduction/NAPCAExample.cxx b/Examples/DimensionReduction/NAPCAExample.cxx index b4f479eaa4..3586dd81ea 100644 --- a/Examples/DimensionReduction/NAPCAExample.cxx +++ b/Examples/DimensionReduction/NAPCAExample.cxx @@ -67,7 +67,7 @@ int main(int itkNotUsed(argc), char* argv[]) { - typedef double PixelType; + using PixelType = double; const unsigned int Dimension = 2; const char* inputFileName = argv[1]; const char* outputFilename = argv[2]; @@ -84,9 +84,9 @@ int main(int itkNotUsed(argc), char* argv[]) // since we will produce a multi-channel image (the principal // components) from a multi-channel input image. - typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ImageType = otb::VectorImage<PixelType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; // We instantiate now the image reader and we set the image file name. ReaderType::Pointer reader = ReaderType::New(); @@ -106,7 +106,7 @@ int main(int itkNotUsed(argc), char* argv[]) // We define the type of the noise filter. // SoftwareGuide : BeginCodeSnippet - typedef otb::LocalActivityVectorImageFilter<ImageType, ImageType> NoiseFilterType; + using NoiseFilterType = otb::LocalActivityVectorImageFilter<ImageType, ImageType>; // SoftwareGuide : EndCodeSnippet @@ -116,8 +116,8 @@ int main(int itkNotUsed(argc), char* argv[]) // internal structure of this filter is a filter-to-filter like structure. // We can now the instantiate the filter. - typedef otb::NAPCAImageFilter<ImageType, ImageType, NoiseFilterType, otb::Transform::FORWARD> NAPCAFilterType; - NAPCAFilterType::Pointer napcafilter = NAPCAFilterType::New(); + using NAPCAFilterType = otb::NAPCAImageFilter<ImageType, ImageType, NoiseFilterType, otb::Transform::FORWARD>; + NAPCAFilterType::Pointer napcafilter = NAPCAFilterType::New(); // We then set the number of principal // components required as output. We can choose to get less PCs than @@ -152,8 +152,8 @@ int main(int itkNotUsed(argc), char* argv[]) // covariance matrix or the transformation matrix // (which may not be square) has to be given. - typedef otb::NAPCAImageFilter<ImageType, ImageType, NoiseFilterType, otb::Transform::INVERSE> InvNAPCAFilterType; - InvNAPCAFilterType::Pointer invFilter = InvNAPCAFilterType::New(); + using InvNAPCAFilterType = otb::NAPCAImageFilter<ImageType, ImageType, NoiseFilterType, otb::Transform::INVERSE>; + InvNAPCAFilterType::Pointer invFilter = InvNAPCAFilterType::New(); invFilter->SetMeanValues(napcafilter->GetMeanValues()); if (normalization) @@ -184,9 +184,9 @@ int main(int itkNotUsed(argc), char* argv[]) // \end{figure} // This is for rendering in software guide - typedef otb::PrintableImageFilter<ImageType, ImageType> PrintFilterType; - typedef PrintFilterType::OutputImageType VisuImageType; - typedef otb::ImageFileWriter<VisuImageType> VisuWriterType; + using PrintFilterType = otb::PrintableImageFilter<ImageType, ImageType>; + using VisuImageType = PrintFilterType::OutputImageType; + using VisuWriterType = otb::ImageFileWriter<VisuImageType>; PrintFilterType::Pointer inputPrintFilter = PrintFilterType::New(); PrintFilterType::Pointer outputPrintFilter = PrintFilterType::New(); diff --git a/Examples/DimensionReduction/PCAExample.cxx b/Examples/DimensionReduction/PCAExample.cxx index 581c9f6b97..9127983ce6 100644 --- a/Examples/DimensionReduction/PCAExample.cxx +++ b/Examples/DimensionReduction/PCAExample.cxx @@ -46,7 +46,7 @@ int main(int itkNotUsed(argc), char* argv[]) { - typedef double PixelType; + using PixelType = double; const unsigned int Dimension = 2; const char* inputFileName = argv[1]; const char* outputFilename = argv[2]; @@ -62,9 +62,9 @@ int main(int itkNotUsed(argc), char* argv[]) // since we will produce a multi-channel image (the principal // components) from a multi-channel input image. - typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ImageType = otb::VectorImage<PixelType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; // We instantiate now the image reader and we set the image file name. ReaderType::Pointer reader = ReaderType::New(); @@ -74,8 +74,8 @@ int main(int itkNotUsed(argc), char* argv[]) // internal structure of this filter is a filter-to-filter like structure. // We can now the instantiate the filter. - typedef otb::PCAImageFilter<ImageType, ImageType, otb::Transform::FORWARD> PCAFilterType; - PCAFilterType::Pointer pcafilter = PCAFilterType::New(); + using PCAFilterType = otb::PCAImageFilter<ImageType, ImageType, otb::Transform::FORWARD>; + PCAFilterType::Pointer pcafilter = PCAFilterType::New(); // The only parameter needed for the PCA is the number of principal // components required as output. Principal components are linear combination of input components // (here the input image bands), @@ -102,8 +102,8 @@ int main(int itkNotUsed(argc), char* argv[]) // covariance matrix or the transformation matrix // (which may not be square) has to be given. - typedef otb::PCAImageFilter<ImageType, ImageType, otb::Transform::INVERSE> InvPCAFilterType; - InvPCAFilterType::Pointer invFilter = InvPCAFilterType::New(); + using InvPCAFilterType = otb::PCAImageFilter<ImageType, ImageType, otb::Transform::INVERSE>; + InvPCAFilterType::Pointer invFilter = InvPCAFilterType::New(); invFilter->SetInput(pcafilter->GetOutput()); invFilter->SetTransformationMatrix(pcafilter->GetTransformationMatrix()); @@ -131,9 +131,9 @@ int main(int itkNotUsed(argc), char* argv[]) // \end{figure} // This is for rendering in software guide - typedef otb::PrintableImageFilter<ImageType, ImageType> PrintFilterType; - typedef PrintFilterType::OutputImageType VisuImageType; - typedef otb::ImageFileWriter<VisuImageType> VisuWriterType; + using PrintFilterType = otb::PrintableImageFilter<ImageType, ImageType>; + using VisuImageType = PrintFilterType::OutputImageType; + using VisuWriterType = otb::ImageFileWriter<VisuImageType>; PrintFilterType::Pointer inputPrintFilter = PrintFilterType::New(); PrintFilterType::Pointer outputPrintFilter = PrintFilterType::New(); diff --git a/Examples/DisparityMap/FineRegistrationImageFilterExample.cxx b/Examples/DisparityMap/FineRegistrationImageFilterExample.cxx index 9acb897791..831dc0f7b0 100644 --- a/Examples/DisparityMap/FineRegistrationImageFilterExample.cxx +++ b/Examples/DisparityMap/FineRegistrationImageFilterExample.cxx @@ -82,22 +82,22 @@ int main(int argc, char** argv) const unsigned int ImageDimension = 2; - typedef double PixelType; - typedef itk::Vector<double, ImageDimension> DisplacementPixelType; + using PixelType = double; + using DisplacementPixelType = itk::Vector<double, ImageDimension>; - typedef unsigned char OutputPixelType; - typedef otb::Image<OutputPixelType, ImageDimension> OutputImageType; + using OutputPixelType = unsigned char; + using OutputImageType = otb::Image<OutputPixelType, ImageDimension>; // Several type of \doxygen{otb}{Image} are required to represent the input image, the metric field, // and the deformation field. // Allocate Images - typedef otb::Image<PixelType, ImageDimension> InputImageType; - typedef otb::Image<PixelType, ImageDimension> MetricImageType; - typedef otb::Image<DisplacementPixelType, ImageDimension> DisplacementFieldType; + using InputImageType = otb::Image<PixelType, ImageDimension>; + using MetricImageType = otb::Image<PixelType, ImageDimension>; + using DisplacementFieldType = otb::Image<DisplacementPixelType, ImageDimension>; - typedef otb::ImageFileReader<InputImageType> InputReaderType; - InputReaderType::Pointer fReader = InputReaderType::New(); + using InputReaderType = otb::ImageFileReader<InputImageType>; + InputReaderType::Pointer fReader = InputReaderType::New(); fReader->SetFileName(argv[1]); InputReaderType::Pointer mReader = InputReaderType::New(); @@ -108,7 +108,7 @@ int main(int argc, char** argv) // \doxygen{itk}{RecursiveGaussianImageFilter}: // Blur input images - typedef itk::RecursiveGaussianImageFilter<InputImageType, InputImageType> InputBlurType; + using InputBlurType = itk::RecursiveGaussianImageFilter<InputImageType, InputImageType>; InputBlurType::Pointer fBlur = InputBlurType::New(); fBlur->SetInput(fReader->GetOutput()); @@ -121,7 +121,7 @@ int main(int argc, char** argv) // Now, we declare and instantiate the \doxygen{otb}{FineRegistrationImageFilter} which is going to perform the registration: // Create the filter - typedef otb::FineRegistrationImageFilter<InputImageType, MetricImageType, DisplacementFieldType> RegistrationFilterType; + using RegistrationFilterType = otb::FineRegistrationImageFilter<InputImageType, MetricImageType, DisplacementFieldType>; RegistrationFilterType::Pointer registrator = RegistrationFilterType::New(); @@ -132,7 +132,7 @@ int main(int argc, char** argv) // \begin{itemize} // \item The area where the search is performed. This area is defined by its radius: - typedef RegistrationFilterType::SizeType RadiusType; + using RadiusType = RegistrationFilterType::SizeType; RadiusType searchRadius; @@ -162,8 +162,8 @@ int main(int argc, char** argv) if (argc > 11) { - typedef itk::MeanReciprocalSquareDifferenceImageToImageMetric<InputImageType, InputImageType> MRSDMetricType; - MRSDMetricType::Pointer mrsdMetric = MRSDMetricType::New(); + using MRSDMetricType = itk::MeanReciprocalSquareDifferenceImageToImageMetric<InputImageType, InputImageType>; + MRSDMetricType::Pointer mrsdMetric = MRSDMetricType::New(); registrator->SetMetric(mrsdMetric); // The \doxygen{itk}{MutualInformationImageToImageMetric} produces low value for poor matches, therefore, the filter has @@ -180,20 +180,20 @@ int main(int argc, char** argv) // \doxygen{otb}{ImageFileWriter} if you want to benefit // from the streaming features. - typedef otb::ImageOfVectorsToMonoChannelExtractROI<DisplacementFieldType, InputImageType> ChannelExtractionFilterType; - ChannelExtractionFilterType::Pointer channelExtractor = ChannelExtractionFilterType::New(); + using ChannelExtractionFilterType = otb::ImageOfVectorsToMonoChannelExtractROI<DisplacementFieldType, InputImageType>; + ChannelExtractionFilterType::Pointer channelExtractor = ChannelExtractionFilterType::New(); channelExtractor->SetInput(registrator->GetOutputDisplacementField()); channelExtractor->SetChannel(1); - typedef itk::RescaleIntensityImageFilter<InputImageType, OutputImageType> RescalerType; - RescalerType::Pointer fieldRescaler = RescalerType::New(); + using RescalerType = itk::RescaleIntensityImageFilter<InputImageType, OutputImageType>; + RescalerType::Pointer fieldRescaler = RescalerType::New(); fieldRescaler->SetInput(channelExtractor->GetOutput()); fieldRescaler->SetOutputMaximum(255); fieldRescaler->SetOutputMinimum(0); - typedef otb::ImageFileWriter<OutputImageType> DFWriterType; + using DFWriterType = otb::ImageFileWriter<OutputImageType>; DFWriterType::Pointer dfWriter = DFWriterType::New(); dfWriter->SetFileName(argv[3]); @@ -204,8 +204,8 @@ int main(int argc, char** argv) dfWriter->SetFileName(argv[4]); dfWriter->Update(); - typedef itk::WarpImageFilter<InputImageType, InputImageType, DisplacementFieldType> WarperType; - WarperType::Pointer warper = WarperType::New(); + using WarperType = itk::WarpImageFilter<InputImageType, InputImageType, DisplacementFieldType>; + WarperType::Pointer warper = WarperType::New(); InputImageType::PixelType padValue = 4.0; @@ -213,22 +213,22 @@ int main(int argc, char** argv) warper->SetDisplacementField(registrator->GetOutputDisplacementField()); warper->SetEdgePaddingValue(padValue); - typedef itk::RescaleIntensityImageFilter<MetricImageType, OutputImageType> MetricRescalerType; + using MetricRescalerType = itk::RescaleIntensityImageFilter<MetricImageType, OutputImageType>; MetricRescalerType::Pointer metricRescaler = MetricRescalerType::New(); metricRescaler->SetInput(registrator->GetOutput()); metricRescaler->SetOutputMinimum(0); metricRescaler->SetOutputMaximum(255); - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using WriterType = otb::ImageFileWriter<OutputImageType>; WriterType::Pointer writer1 = WriterType::New(); writer1->SetInput(metricRescaler->GetOutput()); writer1->SetFileName(argv[5]); writer1->Update(); - typedef itk::CastImageFilter<InputImageType, OutputImageType> CastFilterType; - CastFilterType::Pointer caster = CastFilterType::New(); + using CastFilterType = itk::CastImageFilter<InputImageType, OutputImageType>; + CastFilterType::Pointer caster = CastFilterType::New(); caster->SetInput(warper->GetOutput()); diff --git a/Examples/DisparityMap/NCCRegistrationFilterExample.cxx b/Examples/DisparityMap/NCCRegistrationFilterExample.cxx index 3e30f46660..174494baeb 100644 --- a/Examples/DisparityMap/NCCRegistrationFilterExample.cxx +++ b/Examples/DisparityMap/NCCRegistrationFilterExample.cxx @@ -64,26 +64,26 @@ int main(int argc, char** argv) const unsigned int ImageDimension = 2; - typedef double PixelType; - typedef itk::Vector<double, ImageDimension> DisplacementPixelType; + using PixelType = double; + using DisplacementPixelType = itk::Vector<double, ImageDimension>; - typedef unsigned char OutputPixelType; - typedef otb::Image<OutputPixelType, ImageDimension> OutputImageType; + using OutputPixelType = unsigned char; + using OutputImageType = otb::Image<OutputPixelType, ImageDimension>; // Several type of \doxygen{otb}{Image} are required to represent the reference image (fixed) // the image we want to register (moving) and the deformation field. // Allocate Images - typedef otb::Image<PixelType, ImageDimension> MovingImageType; - typedef otb::Image<PixelType, ImageDimension> FixedImageType; - typedef otb::Image<DisplacementPixelType, ImageDimension> DisplacementFieldType; + using MovingImageType = otb::Image<PixelType, ImageDimension>; + using FixedImageType = otb::Image<PixelType, ImageDimension>; + using DisplacementFieldType = otb::Image<DisplacementPixelType, ImageDimension>; - typedef otb::ImageFileReader<FixedImageType> FixedReaderType; - FixedReaderType::Pointer fReader = FixedReaderType::New(); + using FixedReaderType = otb::ImageFileReader<FixedImageType>; + FixedReaderType::Pointer fReader = FixedReaderType::New(); fReader->SetFileName(argv[1]); - typedef otb::ImageFileReader<MovingImageType> MovingReaderType; - MovingReaderType::Pointer mReader = MovingReaderType::New(); + using MovingReaderType = otb::ImageFileReader<MovingImageType>; + MovingReaderType::Pointer mReader = MovingReaderType::New(); mReader->SetFileName(argv[2]); // To make the correlation estimation more robust, the first @@ -91,13 +91,13 @@ int main(int argc, char** argv) // \doxygen{itk}{RecursiveGaussianImageFilter}: // Blur input images - typedef itk::RecursiveGaussianImageFilter<FixedImageType, FixedImageType> FixedBlurType; + using FixedBlurType = itk::RecursiveGaussianImageFilter<FixedImageType, FixedImageType>; FixedBlurType::Pointer fBlur = FixedBlurType::New(); fBlur->SetInput(fReader->GetOutput()); fBlur->SetSigma(std::stof(argv[7])); - typedef itk::RecursiveGaussianImageFilter<MovingImageType, MovingImageType> MovingBlurType; + using MovingBlurType = itk::RecursiveGaussianImageFilter<MovingImageType, MovingImageType>; MovingBlurType::Pointer mBlur = MovingBlurType::New(); mBlur->SetInput(mReader->GetOutput()); @@ -106,7 +106,7 @@ int main(int argc, char** argv) // Now, we need to instantiate the NCCRegistrationFilter which is going to perform the registration: // Create the filter - typedef otb::NCCRegistrationFilter<FixedImageType, MovingImageType, DisplacementFieldType> RegistrationFilterType; + using RegistrationFilterType = otb::NCCRegistrationFilter<FixedImageType, MovingImageType, DisplacementFieldType>; RegistrationFilterType::Pointer registrator = RegistrationFilterType::New(); @@ -117,7 +117,7 @@ int main(int argc, char** argv) // \begin{itemize} // \item The area where the search is performed. This area is defined by its radius: - typedef RegistrationFilterType::RadiusType RadiusType; + using RadiusType = RegistrationFilterType::RadiusType; RadiusType radius; @@ -140,20 +140,20 @@ int main(int argc, char** argv) // \doxygen{otb}{ImageFileWriter} if you want to benefit // from the streaming features. - typedef otb::ImageOfVectorsToMonoChannelExtractROI<DisplacementFieldType, MovingImageType> ChannelExtractionFilterType; - ChannelExtractionFilterType::Pointer channelExtractor = ChannelExtractionFilterType::New(); + using ChannelExtractionFilterType = otb::ImageOfVectorsToMonoChannelExtractROI<DisplacementFieldType, MovingImageType>; + ChannelExtractionFilterType::Pointer channelExtractor = ChannelExtractionFilterType::New(); channelExtractor->SetInput(registrator->GetOutput()); channelExtractor->SetChannel(1); - typedef itk::RescaleIntensityImageFilter<MovingImageType, OutputImageType> RescalerType; - RescalerType::Pointer fieldRescaler = RescalerType::New(); + using RescalerType = itk::RescaleIntensityImageFilter<MovingImageType, OutputImageType>; + RescalerType::Pointer fieldRescaler = RescalerType::New(); fieldRescaler->SetInput(channelExtractor->GetOutput()); fieldRescaler->SetOutputMaximum(255); fieldRescaler->SetOutputMinimum(0); - typedef otb::ImageFileWriter<OutputImageType> DFWriterType; + using DFWriterType = otb::ImageFileWriter<OutputImageType>; DFWriterType::Pointer dfWriter = DFWriterType::New(); dfWriter->SetFileName(argv[3]); @@ -164,8 +164,8 @@ int main(int argc, char** argv) dfWriter->SetFileName(argv[4]); dfWriter->Update(); - typedef itk::WarpImageFilter<MovingImageType, MovingImageType, DisplacementFieldType> WarperType; - WarperType::Pointer warper = WarperType::New(); + using WarperType = itk::WarpImageFilter<MovingImageType, MovingImageType, DisplacementFieldType>; + WarperType::Pointer warper = WarperType::New(); MovingImageType::PixelType padValue = 4.0; @@ -173,11 +173,11 @@ int main(int argc, char** argv) warper->SetDisplacementField(registrator->GetOutput()); warper->SetEdgePaddingValue(padValue); - typedef itk::CastImageFilter<MovingImageType, OutputImageType> CastFilterType; - CastFilterType::Pointer caster = CastFilterType::New(); + using CastFilterType = itk::CastImageFilter<MovingImageType, OutputImageType>; + CastFilterType::Pointer caster = CastFilterType::New(); caster->SetInput(warper->GetOutput()); - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using WriterType = otb::ImageFileWriter<OutputImageType>; WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[5]); diff --git a/Examples/DisparityMap/StereoReconstructionExample.cxx b/Examples/DisparityMap/StereoReconstructionExample.cxx index 50ae95d22d..d553c5e107 100644 --- a/Examples/DisparityMap/StereoReconstructionExample.cxx +++ b/Examples/DisparityMap/StereoReconstructionExample.cxx @@ -65,19 +65,19 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - typedef otb::Image<float, 2> FloatImageType; - typedef otb::VectorImage<float, 2> FloatVectorImageType; + using FloatImageType = otb::Image<float, 2>; + using FloatVectorImageType = otb::VectorImage<float, 2>; - typedef otb::ImageFileReader<FloatImageType> ImageReaderType; + using ImageReaderType = otb::ImageFileReader<FloatImageType>; - typedef otb::ImageFileWriter<FloatImageType> WriterType; + using WriterType = otb::ImageFileWriter<FloatImageType>; - typedef unsigned char OutputPixelType; - typedef otb::Image<OutputPixelType, 2> OutputImageType; + using OutputPixelType = unsigned char; + using OutputImageType = otb::Image<OutputPixelType, 2>; - typedef itk::RescaleIntensityImageFilter<FloatImageType, OutputImageType> RescalerType; + using RescalerType = itk::RescaleIntensityImageFilter<FloatImageType, OutputImageType>; - typedef otb::ImageFileWriter<OutputImageType> OutputWriterType; + using OutputWriterType = otb::ImageFileWriter<OutputImageType>; // This example demonstrates the use of the following filters : // \begin{itemize} // \item \doxygen{otb}{StereorectificationDisplacementFieldSource} @@ -88,30 +88,30 @@ int main(int argc, char* argv[]) // \item \doxygen{otb}{DisparityMapToDEMFilter} // \end{itemize} - typedef otb::StereorectificationDisplacementFieldSource<FloatImageType, FloatVectorImageType> DisplacementFieldSourceType; + using DisplacementFieldSourceType = otb::StereorectificationDisplacementFieldSource<FloatImageType, FloatVectorImageType>; - typedef itk::Vector<double, 2> DisplacementType; - typedef otb::Image<DisplacementType> DisplacementFieldType; + using DisplacementType = itk::Vector<double, 2>; + using DisplacementFieldType = otb::Image<DisplacementType>; - typedef itk::VectorCastImageFilter<FloatVectorImageType, DisplacementFieldType> DisplacementFieldCastFilterType; + using DisplacementFieldCastFilterType = itk::VectorCastImageFilter<FloatVectorImageType, DisplacementFieldType>; - typedef otb::StreamingWarpImageFilter<FloatImageType, FloatImageType, DisplacementFieldType> WarpFilterType; + using WarpFilterType = otb::StreamingWarpImageFilter<FloatImageType, FloatImageType, DisplacementFieldType>; - typedef otb::BCOInterpolateImageFunction<FloatImageType> BCOInterpolationType; + using BCOInterpolationType = otb::BCOInterpolateImageFunction<FloatImageType>; - typedef otb::Functor::NCCBlockMatching<FloatImageType, FloatImageType> NCCBlockMatchingFunctorType; + using NCCBlockMatchingFunctorType = otb::Functor::NCCBlockMatching<FloatImageType, FloatImageType>; - typedef otb::PixelWiseBlockMatchingImageFilter<FloatImageType, FloatImageType, FloatImageType, FloatImageType, NCCBlockMatchingFunctorType> - NCCBlockMatchingFilterType; + using NCCBlockMatchingFilterType = + otb::PixelWiseBlockMatchingImageFilter<FloatImageType, FloatImageType, FloatImageType, FloatImageType, NCCBlockMatchingFunctorType>; - typedef otb::BandMathImageFilter<FloatImageType> BandMathFilterType; + using BandMathFilterType = otb::BandMathImageFilter<FloatImageType>; - typedef otb::SubPixelDisparityImageFilter<FloatImageType, FloatImageType, FloatImageType, FloatImageType, NCCBlockMatchingFunctorType> - NCCSubPixelDisparityFilterType; + using NCCSubPixelDisparityFilterType = + otb::SubPixelDisparityImageFilter<FloatImageType, FloatImageType, FloatImageType, FloatImageType, NCCBlockMatchingFunctorType>; - typedef otb::DisparityMapMedianFilter<FloatImageType, FloatImageType, FloatImageType> MedianFilterType; + using MedianFilterType = otb::DisparityMapMedianFilter<FloatImageType, FloatImageType, FloatImageType>; - typedef otb::DisparityMapToDEMFilter<FloatImageType, FloatImageType, FloatImageType, FloatVectorImageType, FloatImageType> DisparityToElevationFilterType; + using DisparityToElevationFilterType = otb::DisparityMapToDEMFilter<FloatImageType, FloatImageType, FloatImageType, FloatVectorImageType, FloatImageType>; double avgElevation = atof(argv[5]); otb::DEMHandler::Instance()->SetDefaultHeightAboveEllipsoid(avgElevation); diff --git a/Examples/FeatureExtraction/AsymmetricFusionOfLineDetectorExample.cxx b/Examples/FeatureExtraction/AsymmetricFusionOfLineDetectorExample.cxx index 99a929dc67..69e5c3840c 100644 --- a/Examples/FeatureExtraction/AsymmetricFusionOfLineDetectorExample.cxx +++ b/Examples/FeatureExtraction/AsymmetricFusionOfLineDetectorExample.cxx @@ -50,33 +50,33 @@ int main(int argc, char* argv[]) // choose to make all computations with floating point precision // and rescale the results between 0 and 255 in order to export PNG images. - typedef float InternalPixelType; - typedef unsigned char OutputPixelType; + using InternalPixelType = float; + using OutputPixelType = unsigned char; // The images are defined using the pixel type and the dimension. - typedef otb::Image<InternalPixelType, 2> InternalImageType; - typedef otb::Image<OutputPixelType, 2> OutputImageType; + using InternalImageType = otb::Image<InternalPixelType, 2>; + using OutputImageType = otb::Image<OutputPixelType, 2>; // The filter can be instantiated using the image types defined above. - typedef otb::AsymmetricFusionOfLineDetectorImageFilter<InternalImageType, InternalImageType> FilterType; + using FilterType = otb::AsymmetricFusionOfLineDetectorImageFilter<InternalImageType, InternalImageType>; // An \doxygen{otb}{ImageFileReader} class is also instantiated in order to read // image data from a file. - typedef otb::ImageFileReader<InternalImageType> ReaderType; + using ReaderType = otb::ImageFileReader<InternalImageType>; // An \doxygen{otb}{ImageFileWriter} is instantiated in order to write the // output image to a file. - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using WriterType = otb::ImageFileWriter<OutputImageType>; // The intensity rescaling of the results will be carried out by the // \code{itk::RescaleIntensityImageFilter} which is templated by the // input and output image types. - typedef itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType> RescalerType; + using RescalerType = itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType>; // Both the filter and the reader are created by invoking their \code{New()} // methods and assigning the result to SmartPointers. diff --git a/Examples/FeatureExtraction/CloudDetectionExample.cxx b/Examples/FeatureExtraction/CloudDetectionExample.cxx index 286feb1f26..11e15a5484 100644 --- a/Examples/FeatureExtraction/CloudDetectionExample.cxx +++ b/Examples/FeatureExtraction/CloudDetectionExample.cxx @@ -75,8 +75,8 @@ int main(int argc, char* argv[]) // Then we must decide what pixel type to use for the images. We choose to do // all the computations in double precision. - typedef double InputPixelType; - typedef double OutputPixelType; + using InputPixelType = double; + using OutputPixelType = double; // The images are defined using the pixel type and the // dimension. Please note that the @@ -84,28 +84,28 @@ int main(int argc, char* argv[]) // \doxygen{otb}{VectorImage} as input to handle multispectral // images. - typedef otb::VectorImage<InputPixelType, Dimension> VectorImageType; - typedef VectorImageType::PixelType VectorPixelType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + using VectorImageType = otb::VectorImage<InputPixelType, Dimension>; + using VectorPixelType = VectorImageType::PixelType; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; // We define the functor type that the filter will use. We use the // \doxygen{otb}{CloudDetectionFunctor}. - typedef otb::Functor::CloudDetectionFunctor<VectorPixelType, OutputPixelType> FunctorType; + using FunctorType = otb::Functor::CloudDetectionFunctor<VectorPixelType, OutputPixelType>; // Now we can define the \doxygen{otb}{CloudDetectionFilter} that // takes a multi-spectral image as input and produces a binary // image. - typedef otb::CloudDetectionFilter<VectorImageType, OutputImageType, FunctorType> CloudDetectionFilterType; + using CloudDetectionFilterType = otb::CloudDetectionFilter<VectorImageType, OutputImageType, FunctorType>; // An \doxygen{otb}{ImageFileReader} class is also instantiated in // order to read image data from a file. Then, an // \doxygen{otb}{ImageFileWriter} is instantiated in order to write // the output image to a file. - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType = otb::ImageFileReader<VectorImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; // The different filters composing our pipeline are created by invoking their // \code{New()} methods, assigning the results to smart pointers. @@ -157,13 +157,13 @@ int main(int argc, char* argv[]) // \end{figure} // Pretty image creation for printing - typedef otb::Image<unsigned char, Dimension> OutputPrettyImageType; - typedef otb::VectorImage<unsigned char, Dimension> InputPrettyImageType; - typedef otb::ImageFileWriter<OutputPrettyImageType> WriterPrettyOutputType; - typedef otb::ImageFileWriter<InputPrettyImageType> WriterPrettyInputType; - typedef itk::RescaleIntensityImageFilter<OutputImageType, OutputPrettyImageType> RescalerOutputType; - typedef otb::VectorRescaleIntensityImageFilter<VectorImageType, InputPrettyImageType> RescalerInputType; - typedef otb::MultiChannelExtractROI<InputPixelType, InputPixelType> ChannelExtractorType; + using OutputPrettyImageType = otb::Image<unsigned char, Dimension>; + using InputPrettyImageType = otb::VectorImage<unsigned char, Dimension>; + using WriterPrettyOutputType = otb::ImageFileWriter<OutputPrettyImageType>; + using WriterPrettyInputType = otb::ImageFileWriter<InputPrettyImageType>; + using RescalerOutputType = itk::RescaleIntensityImageFilter<OutputImageType, OutputPrettyImageType>; + using RescalerInputType = otb::VectorRescaleIntensityImageFilter<VectorImageType, InputPrettyImageType>; + using ChannelExtractorType = otb::MultiChannelExtractROI<InputPixelType, InputPixelType>; ChannelExtractorType::Pointer selecter = ChannelExtractorType::New(); RescalerInputType::Pointer inputRescaler = RescalerInputType::New(); diff --git a/Examples/FeatureExtraction/ComplexMomentPathExample.cxx b/Examples/FeatureExtraction/ComplexMomentPathExample.cxx index 909b582f5a..6032d5d493 100644 --- a/Examples/FeatureExtraction/ComplexMomentPathExample.cxx +++ b/Examples/FeatureExtraction/ComplexMomentPathExample.cxx @@ -59,10 +59,10 @@ int main(int argc, char* argv[]) const unsigned int Dimension = 2; - typedef itk::PolyLineParametricPath<Dimension> PathType; + using PathType = itk::PolyLineParametricPath<Dimension>; - typedef std::complex<double> ComplexType; - typedef otb::ComplexMomentPathFunction<PathType, ComplexType> CMType; + using ComplexType = std::complex<double>; + using CMType = otb::ComplexMomentPathFunction<PathType, ComplexType>; CMType::Pointer cmFunction = CMType::New(); @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) path->Initialize(); - typedef PathType::ContinuousIndexType ContinuousIndexType; + using ContinuousIndexType = PathType::ContinuousIndexType; ContinuousIndexType cindex; diff --git a/Examples/FeatureExtraction/ComplexMomentsImageFunctionExample.cxx b/Examples/FeatureExtraction/ComplexMomentsImageFunctionExample.cxx index 538b993387..156c3cef66 100644 --- a/Examples/FeatureExtraction/ComplexMomentsImageFunctionExample.cxx +++ b/Examples/FeatureExtraction/ComplexMomentsImageFunctionExample.cxx @@ -49,11 +49,11 @@ int main(int argc, char* argv[]) unsigned int P((unsigned char)::atoi(argv[2])); unsigned int Q((unsigned char)::atoi(argv[3])); - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; - typedef otb::Image<InputPixelType, Dimension> InputImageType; + using InputPixelType = unsigned char; + const unsigned int Dimension = 2; + using InputImageType = otb::Image<InputPixelType, Dimension>; - typedef otb::ImageFileReader<InputImageType> ReaderType; + using ReaderType = otb::ImageFileReader<InputImageType>; ReaderType::Pointer reader = ReaderType::New(); @@ -63,8 +63,8 @@ int main(int argc, char* argv[]) // input image type and the output complex type value, so we start by // defining: - typedef otb::ComplexMomentsImageFunction<InputImageType> CMType; - typedef CMType::OutputType OutputType; + using CMType = otb::ComplexMomentsImageFunction<InputImageType>; + using OutputType = CMType::OutputType; CMType::Pointer cmFunction = CMType::New(); diff --git a/Examples/FeatureExtraction/CorrelationLineDetectorExample.cxx b/Examples/FeatureExtraction/CorrelationLineDetectorExample.cxx index cfa79e5bf6..f3ec4b2251 100644 --- a/Examples/FeatureExtraction/CorrelationLineDetectorExample.cxx +++ b/Examples/FeatureExtraction/CorrelationLineDetectorExample.cxx @@ -54,33 +54,33 @@ int main(int argc, char* argv[]) // choose to make all computations with floating point precision // and rescale the results between 0 and 255 in order to export PNG images. - typedef float InternalPixelType; - typedef unsigned char OutputPixelType; + using InternalPixelType = float; + using OutputPixelType = unsigned char; // The images are defined using the pixel type and the dimension. - typedef otb::Image<InternalPixelType, 2> InternalImageType; - typedef otb::Image<OutputPixelType, 2> OutputImageType; + using InternalImageType = otb::Image<InternalPixelType, 2>; + using OutputImageType = otb::Image<OutputPixelType, 2>; // The filter can be instantiated using the image types defined above. - typedef otb::LineCorrelationDetectorImageFilter<InternalImageType, InternalImageType> FilterType; + using FilterType = otb::LineCorrelationDetectorImageFilter<InternalImageType, InternalImageType>; // An \doxygen{otb}{ImageFileReader} class is also instantiated in order to read // image data from a file. - typedef otb::ImageFileReader<InternalImageType> ReaderType; + using ReaderType = otb::ImageFileReader<InternalImageType>; // An \doxygen{otb}{ImageFileWriter} is instantiated in order to write the // output image to a file. - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using WriterType = otb::ImageFileWriter<OutputImageType>; // The intensity rescaling of the results will be carried out by the // \code{itk::RescaleIntensityImageFilter} which is templated by the // input and output image types. - typedef itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType> RescalerType; + using RescalerType = itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType>; // Both the filter and the reader are created by invoking their \code{New()} // methods and assigning the result to SmartPointers. diff --git a/Examples/FeatureExtraction/EdgeDensityExample.cxx b/Examples/FeatureExtraction/EdgeDensityExample.cxx index 655469d5e1..39571a9dde 100644 --- a/Examples/FeatureExtraction/EdgeDensityExample.cxx +++ b/Examples/FeatureExtraction/EdgeDensityExample.cxx @@ -62,7 +62,7 @@ int main(int itkNotUsed(argc), char* argv[]) /*--*/ const unsigned int Dimension = 2; - typedef float PixelType; + using PixelType = float; /** Variables for the canny detector*/ const PixelType upperThreshold = static_cast<PixelType>(atof(argv[5])); @@ -73,25 +73,25 @@ int main(int itkNotUsed(argc), char* argv[]) // As usual, we start by defining the types for the images, the reader // and the writer. - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ImageType = otb::Image<PixelType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; // We define now the type for the function which will be used by the // edge density filter to estimate this density. Here we choose a // function which counts the number of non null pixels per area. The // function takes as template the type of the image to be processed. - typedef otb::BinaryImageDensityFunction<ImageType> CountFunctionType; + using CountFunctionType = otb::BinaryImageDensityFunction<ImageType>; // These {\em non null pixels} will be the result of an edge // detector. We use here the classical Canny edge detector, which is // templated over the input and output image types. - typedef itk::CannyEdgeDetectionImageFilter<ImageType, ImageType> CannyDetectorType; + using CannyDetectorType = itk::CannyEdgeDetectionImageFilter<ImageType, ImageType>; // Finally, we can define the type for the edge density filter which // takes as template the input and output image types, the edge // detector type, and the count function type.. - typedef otb::EdgeDensityImageFilter<ImageType, ImageType, CannyDetectorType, CountFunctionType> EdgeDensityFilterType; + using EdgeDensityFilterType = otb::EdgeDensityImageFilter<ImageType, ImageType, CannyDetectorType, CountFunctionType>; // We can now instantiate the different processing objects of the // pipeline using the \code{New()} method. @@ -137,9 +137,9 @@ int main(int itkNotUsed(argc), char* argv[]) /************* Image for printing **************/ - typedef otb::Image<unsigned char, 2> OutputImageType; + using OutputImageType = otb::Image<unsigned char, 2>; - typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> RescalerType; + using RescalerType = itk::RescaleIntensityImageFilter<ImageType, OutputImageType>; RescalerType::Pointer rescaler = RescalerType::New(); @@ -148,8 +148,8 @@ int main(int itkNotUsed(argc), char* argv[]) rescaler->SetInput(filter->GetOutput()); - typedef otb::ImageFileWriter<OutputImageType> OutputWriterType; - OutputWriterType::Pointer outwriter = OutputWriterType::New(); + using OutputWriterType = otb::ImageFileWriter<OutputImageType>; + OutputWriterType::Pointer outwriter = OutputWriterType::New(); outwriter->SetFileName(prettyfilename); outwriter->SetInput(rescaler->GetOutput()); diff --git a/Examples/FeatureExtraction/FlusserMomentsImageFunctionExample.cxx b/Examples/FeatureExtraction/FlusserMomentsImageFunctionExample.cxx index 7c78689593..ff63d86ae6 100644 --- a/Examples/FeatureExtraction/FlusserMomentsImageFunctionExample.cxx +++ b/Examples/FeatureExtraction/FlusserMomentsImageFunctionExample.cxx @@ -47,12 +47,12 @@ int main(int argc, char* argv[]) const char* inputFilename = argv[1]; const unsigned int radius = atoi(argv[2]); - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + using InputPixelType = unsigned char; + const unsigned int Dimension = 2; - typedef otb::Image<InputPixelType, Dimension> InputImageType; + using InputImageType = otb::Image<InputPixelType, Dimension>; - typedef otb::ImageFileReader<InputImageType> ReaderType; + using ReaderType = otb::ImageFileReader<InputImageType>; ReaderType::Pointer reader = ReaderType::New(); @@ -62,8 +62,8 @@ int main(int argc, char* argv[]) // input image type and the output (real) type value, so we start by // defining: - typedef otb::FlusserMomentsImageFunction<InputImageType> FlusserType; - typedef FlusserType::OutputType MomentType; + using FlusserType = otb::FlusserMomentsImageFunction<InputImageType>; + using MomentType = FlusserType::OutputType; FlusserType::Pointer fmFunction = FlusserType::New(); diff --git a/Examples/FeatureExtraction/HarrisExample.cxx b/Examples/FeatureExtraction/HarrisExample.cxx index cde2e254a3..63f58fc31a 100644 --- a/Examples/FeatureExtraction/HarrisExample.cxx +++ b/Examples/FeatureExtraction/HarrisExample.cxx @@ -53,23 +53,23 @@ int main(int argc, char* argv[]) double SigmaI((double)::atof(argv[4])); double Alpha((double)::atof(argv[5])); - typedef float InputPixelType; - const unsigned int Dimension = 2; - typedef unsigned char OutputPixelType; + using InputPixelType = float; + const unsigned int Dimension = 2; + using OutputPixelType = unsigned char; - typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + using InputImageType = otb::Image<InputPixelType, Dimension>; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; - typedef otb::ImageFileReader<InputImageType> ReaderType; + using ReaderType = otb::ImageFileReader<InputImageType>; // The \doxygen{otb}{HarrisImageFilter} is templated over the // input and output image types, so we start by // defining: - typedef otb::HarrisImageFilter<InputImageType, InputImageType> HarrisFilterType; - typedef itk::RescaleIntensityImageFilter<InputImageType, OutputImageType> RescalerType; + using HarrisFilterType = otb::HarrisImageFilter<InputImageType, InputImageType>; + using RescalerType = itk::RescaleIntensityImageFilter<InputImageType, OutputImageType>; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using WriterType = otb::ImageFileWriter<OutputImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -127,10 +127,10 @@ int main(int argc, char* argv[]) // templated over the input image type, the output being a // \doxygen{itk}{PointSet} with pixel type equal to the image pixel type. - typedef otb::HarrisImageToPointSetFilter<InputImageType> FunctionType; + using FunctionType = otb::HarrisImageToPointSetFilter<InputImageType>; // We declare now the filter and a pointer to the output point set. - typedef FunctionType::OutputPointSetType OutputPointSetType; + using OutputPointSetType = FunctionType::OutputPointSetType; FunctionType::Pointer harrisPoints = FunctionType::New(); OutputPointSetType::Pointer pointSet = OutputPointSetType::New(); @@ -155,17 +155,17 @@ int main(int argc, char* argv[]) // information on using \doxygen{itk}{PointSet}s) and declaring // an iterator to it. - typedef OutputPointSetType::PointsContainer ContainerType; - ContainerType* pointsContainer = pointSet->GetPoints(); - typedef ContainerType::Iterator IteratorType; - IteratorType itList = pointsContainer->Begin(); + using ContainerType = OutputPointSetType::PointsContainer; + ContainerType* pointsContainer = pointSet->GetPoints(); + using IteratorType = ContainerType::Iterator; + IteratorType itList = pointsContainer->Begin(); // And we get the points coordinates while (itList != pointsContainer->End()) { - typedef OutputPointSetType::PointType OutputPointType; - OutputPointType pCoordinate = (itList.Value()); + using OutputPointType = OutputPointSetType::PointType; + OutputPointType pCoordinate = (itList.Value()); otbLogMacro(Debug, << pCoordinate); ++itList; } diff --git a/Examples/FeatureExtraction/HuMomentsImageFunctionExample.cxx b/Examples/FeatureExtraction/HuMomentsImageFunctionExample.cxx index b98812c681..09331ca6b2 100644 --- a/Examples/FeatureExtraction/HuMomentsImageFunctionExample.cxx +++ b/Examples/FeatureExtraction/HuMomentsImageFunctionExample.cxx @@ -47,12 +47,12 @@ int main(int argc, char* argv[]) const char* inputFilename = argv[1]; const unsigned int radius = atoi(argv[2]); - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + using InputPixelType = unsigned char; + const unsigned int Dimension = 2; - typedef otb::Image<InputPixelType, Dimension> InputImageType; + using InputImageType = otb::Image<InputPixelType, Dimension>; - typedef otb::ImageFileReader<InputImageType> ReaderType; + using ReaderType = otb::ImageFileReader<InputImageType>; ReaderType::Pointer reader = ReaderType::New(); @@ -62,8 +62,8 @@ int main(int argc, char* argv[]) // input image type and the output (real) type value, so we start by // defining: - typedef otb::HuMomentsImageFunction<InputImageType> HuType; - typedef HuType::OutputType MomentType; + using HuType = otb::HuMomentsImageFunction<InputImageType>; + using MomentType = HuType::OutputType; HuType::Pointer hmFunction = HuType::New(); diff --git a/Examples/FeatureExtraction/LineSegmentDetectorExample.cxx b/Examples/FeatureExtraction/LineSegmentDetectorExample.cxx index 2f97370096..96fc322a6d 100644 --- a/Examples/FeatureExtraction/LineSegmentDetectorExample.cxx +++ b/Examples/FeatureExtraction/LineSegmentDetectorExample.cxx @@ -45,14 +45,14 @@ int main(int argc, char* argv[]) const char* infname = argv[1]; const char* outfname = argv[2]; - typedef unsigned char InputPixelType; - typedef double PrecisionType; - const unsigned int Dimension = 2; + using InputPixelType = unsigned char; + using PrecisionType = double; + const unsigned int Dimension = 2; // As usual, we start by defining the types for the input image and // the image file reader. - typedef otb::Image<InputPixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + using ImageType = otb::Image<InputPixelType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; // We instantiate the reader and set the file name for the input image. ReaderType::Pointer reader = ReaderType::New(); @@ -64,13 +64,13 @@ int main(int argc, char* argv[]) // the coordinates of the detected segments will be given. It is // recommended to set this precision to a real type. The output of the // filter will be a \doxygen{otb}{VectorData}. - typedef otb::LineSegmentDetector<ImageType, PrecisionType> LsdFilterType; + using LsdFilterType = otb::LineSegmentDetector<ImageType, PrecisionType>; LsdFilterType::Pointer lsdFilter = LsdFilterType::New(); // We can now define the type for the writer, instantiate it and set // the file name for the output vector data. - typedef otb::VectorDataFileWriter<LsdFilterType::VectorDataType> WriterType; + using WriterType = otb::VectorDataFileWriter<LsdFilterType::VectorDataType>; WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outfname); diff --git a/Examples/FeatureExtraction/PanTexExample.cxx b/Examples/FeatureExtraction/PanTexExample.cxx index 9b2807b5fd..3066ca7e1b 100644 --- a/Examples/FeatureExtraction/PanTexExample.cxx +++ b/Examples/FeatureExtraction/PanTexExample.cxx @@ -61,17 +61,17 @@ int main(int argc, char* argv[]) const char* inprettyfname = argv[3]; const char* outprettyfname = argv[4]; - typedef double PixelType; - const int Dimension = 2; - typedef otb::Image<PixelType, Dimension> ImageType; + using PixelType = double; + const int Dimension = 2; + using ImageType = otb::Image<PixelType, Dimension>; // After defining the types for the pixels and the images used in the // example, we define the type for the PanTex filter. It is // templated by the input and output image types. - typedef otb::ScalarImageToPanTexTextureFilter<ImageType, ImageType> PanTexTextureFilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using PanTexTextureFilterType = otb::ScalarImageToPanTexTextureFilter<ImageType, ImageType>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -119,9 +119,9 @@ int main(int argc, char* argv[]) // Pretty image creation for printing - typedef otb::Image<unsigned char, Dimension> OutputPrettyImageType; - typedef otb::ImageFileWriter<OutputPrettyImageType> WriterPrettyOutputType; - typedef itk::RescaleIntensityImageFilter<ImageType, OutputPrettyImageType> RescalerOutputType; + using OutputPrettyImageType = otb::Image<unsigned char, Dimension>; + using WriterPrettyOutputType = otb::ImageFileWriter<OutputPrettyImageType>; + using RescalerOutputType = itk::RescaleIntensityImageFilter<ImageType, OutputPrettyImageType>; RescalerOutputType::Pointer outputRescaler = RescalerOutputType::New(); WriterPrettyOutputType::Pointer prettyOutputWriter = WriterPrettyOutputType::New(); diff --git a/Examples/FeatureExtraction/RatioLineDetectorExample.cxx b/Examples/FeatureExtraction/RatioLineDetectorExample.cxx index 51c519e07d..1ea17023b8 100644 --- a/Examples/FeatureExtraction/RatioLineDetectorExample.cxx +++ b/Examples/FeatureExtraction/RatioLineDetectorExample.cxx @@ -54,33 +54,33 @@ int main(int argc, char* argv[]) // choose to make all computations with floating point precision // and rescale the results between 0 and 255 in order to export PNG images. - typedef float InternalPixelType; - typedef unsigned char OutputPixelType; + using InternalPixelType = float; + using OutputPixelType = unsigned char; // The images are defined using the pixel type and the dimension. - typedef otb::Image<InternalPixelType, 2> InternalImageType; - typedef otb::Image<OutputPixelType, 2> OutputImageType; + using InternalImageType = otb::Image<InternalPixelType, 2>; + using OutputImageType = otb::Image<OutputPixelType, 2>; // The filter can be instantiated using the image types defined above. - typedef otb::LineRatioDetectorImageFilter<InternalImageType, InternalImageType> FilterType; + using FilterType = otb::LineRatioDetectorImageFilter<InternalImageType, InternalImageType>; // An \doxygen{otb}{ImageFileReader} class is also instantiated in order to read // image data from a file. - typedef otb::ImageFileReader<InternalImageType> ReaderType; + using ReaderType = otb::ImageFileReader<InternalImageType>; // An \doxygen{otb}{ImageFileWriter} is instantiated in order to write the // output image to a file. - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using WriterType = otb::ImageFileWriter<OutputImageType>; // The intensity rescaling of the results will be carried out by the // \code{itk::RescaleIntensityImageFilter} which is templated by the // input and output image types. - typedef itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType> RescalerType; + using RescalerType = itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType>; // Both the filter and the reader are created by invoking their \code{New()} // methods and assigning the result to SmartPointers. diff --git a/Examples/FeatureExtraction/RightAngleDetectionExample.cxx b/Examples/FeatureExtraction/RightAngleDetectionExample.cxx index db09ada8a9..6a20332b20 100644 --- a/Examples/FeatureExtraction/RightAngleDetectionExample.cxx +++ b/Examples/FeatureExtraction/RightAngleDetectionExample.cxx @@ -53,12 +53,12 @@ int main(int argc, char* argv[]) double angleThreshold = atof(argv[3]); double distanceThreshold = atof(argv[4]); - const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef double PrecisionType; + const unsigned int Dimension = 2; + using PixelType = unsigned char; + using PrecisionType = double; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + using ImageType = otb::Image<PixelType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; auto reader = ReaderType::New(); reader->SetFileName(infname); @@ -70,20 +70,20 @@ int main(int argc, char* argv[]) // to store the detected lines which will be provided by the line // segment detector. - typedef otb::VectorData<PrecisionType> VectorDataType; + using VectorDataType = otb::VectorData<PrecisionType>; // The right angle detector's output is a vector data where each point // gives the coordinate of the detected angle. // // Next, We define the type for the line segment detector. A detailed // example for this detector can be found in section \ref{sec:LSD}. - typedef otb::LineSegmentDetector<ImageType, PrecisionType> LsdFilterType; + using LsdFilterType = otb::LineSegmentDetector<ImageType, PrecisionType>; // We can finally define the type for the right angle detection // filter. This filter is templated over the input vector data type // provided by the line segment detector. - typedef otb::VectorDataToRightAngleVectorDataFilter<VectorDataType> RightAngleFilterType; + using RightAngleFilterType = otb::VectorDataToRightAngleVectorDataFilter<VectorDataType>; // We instantiate the line segment detector and the right angle detector. @@ -101,7 +101,7 @@ int main(int argc, char* argv[]) rightAngleFilter->SetAngleThreshold(angleThreshold); rightAngleFilter->SetDistanceThreshold(distanceThreshold); - typedef otb::VectorDataFileWriter<LsdFilterType::VectorDataType> WriterType; + using WriterType = otb::VectorDataFileWriter<LsdFilterType::VectorDataType>; auto rightAngleWriter = WriterType::New(); diff --git a/Examples/FeatureExtraction/SFSExample.cxx b/Examples/FeatureExtraction/SFSExample.cxx index cf546cc1f0..1916fe0f0d 100644 --- a/Examples/FeatureExtraction/SFSExample.cxx +++ b/Examples/FeatureExtraction/SFSExample.cxx @@ -61,7 +61,7 @@ int main(int itkNotUsed(argc), char* argv[]) { - typedef double PixelType; + using PixelType = double; const unsigned int Dimension = 2; std::string inName = argv[1]; @@ -86,13 +86,13 @@ int main(int itkNotUsed(argc), char* argv[]) // As with every OTB program, we start by defining the types for the // images, the readers and the writers. - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ImageType = otb::Image<PixelType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; // The we can instantiate the type for the SFS filter, which is // templated over the input and output pixel types. - typedef otb::SFSTexturesImageFilter<ImageType, ImageType> SFSFilterType; + using SFSFilterType = otb::SFSTexturesImageFilter<ImageType, ImageType>; // After that, we can instantiate the filter. We will also instantiate // the reader and one writer for each output image, since the SFS // filter generates 6 different features. @@ -181,9 +181,9 @@ int main(int itkNotUsed(argc), char* argv[]) // \end{figure} /************** pretty images for printing *********/ - typedef otb::Image<unsigned char, 2> OutputImageType; - typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> RescalerType; - typedef otb::ImageFileWriter<OutputImageType> OutputWriterType; + using OutputImageType = otb::Image<unsigned char, 2>; + using RescalerType = itk::RescaleIntensityImageFilter<ImageType, OutputImageType>; + using OutputWriterType = otb::ImageFileWriter<OutputImageType>; RescalerType::Pointer rescaler = RescalerType::New(); rescaler->SetOutputMinimum(0); diff --git a/Examples/FeatureExtraction/SURFExample.cxx b/Examples/FeatureExtraction/SURFExample.cxx index 0c1afa2a1d..85020bcc31 100644 --- a/Examples/FeatureExtraction/SURFExample.cxx +++ b/Examples/FeatureExtraction/SURFExample.cxx @@ -63,18 +63,18 @@ int main(int argc, char* argv[]) // scalar image of float pixels. We also define the corresponding // image reader. - typedef float RealType; - typedef otb::Image<RealType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + using RealType = float; + using ImageType = otb::Image<RealType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; // The SURF descriptors will be stored in a point set containing the // vector of features. - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + using RealVectorType = itk::VariableLengthVector<RealType>; + using PointSetType = itk::PointSet<RealVectorType, Dimension>; // The SURF filter itself is templated over the input image and the // generated point set. - typedef otb::ImageToSURFKeyPointSetFilter<ImageType, PointSetType> ImageToFastSURFKeyPointSetFilterType; + using ImageToFastSURFKeyPointSetFilterType = otb::ImageToSURFKeyPointSetFilter<ImageType, PointSetType>; // We instantiate the reader. ReaderType::Pointer reader = ReaderType::New(); @@ -94,10 +94,10 @@ int main(int argc, char* argv[]) // input image. In order to do this, we will create the following RGB // image and the corresponding writer: - typedef unsigned char PixelType; - typedef itk::RGBPixel<PixelType> RGBPixelType; - typedef otb::Image<RGBPixelType, 2> OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using PixelType = unsigned char; + using RGBPixelType = itk::RGBPixel<PixelType>; + using OutputImageType = otb::Image<RGBPixelType, 2>; + using WriterType = otb::ImageFileWriter<OutputImageType>; OutputImageType::Pointer outputImage = OutputImageType::New(); // We set the regions of the image by copying the information from the @@ -136,8 +136,8 @@ int main(int argc, char* argv[]) // going to walk through using an iterator. These are the types needed // for this task: - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointsContainerType::Iterator PointsIteratorType; + using PointsContainerType = PointSetType::PointsContainer; + using PointsIteratorType = PointsContainerType::Iterator; // We set the iterator to the beginning of the point set. PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); diff --git a/Examples/FeatureExtraction/TextureExample.cxx b/Examples/FeatureExtraction/TextureExample.cxx index 5705c69e64..69198def26 100644 --- a/Examples/FeatureExtraction/TextureExample.cxx +++ b/Examples/FeatureExtraction/TextureExample.cxx @@ -54,16 +54,16 @@ int main(int argc, char* argv[]) const unsigned int xOffset = static_cast<unsigned int>(atoi(argv[5])); const unsigned int yOffset = static_cast<unsigned int>(atoi(argv[6])); - typedef double PixelType; - const int Dimension = 2; - typedef otb::Image<PixelType, Dimension> ImageType; + using PixelType = double; + const int Dimension = 2; + using ImageType = otb::Image<PixelType, Dimension>; // After defining the types for the pixels and the images used in the // example, we define the types for the textures filter. It is // templated by the input and output image types. - typedef otb::ScalarImageToTexturesFilter<ImageType, ImageType> TexturesFilterType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using TexturesFilterType = otb::ScalarImageToTexturesFilter<ImageType, ImageType>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -87,14 +87,14 @@ int main(int argc, char* argv[]) // The offset is always an array of N values, where N is the number of // dimensions of the image. - typedef ImageType::SizeType SizeType; - SizeType sradius; + using SizeType = ImageType::SizeType; + SizeType sradius; sradius.Fill(radius); texturesFilter->SetRadius(sradius); - typedef ImageType::OffsetType OffsetType; - OffsetType offset; + using OffsetType = ImageType::OffsetType; + OffsetType offset; offset[0] = xOffset; offset[1] = yOffset; @@ -117,12 +117,12 @@ int main(int argc, char* argv[]) writer->Update(); // Pretty image creation for printing - typedef otb::VectorImage<double, 2> VectorImageType; - typedef otb::VectorImage<unsigned char, 2> PrettyVectorImageType; - typedef otb::ImageFileWriter<PrettyVectorImageType> WriterPrettyOutputType; + using VectorImageType = otb::VectorImage<double, 2>; + using PrettyVectorImageType = otb::VectorImage<unsigned char, 2>; + using WriterPrettyOutputType = otb::ImageFileWriter<PrettyVectorImageType>; - typedef otb::ImageToVectorImageCastFilter<ImageType, VectorImageType> VectorCastFilterType; - typedef otb::VectorRescaleIntensityImageFilter<VectorImageType, PrettyVectorImageType> RescalerOutputType; + using VectorCastFilterType = otb::ImageToVectorImageCastFilter<ImageType, VectorImageType>; + using RescalerOutputType = otb::VectorRescaleIntensityImageFilter<VectorImageType, PrettyVectorImageType>; RescalerOutputType::Pointer outputRescaler = RescalerOutputType::New(); WriterPrettyOutputType::Pointer prettyOutputWriter = WriterPrettyOutputType::New(); diff --git a/Examples/FeatureExtraction/ThresholdToPointSetExample.cxx b/Examples/FeatureExtraction/ThresholdToPointSetExample.cxx index 44f2645a1b..bf95ba45b4 100644 --- a/Examples/FeatureExtraction/ThresholdToPointSetExample.cxx +++ b/Examples/FeatureExtraction/ThresholdToPointSetExample.cxx @@ -54,16 +54,16 @@ int main(int argc, char* argv[]) // The next step is to decide which pixel types to use for the input image // and the Point Set as well as their dimension. - typedef unsigned char PixelType; - const unsigned int Dimension = 2; + using PixelType = unsigned char; + const unsigned int Dimension = 2; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef itk::PointSet<PixelType, Dimension> PointSetType; + using ImageType = otb::Image<PixelType, Dimension>; + using PointSetType = itk::PointSet<PixelType, Dimension>; // A reader is instantiated to read the input image - typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); + using ReaderType = otb::ImageFileReader<ImageType>; + ReaderType::Pointer reader = ReaderType::New(); const char* filenamereader = argv[1]; reader->SetFileName(filenamereader); @@ -80,8 +80,8 @@ int main(int argc, char* argv[]) // Then we create the ThresholdImageToPointSetFilter and we pass the // parameters. - typedef otb::ThresholdImageToPointSetFilter<ImageType, PointSetType> FilterThresholdType; - FilterThresholdType::Pointer filterThreshold = FilterThresholdType::New(); + using FilterThresholdType = otb::ThresholdImageToPointSetFilter<ImageType, PointSetType>; + FilterThresholdType::Pointer filterThreshold = FilterThresholdType::New(); filterThreshold->SetLowerThreshold(lowerThreshold); filterThreshold->SetUpperThreshold(upperThreshold); filterThreshold->SetInput(0, reader->GetOutput()); @@ -100,10 +100,10 @@ int main(int argc, char* argv[]) // To display each point, we create an iterator on the list of points, // which is accessible through the method \code{GetPoints()} of the PointSet. - typedef PointSetType::PointsContainer ContainerType; - ContainerType* pointsContainer = pointSet->GetPoints(); - typedef ContainerType::Iterator IteratorType; - IteratorType itList = pointsContainer->Begin(); + using ContainerType = PointSetType::PointsContainer; + ContainerType* pointsContainer = pointSet->GetPoints(); + using IteratorType = ContainerType::Iterator; + IteratorType itList = pointsContainer->Begin(); // A while loop enable us to through the list a display the coordinate of // each point. diff --git a/Examples/FeatureExtraction/TouziEdgeDetectorExample.cxx b/Examples/FeatureExtraction/TouziEdgeDetectorExample.cxx index 7db34e0355..43b7d79a18 100644 --- a/Examples/FeatureExtraction/TouziEdgeDetectorExample.cxx +++ b/Examples/FeatureExtraction/TouziEdgeDetectorExample.cxx @@ -63,33 +63,33 @@ int main(int argc, char* argv[]) // choose to make all computations with floating point precision // and rescale the results between 0 and 255 in order to export PNG images. - typedef float InternalPixelType; - typedef unsigned char OutputPixelType; + using InternalPixelType = float; + using OutputPixelType = unsigned char; // The images are defined using the pixel type and the dimension. - typedef otb::Image<InternalPixelType, 2> InternalImageType; - typedef otb::Image<OutputPixelType, 2> OutputImageType; + using InternalImageType = otb::Image<InternalPixelType, 2>; + using OutputImageType = otb::Image<OutputPixelType, 2>; // The filter can be instantiated using the image types defined above. - typedef otb::TouziEdgeDetectorImageFilter<InternalImageType, InternalImageType> FilterType; + using FilterType = otb::TouziEdgeDetectorImageFilter<InternalImageType, InternalImageType>; // An \doxygen{otb}{ImageFileReader} class is also instantiated in order to read // image data from a file. - typedef otb::ImageFileReader<InternalImageType> ReaderType; + using ReaderType = otb::ImageFileReader<InternalImageType>; // An \doxygen{otb}{ImageFileWriter} is instantiated in order to write the // output image to a file. - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using WriterType = otb::ImageFileWriter<OutputImageType>; // The intensity rescaling of the results will be carried out by the // \code{itk::RescaleIntensityImageFilter} which is templated by the // input and output image types. - typedef itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType> RescalerType; + using RescalerType = itk::RescaleIntensityImageFilter<InternalImageType, OutputImageType>; // Both the filter and the reader are created by invoking their \code{New()} // methods and assigning the result to SmartPointers. diff --git a/Examples/Filtering/CompositeFilterExample.cxx b/Examples/Filtering/CompositeFilterExample.cxx index 3c1a73a752..208b94d02d 100644 --- a/Examples/Filtering/CompositeFilterExample.cxx +++ b/Examples/Filtering/CompositeFilterExample.cxx @@ -57,10 +57,10 @@ public: // Next we have the standard declarations, used for object creation with // the object factory: - typedef CompositeExampleImageFilter Self; - typedef itk::ImageToImageFilter<TImageType, TImageType> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; + using Self = CompositeExampleImageFilter<TImageType>; + using Superclass = itk::ImageToImageFilter<TImageType, TImageType>; + using Pointer = itk::SmartPointer<Self>; + using ConstPointer = itk::SmartPointer<const Self>; /** Method for creation through object factory */ itkNewMacro(Self); @@ -75,7 +75,7 @@ public: // which determines the type of the threshold value. We then use the // convenience macros to define the Get and Set methods for this parameter. - typedef typename TImageType::PixelType PixelType; + using PixelType = typename TImageType::PixelType; itkGetMacro(Threshold, PixelType); itkSetMacro(Threshold, PixelType); @@ -88,9 +88,9 @@ protected: // enclosing image type: protected: - typedef itk::ThresholdImageFilter<TImageType> ThresholdType; - typedef itk::GradientMagnitudeImageFilter<TImageType, TImageType> GradientType; - typedef itk::RescaleIntensityImageFilter<TImageType, TImageType> RescalerType; + using ThresholdType = itk::ThresholdImageFilter<TImageType>; + using GradientType = itk::GradientMagnitudeImageFilter<TImageType, TImageType>; + using RescalerType = itk::RescaleIntensityImageFilter<TImageType, TImageType>; void GenerateData() override; @@ -187,11 +187,11 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - typedef otb::Image<short, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ImageType = otb::Image<short, 2>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; - typedef otb::CompositeExampleImageFilter<ImageType> FilterType; + using FilterType = otb::CompositeExampleImageFilter<ImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); diff --git a/Examples/Filtering/DanielssonDistanceMapImageFilter.cxx b/Examples/Filtering/DanielssonDistanceMapImageFilter.cxx index 747e09f08c..baca942dfe 100644 --- a/Examples/Filtering/DanielssonDistanceMapImageFilter.cxx +++ b/Examples/Filtering/DanielssonDistanceMapImageFilter.cxx @@ -66,10 +66,10 @@ int main(int argc, char* argv[]) // The input and output image types are now defined using their respective // pixel type and dimension. - typedef unsigned char InputPixelType; - typedef unsigned short OutputPixelType; - typedef otb::Image<InputPixelType, 2> InputImageType; - typedef otb::Image<OutputPixelType, 2> OutputImageType; + using InputPixelType = unsigned char; + using OutputPixelType = unsigned short; + using InputImageType = otb::Image<InputPixelType, 2>; + using OutputImageType = otb::Image<OutputPixelType, 2>; // The filter type can be instantiated using the input and output image // types defined above. A filter object is created with the \code{New()} @@ -79,20 +79,20 @@ int main(int argc, char* argv[]) // \index{itk::Danielsson\-Distance\-Map\-Image\-Filter!New()} // \index{itk::Danielsson\-Distance\-Map\-Image\-Filter!Pointer} - typedef itk::ConnectedComponentImageFilter<InputImageType, InputImageType> ConnectedType; - ConnectedType::Pointer connectedComponents = ConnectedType::New(); + using ConnectedType = itk::ConnectedComponentImageFilter<InputImageType, InputImageType>; + ConnectedType::Pointer connectedComponents = ConnectedType::New(); - typedef itk::DanielssonDistanceMapImageFilter<InputImageType, OutputImageType, OutputImageType> FilterType; - FilterType::Pointer filter = FilterType::New(); + using FilterType = itk::DanielssonDistanceMapImageFilter<InputImageType, OutputImageType, OutputImageType>; + FilterType::Pointer filter = FilterType::New(); - typedef itk::RescaleIntensityImageFilter<OutputImageType, OutputImageType> RescalerType; - RescalerType::Pointer scaler = RescalerType::New(); + using RescalerType = itk::RescaleIntensityImageFilter<OutputImageType, OutputImageType>; + RescalerType::Pointer scaler = RescalerType::New(); // // Reader and Writer types are instantiated. // - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); diff --git a/Examples/Filtering/SecondDerivativeRecursiveGaussianImageFilter.cxx b/Examples/Filtering/SecondDerivativeRecursiveGaussianImageFilter.cxx index 580bd1cd15..e7dacd6611 100644 --- a/Examples/Filtering/SecondDerivativeRecursiveGaussianImageFilter.cxx +++ b/Examples/Filtering/SecondDerivativeRecursiveGaussianImageFilter.cxx @@ -43,20 +43,20 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - typedef float PixelType; - typedef float OutputPixelType; + using PixelType = float; + using OutputPixelType = float; const unsigned int Dimension = 2; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + using ImageType = otb::Image<PixelType, Dimension>; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; - typedef itk::ImageDuplicator<OutputImageType> DuplicatorType; + using DuplicatorType = itk::ImageDuplicator<OutputImageType>; - typedef itk::RecursiveGaussianImageFilter<ImageType, ImageType> FilterType; + using FilterType = itk::RecursiveGaussianImageFilter<ImageType, ImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); diff --git a/Examples/Fusion/BayesianFusionImageFilter.cxx b/Examples/Fusion/BayesianFusionImageFilter.cxx index bfc9b5a946..50cc7d31d5 100644 --- a/Examples/Fusion/BayesianFusionImageFilter.cxx +++ b/Examples/Fusion/BayesianFusionImageFilter.cxx @@ -103,19 +103,19 @@ int main(int argc, char* argv[]) // dimension. The panchromatic image is defined as an \doxygen{otb}{Image} // and the multispectral one as \doxygen{otb}{VectorImage}. - typedef double InternalPixelType; - const unsigned int Dimension = 2; - typedef otb::Image<InternalPixelType, Dimension> PanchroImageType; - typedef otb::VectorImage<InternalPixelType, Dimension> MultiSpecImageType; + using InternalPixelType = double; + const unsigned int Dimension = 2; + using PanchroImageType = otb::Image<InternalPixelType, Dimension>; + using MultiSpecImageType = otb::VectorImage<InternalPixelType, Dimension>; - typedef double OutputPixelType; - typedef otb::VectorImage<OutputPixelType, Dimension> OutputImageType; + using OutputPixelType = double; + using OutputImageType = otb::VectorImage<OutputPixelType, Dimension>; // We instantiate reader and writer types // - typedef otb::ImageFileReader<MultiSpecImageType> ReaderVectorType; - typedef otb::ImageFileReader<PanchroImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderVectorType = otb::ImageFileReader<MultiSpecImageType>; + using ReaderType = otb::ImageFileReader<PanchroImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; ReaderVectorType::Pointer multiSpectReader = ReaderVectorType::New(); ReaderVectorType::Pointer multiSpectInterpReader = ReaderVectorType::New(); @@ -130,7 +130,7 @@ int main(int argc, char* argv[]) // The Bayesian data fusion filter type is instantiated using the images types as // a template parameters. - typedef otb::BayesianFusionFilter<MultiSpecImageType, MultiSpecImageType, PanchroImageType, OutputImageType> BayesianFusionFilterType; + using BayesianFusionFilterType = otb::BayesianFusionFilter<MultiSpecImageType, MultiSpecImageType, PanchroImageType, OutputImageType>; // Next the filter is created by invoking the \code{New()} method and // assigning the result to a \doxygen{itk}{SmartPointer}. @@ -168,13 +168,13 @@ int main(int argc, char* argv[]) } // Create an 3 band images for the software guide - typedef unsigned char OutputPixelType2; - typedef otb::VectorImage<OutputPixelType2, Dimension> OutputVectorImageType; - typedef otb::ImageFileWriter<OutputVectorImageType> VectorWriterType; - typedef otb::VectorRescaleIntensityImageFilter<MultiSpecImageType, OutputVectorImageType> VectorRescalerType; - typedef otb::VectorRescaleIntensityImageFilter<OutputImageType, OutputVectorImageType> VectorRescalerBayesianType; - typedef otb::ImageToVectorImageCastFilter<PanchroImageType, MultiSpecImageType> CasterType; - typedef otb::MultiChannelExtractROI<OutputPixelType2, OutputPixelType2> ChannelExtractorType; + using OutputPixelType2 = unsigned char; + using OutputVectorImageType = otb::VectorImage<OutputPixelType2, Dimension>; + using VectorWriterType = otb::ImageFileWriter<OutputVectorImageType>; + using VectorRescalerType = otb::VectorRescaleIntensityImageFilter<MultiSpecImageType, OutputVectorImageType>; + using VectorRescalerBayesianType = otb::VectorRescaleIntensityImageFilter<OutputImageType, OutputVectorImageType>; + using CasterType = otb::ImageToVectorImageCastFilter<PanchroImageType, MultiSpecImageType>; + using ChannelExtractorType = otb::MultiChannelExtractROI<OutputPixelType2, OutputPixelType2>; multiSpectReader->GenerateOutputInformation(); multiSpectInterpReader->GenerateOutputInformation(); diff --git a/Examples/Fusion/PanSharpeningExample.cxx b/Examples/Fusion/PanSharpeningExample.cxx index 5be6ba95c9..8d30bf6ba2 100644 --- a/Examples/Fusion/PanSharpeningExample.cxx +++ b/Examples/Fusion/PanSharpeningExample.cxx @@ -80,11 +80,11 @@ int main(int argc, char* argv[]) // \doxygen{otb}{Image} while the XS reader uses an // \doxygen{otb}{VectorImage}. - typedef otb::Image<double, 2> ImageType; - typedef otb::VectorImage<double, 2> VectorImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileReader<VectorImageType> ReaderVectorType; - typedef otb::VectorImage<unsigned short int, 2> VectorIntImageType; + using ImageType = otb::Image<double, 2>; + using VectorImageType = otb::VectorImage<double, 2>; + using ReaderType = otb::ImageFileReader<ImageType>; + using ReaderVectorType = otb::ImageFileReader<VectorImageType>; + using VectorIntImageType = otb::VectorImage<unsigned short int, 2>; ReaderVectorType::Pointer readerXS = ReaderVectorType::New(); ReaderType::Pointer readerPAN = ReaderType::New(); @@ -96,26 +96,26 @@ int main(int argc, char* argv[]) // We declare the fusion filter an set its inputs using the readers: - typedef otb::SimpleRcsPanSharpeningFusionImageFilter<ImageType, VectorImageType, VectorIntImageType> FusionFilterType; - FusionFilterType::Pointer fusion = FusionFilterType::New(); + using FusionFilterType = otb::SimpleRcsPanSharpeningFusionImageFilter<ImageType, VectorImageType, VectorIntImageType>; + FusionFilterType::Pointer fusion = FusionFilterType::New(); fusion->SetPanInput(readerPAN->GetOutput()); fusion->SetXsInput(readerXS->GetOutput()); // And finally, we declare the writer and call its \code{Update()} method to // trigger the full pipeline execution. - typedef otb::ImageFileWriter<VectorIntImageType> WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = otb::ImageFileWriter<VectorIntImageType>; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[3]); writer->SetInput(fusion->GetOutput()); writer->Update(); - typedef otb::PrintableImageFilter<VectorIntImageType> PrintableImageType; - PrintableImageType::Pointer printable = PrintableImageType::New(); + using PrintableImageType = otb::PrintableImageFilter<VectorIntImageType>; + PrintableImageType::Pointer printable = PrintableImageType::New(); - typedef otb::VectorImage<unsigned char, 2> VectorCharImageType; - typedef otb::ImageFileWriter<VectorCharImageType> PNGWriterType; - PNGWriterType::Pointer pngwriter = PNGWriterType::New(); + using VectorCharImageType = otb::VectorImage<unsigned char, 2>; + using PNGWriterType = otb::ImageFileWriter<VectorCharImageType>; + PNGWriterType::Pointer pngwriter = PNGWriterType::New(); printable->SetInput(fusion->GetOutput()); printable->SetChannel(3); @@ -125,8 +125,8 @@ int main(int argc, char* argv[]) pngwriter->SetInput(printable->GetOutput()); pngwriter->Update(); - typedef otb::PrintableImageFilter<VectorImageType> PrintableImageType2; - PrintableImageType2::Pointer printable2 = PrintableImageType2::New(); + using PrintableImageType2 = otb::PrintableImageFilter<VectorImageType>; + PrintableImageType2::Pointer printable2 = PrintableImageType2::New(); printable2->SetInput(readerXS->GetOutput()); printable2->SetChannel(3); printable2->SetChannel(2); @@ -135,7 +135,7 @@ int main(int argc, char* argv[]) pngwriter->SetInput(printable2->GetOutput()); pngwriter->Update(); - typedef otb::ImageToVectorImageCastFilter<ImageType, VectorImageType> VectorCastFilterType; + using VectorCastFilterType = otb::ImageToVectorImageCastFilter<ImageType, VectorImageType>; VectorCastFilterType::Pointer vectorCastFilter = VectorCastFilterType::New(); PNGWriterType::Pointer pngwriterPan = PNGWriterType::New(); diff --git a/Examples/Hyperspectral/HyperspectralUnmixingExample.cxx b/Examples/Hyperspectral/HyperspectralUnmixingExample.cxx index e45218c390..f323ef644a 100644 --- a/Examples/Hyperspectral/HyperspectralUnmixingExample.cxx +++ b/Examples/Hyperspectral/HyperspectralUnmixingExample.cxx @@ -60,18 +60,18 @@ int main(int argc, char* argv[]) const unsigned int estimateNumberOfEndmembers = atoi(argv[6]); const unsigned int Dimension = 2; - typedef double PixelType; + using PixelType = double; // We start by defining the types for the images and the reader and // the writer. We choose to work with a \doxygen{otb}{VectorImage}, // since we will produce a multi-channel image (the principal // components) from a multi-channel input image. - typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ImageType = otb::VectorImage<PixelType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; - typedef otb::VectorRescaleIntensityImageFilter<ImageType, ImageType> RescalerType; - typedef otb::VectorImageToMatrixImageFilter<ImageType> VectorImageToMatrixImageFilterType; + using RescalerType = otb::VectorRescaleIntensityImageFilter<ImageType, ImageType>; + using VectorImageToMatrixImageFilterType = otb::VectorImageToMatrixImageFilter<ImageType>; // We set the seed of the random number generator. @@ -106,8 +106,8 @@ int main(int argc, char* argv[]) // needs to be estimated. // We can now the instantiate the filter. - typedef otb::VCAImageFilter<ImageType> VCAFilterType; - VCAFilterType::Pointer vca = VCAFilterType::New(); + using VCAFilterType = otb::VCAImageFilter<ImageType>; + VCAFilterType::Pointer vca = VCAFilterType::New(); vca->SetNumberOfEndmembers(estimateNumberOfEndmembers); vca->SetInput(rescaler->GetOutput()); @@ -122,8 +122,8 @@ int main(int argc, char* argv[]) // We can now procedd to the unmixing algorithm.Parameters // needed are the input image and the endmembers matrix. - typedef otb::UnConstrainedLeastSquareImageFilter<ImageType, ImageType, double> UCLSUnmixingFilterType; - UCLSUnmixingFilterType::Pointer unmixer = UCLSUnmixingFilterType::New(); + using UCLSUnmixingFilterType = otb::UnConstrainedLeastSquareImageFilter<ImageType, ImageType, double>; + UCLSUnmixingFilterType::Pointer unmixer = UCLSUnmixingFilterType::New(); unmixer->SetInput(rescaler->GetOutput()); unmixer->GetModifiableFunctor().SetMatrix(endMember2Matrix->GetMatrix()); @@ -152,11 +152,11 @@ int main(int argc, char* argv[]) // \label{fig:UNMIXING_FILTER} // \end{figure} - typedef otb::Image<PixelType, Dimension> MonoImageType; - typedef otb::MultiToMonoChannelExtractROI<PixelType, PixelType> ExtractROIFilterType; - typedef otb::Image<unsigned char, 2> OutputImageType; - typedef itk::RescaleIntensityImageFilter<MonoImageType, OutputImageType> PrettyRescalerType; - typedef otb::ImageFileWriter<OutputImageType> WriterType2; + using MonoImageType = otb::Image<PixelType, Dimension>; + using ExtractROIFilterType = otb::MultiToMonoChannelExtractROI<PixelType, PixelType>; + using OutputImageType = otb::Image<unsigned char, 2>; + using PrettyRescalerType = itk::RescaleIntensityImageFilter<MonoImageType, OutputImageType>; + using WriterType2 = otb::ImageFileWriter<OutputImageType>; for (unsigned int cpt = 0; cpt < 3; ++cpt) { diff --git a/Examples/IO/ComplexImageReadWrite.cxx b/Examples/IO/ComplexImageReadWrite.cxx index 1db668a546..6ebdd56696 100644 --- a/Examples/IO/ComplexImageReadWrite.cxx +++ b/Examples/IO/ComplexImageReadWrite.cxx @@ -55,14 +55,14 @@ int main(int argc, char* argv[]) const unsigned int Dimension = 2; - typedef std::complex<float> PixelType; - typedef otb::Image<PixelType, Dimension> ImageType; + using PixelType = std::complex<float>; + using ImageType = otb::Image<PixelType, Dimension>; // The image file reader and writer types are instantiated using the image // type. We can then create objects for both of them. - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); diff --git a/Examples/IO/DEMToImageGenerator.cxx b/Examples/IO/DEMToImageGenerator.cxx index 04e1ea3d6a..5e6925daba 100644 --- a/Examples/IO/DEMToImageGenerator.cxx +++ b/Examples/IO/DEMToImageGenerator.cxx @@ -58,26 +58,26 @@ int main(int argc, char* argv[]) // The image type is now defined using pixel type and // dimension. The output image is defined as an \doxygen{otb}{Image}. - char* folderPath = argv[9]; - char* outputName = argv[1]; - const unsigned int Dimension = 2; - typedef otb::Image<double, Dimension> ImageType; + char* folderPath = argv[9]; + char* outputName = argv[1]; + const unsigned int Dimension = 2; + using ImageType = otb::Image<double, Dimension>; // The writer is defined - typedef otb::ImageFileWriter<ImageType> WriterType; + using WriterType = otb::ImageFileWriter<ImageType>; // The DEMToImageGenerator is defined using the image pixel // type as a template parameter. After that, the object can be instancied. - typedef otb::DEMToImageGenerator<ImageType> DEMToImageGeneratorType; + using DEMToImageGeneratorType = otb::DEMToImageGenerator<ImageType>; DEMToImageGeneratorType::Pointer object = DEMToImageGeneratorType::New(); // Input parameter types are defined to set the value in the \doxygen{otb}{DEMToImageGenerator}. - typedef DEMToImageGeneratorType::SizeType SizeType; - typedef DEMToImageGeneratorType::SpacingType SpacingType; - typedef DEMToImageGeneratorType::PointType PointType; + using SizeType = DEMToImageGeneratorType::SizeType; + using SpacingType = DEMToImageGeneratorType::SpacingType; + using PointType = DEMToImageGeneratorType::PointType; // Instantiating writer WriterType::Pointer writer = WriterType::New(); @@ -136,10 +136,10 @@ int main(int argc, char* argv[]) } // Pretty image creation for the printing - typedef otb::Image<unsigned char, Dimension> OutputPrettyImageType; - typedef otb::ImageFileWriter<OutputPrettyImageType> WriterPrettyType; - typedef itk::RescaleIntensityImageFilter<ImageType, OutputPrettyImageType> RescalerType; - typedef itk::ThresholdImageFilter<ImageType> ThresholderType; + using OutputPrettyImageType = otb::Image<unsigned char, Dimension>; + using WriterPrettyType = otb::ImageFileWriter<OutputPrettyImageType>; + using RescalerType = itk::RescaleIntensityImageFilter<ImageType, OutputPrettyImageType>; + using ThresholderType = itk::ThresholdImageFilter<ImageType>; ThresholderType::Pointer thresholder = ThresholderType::New(); RescalerType::Pointer rescaler = RescalerType::New(); diff --git a/Examples/IO/ExtractROI.cxx b/Examples/IO/ExtractROI.cxx index 5d5d0a5c34..78d7587b0b 100644 --- a/Examples/IO/ExtractROI.cxx +++ b/Examples/IO/ExtractROI.cxx @@ -70,8 +70,8 @@ int main(int argc, char* argv[]) // As usual, we define the input and output pixel types. - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; + using InputPixelType = unsigned char; + using OutputPixelType = unsigned char; // First of all, we extract the multiband part by using the // \doxygen{otb}{MultiChannelExtractROI} class, which is templated @@ -79,7 +79,7 @@ int main(int argc, char* argv[]) // templated over the images types in order to force these images // to be of \doxygen{otb}{VectorImage} type. - typedef otb::MultiChannelExtractROI<InputPixelType, OutputPixelType> ExtractROIFilterType; + using ExtractROIFilterType = otb::MultiChannelExtractROI<InputPixelType, OutputPixelType>; // We create the extractor filter by using the \code{New} method of // the class and we set its parameters. @@ -101,8 +101,8 @@ int main(int argc, char* argv[]) // We will use the OTB readers and writers for file access. - typedef otb::ImageFileReader<ExtractROIFilterType::InputImageType> ReaderType; - typedef otb::ImageFileWriter<ExtractROIFilterType::InputImageType> WriterType; + using ReaderType = otb::ImageFileReader<ExtractROIFilterType::InputImageType>; + using WriterType = otb::ImageFileWriter<ExtractROIFilterType::InputImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -141,7 +141,7 @@ int main(int argc, char* argv[]) // memory usage point of view. // This class is also templated over the pixel types. - typedef otb::MultiToMonoChannelExtractROI<InputPixelType, OutputPixelType> ExtractROIMonoFilterType; + using ExtractROIMonoFilterType = otb::MultiToMonoChannelExtractROI<InputPixelType, OutputPixelType>; ExtractROIMonoFilterType::Pointer extractROIMonoFilter = ExtractROIMonoFilterType::New(); @@ -154,10 +154,10 @@ int main(int argc, char* argv[]) extractROIMonoFilter->SetChannel(4); - typedef otb::ImageFileReader<ExtractROIMonoFilterType::InputImageType> monoReaderType; - typedef otb::ImageFileWriter<ExtractROIMonoFilterType::OutputImageType> monoWriterType; - monoReaderType::Pointer monoReader = monoReaderType::New(); - monoWriterType::Pointer monoWriter = monoWriterType::New(); + using monoReaderType = otb::ImageFileReader<ExtractROIMonoFilterType::InputImageType>; + using monoWriterType = otb::ImageFileWriter<ExtractROIMonoFilterType::OutputImageType>; + monoReaderType::Pointer monoReader = monoReaderType::New(); + monoWriterType::Pointer monoWriter = monoWriterType::New(); monoReader->SetFileName(inputFilename); monoReader->Update(); // Needed to know the number of channels in the image diff --git a/Examples/IO/ImageReadCastWrite.cxx b/Examples/IO/ImageReadCastWrite.cxx index 3c1d2e8144..c1a066c384 100644 --- a/Examples/IO/ImageReadCastWrite.cxx +++ b/Examples/IO/ImageReadCastWrite.cxx @@ -59,12 +59,12 @@ int main(int argc, char* argv[]) // the image stored in the file. Instead, it is the type that will be // used to store the image as soon as it is read into memory. - typedef float InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; + using InputPixelType = float; + using OutputPixelType = unsigned char; + const unsigned int Dimension = 2; - typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + using InputImageType = otb::Image<InputPixelType, Dimension>; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; // We can now instantiate the types of the reader and writer. These two // classes are parameterized over the image type. @@ -72,13 +72,13 @@ int main(int argc, char* argv[]) // \index{otb::ImageFileReader!Instantiation} // \index{otb::ImageFileWriter!Instantiation} - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; // Below we instantiate the RescaleIntensityImageFilter class that will // linearly scale the image intensities. - typedef itk::RescaleIntensityImageFilter<InputImageType, OutputImageType> FilterType; + using FilterType = itk::RescaleIntensityImageFilter<InputImageType, OutputImageType>; // A filter object is constructed and the minimum and maximum values of // the output are selected using the SetOutputMinimum() and diff --git a/Examples/IO/ImageReadRegionOfInterestWrite.cxx b/Examples/IO/ImageReadRegionOfInterestWrite.cxx index b169c652aa..05661299cf 100644 --- a/Examples/IO/ImageReadRegionOfInterestWrite.cxx +++ b/Examples/IO/ImageReadRegionOfInterestWrite.cxx @@ -53,17 +53,17 @@ int main(int argc, char* argv[]) // Image types are defined below. - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; - typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + using InputPixelType = unsigned char; + using OutputPixelType = unsigned char; + const unsigned int Dimension = 2; + using InputImageType = otb::Image<InputPixelType, Dimension>; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; // The types for the \doxygen{otb}{ImageFileReader} and \doxygen{otb}{ImageFileWriter} // are instantiated using the image types. - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; // The ExtractROI type is instantiated using // the input and output pixel types. Using the pixel types as @@ -74,7 +74,7 @@ int main(int argc, char* argv[]) // \doxygen{otb}{VectorImage}s. A filter object is created with the // New() method and assigned to a \doxygen{itk}{SmartPointer}. - typedef otb::ExtractROI<InputImageType::PixelType, OutputImageType::PixelType> FilterType; + using FilterType = otb::ExtractROI<InputImageType::PixelType, OutputImageType::PixelType>; FilterType::Pointer filter = FilterType::New(); diff --git a/Examples/IO/ImageReadWrite.cxx b/Examples/IO/ImageReadWrite.cxx index 1e01ad77cf..2bf09ac11a 100644 --- a/Examples/IO/ImageReadWrite.cxx +++ b/Examples/IO/ImageReadWrite.cxx @@ -78,9 +78,9 @@ int main(int argc, char* argv[]) // A typical selection for remote sensing images is illustrated in // the following lines. - typedef unsigned short PixelType; - const unsigned int Dimension = 2; - typedef otb::Image<PixelType, Dimension> ImageType; + using PixelType = unsigned short; + const unsigned int Dimension = 2; + using ImageType = otb::Image<PixelType, Dimension>; // Note that the dimension of the image in memory should match the one of // the image in file. There are a couple of special cases in which this @@ -94,8 +94,8 @@ int main(int argc, char* argv[]) // \index{otb::ImageFileReader!Instantiation} // \index{otb::ImageFileWriter!Instantiation} - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; // Then, we create one object of each type using the New() method and // assigning the result to a \doxygen{itk}{SmartPointer}. diff --git a/Examples/IO/ImageSeriesIOExample.cxx b/Examples/IO/ImageSeriesIOExample.cxx index bd5f6fda12..467eada48f 100644 --- a/Examples/IO/ImageSeriesIOExample.cxx +++ b/Examples/IO/ImageSeriesIOExample.cxx @@ -52,19 +52,19 @@ int main(int argc, char** argv) // We will start by defining the types for the input images and the // associated readers. - typedef unsigned short int PixelType; - const unsigned int Dimension = 2; + using PixelType = unsigned short; + const unsigned int Dimension = 2; - typedef otb::Image<PixelType, Dimension> InputImageType; + using InputImageType = otb::Image<PixelType, Dimension>; - typedef otb::ImageFileReader<InputImageType> ImageReaderType; + using ImageReaderType = otb::ImageFileReader<InputImageType>; // We will use a list of image file readers in order to open all the // input images at once. For this, we use the // \doxygen{otb}{ObjectList} object and we template it over the type // of the readers. - typedef otb::ObjectList<ImageReaderType> ReaderListType; + using ReaderListType = otb::ObjectList<ImageReaderType>; ReaderListType::Pointer readerList = ReaderListType::New(); @@ -73,7 +73,7 @@ int main(int argc, char** argv) // us to build a pipeline without really reading the images and using // lots of RAM. The \doxygen{otb}{ImageList} object will be used. - typedef otb::ImageList<InputImageType> ImageListType; + using ImageListType = otb::ImageList<InputImageType>; ImageListType::Pointer imageList = ImageListType::New(); @@ -101,9 +101,9 @@ int main(int argc, char** argv) // \doxygen{otb}{ImageListToVectorImageFilter} which is templated // over the input image list type and the output vector image type. - typedef otb::VectorImage<PixelType, Dimension> VectorImageType; + using VectorImageType = otb::VectorImage<PixelType, Dimension>; - typedef otb::ImageListToVectorImageFilter<ImageListType, VectorImageType> ImageListToVectorImageFilterType; + using ImageListToVectorImageFilterType = otb::ImageListToVectorImageFilter<ImageListType, VectorImageType>; ImageListToVectorImageFilterType::Pointer iL2VI = ImageListToVectorImageFilterType::New(); @@ -114,7 +114,7 @@ int main(int argc, char** argv) iL2VI->SetInput(imageList); - typedef otb::ImageFileWriter<VectorImageType> ImageWriterType; + using ImageWriterType = otb::ImageFileWriter<VectorImageType>; ImageWriterType::Pointer imageWriter = ImageWriterType::New(); diff --git a/Examples/IO/MetadataExample.cxx b/Examples/IO/MetadataExample.cxx index e2875c34df..2defc8098a 100644 --- a/Examples/IO/MetadataExample.cxx +++ b/Examples/IO/MetadataExample.cxx @@ -52,12 +52,12 @@ int main(int itkNotUsed(argc), char* argv[]) // and writing the metadata to an output ASCII file. As usual we // start by defining the types needed for the image to be read. - typedef unsigned char InputPixelType; - const unsigned int Dimension = 2; + using InputPixelType = unsigned char; + const unsigned int Dimension = 2; - typedef otb::Image<InputPixelType, Dimension> InputImageType; + using InputImageType = otb::Image<InputPixelType, Dimension>; - typedef otb::ImageFileReader<InputImageType> ReaderType; + using ReaderType = otb::ImageFileReader<InputImageType>; // We can now instantiate the reader and get a pointer to the input image. diff --git a/Examples/IO/MultibandImageReadWrite.cxx b/Examples/IO/MultibandImageReadWrite.cxx index 59853d649c..8973c80686 100644 --- a/Examples/IO/MultibandImageReadWrite.cxx +++ b/Examples/IO/MultibandImageReadWrite.cxx @@ -63,9 +63,9 @@ int main(int argc, char* argv[]) // do: // - typedef unsigned short PixelType; - const unsigned int Dimension = 2; - typedef otb::VectorImage<PixelType, Dimension> ImageType; + using PixelType = unsigned short; + const unsigned int Dimension = 2; + using ImageType = otb::VectorImage<PixelType, Dimension>; // We can now instantiate the types of the reader and writer. These two // classes are parameterized over the image type. @@ -73,8 +73,8 @@ int main(int argc, char* argv[]) // \index{otb::ImageFileReader!Instantiation} // \index{otb::ImageFileWriter!Instantiation} - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; // Then, we create one object of each type using the New() method and // assigning the result to a \doxygen{itk}{SmartPointer}. diff --git a/Examples/IO/VectorDataIOExample.cxx b/Examples/IO/VectorDataIOExample.cxx index 0eef2e3cca..dc8b451ccf 100644 --- a/Examples/IO/VectorDataIOExample.cxx +++ b/Examples/IO/VectorDataIOExample.cxx @@ -64,14 +64,14 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - typedef unsigned short int PixelType; + using PixelType = unsigned short; // We define the types for the vector data structure and the // corresponding file reader. - typedef otb::VectorData<PixelType, 2> VectorDataType; + using VectorDataType = otb::VectorData<PixelType, 2>; - typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; + using VectorDataFileReaderType = otb::VectorDataFileReader<VectorDataType>; // We can now instantiate the reader and read the data. VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); @@ -81,15 +81,15 @@ int main(int argc, char* argv[]) // nodes containing the actual objects of the scene. This tree will // be accessed using an \doxygen{itk}{PreOrderTreeIterator}. - typedef VectorDataType::DataTreeType DataTreeType; - typedef itk::PreOrderTreeIterator<DataTreeType> TreeIteratorType; + using DataTreeType = VectorDataType::DataTreeType; + using TreeIteratorType = itk::PreOrderTreeIterator<DataTreeType>; // In this example we will only read polygon objects from the input // file before writing them to the output file. We define the type // for the polygon object as well as an iterator to the vertices. The // polygons obtained will be stored in an \doxygen{otb}{ObjectList}. - typedef otb::Polygon<double> PolygonType; - typedef otb::ObjectList<PolygonType> PolygonListType; + using PolygonType = otb::Polygon<double>; + using PolygonListType = otb::ObjectList<PolygonType>; PolygonListType::Pointer polygonList = PolygonListType::New(); // We get the data tree and instantiate an iterator to walk through it. @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) VectorDataType::Pointer outVectorData = VectorDataType::New(); - typedef VectorDataType::DataNodeType DataNodeType; + using DataNodeType = VectorDataType::DataNodeType; // We fill the data structure with the nodes. The root node is a // document which is composed of folders. A list of polygons can be // seen as a multi polygon object. @@ -150,7 +150,7 @@ int main(int argc, char* argv[]) // And finally we write the vector data to a file using a generic // \doxygen{otb}{VectorDataFileWriter}. - typedef otb::VectorDataFileWriter<VectorDataType> WriterType; + using WriterType = otb::VectorDataFileWriter<VectorDataType>; WriterType::Pointer writer = WriterType::New(); writer->SetInput(outVectorData); diff --git a/Examples/Image/Image1.cxx b/Examples/Image/Image1.cxx index b6818eff52..f93d8206eb 100644 --- a/Examples/Image/Image1.cxx +++ b/Examples/Image/Image1.cxx @@ -31,7 +31,7 @@ #include "otbImage.h" -int main(int, char* []) +int main(int, char*[]) { // Then we must decide with what type to represent the pixels // and what the dimension of the image will be. With these two @@ -39,7 +39,7 @@ int main(int, char* []) // a 2D image, which is what we often use in remote sensing // applications, anyway, with \code{unsigned short} pixel data. // - typedef otb::Image<unsigned short, 2> ImageType; + using ImageType = otb::Image<unsigned short, 2>; // The image can then be created by invoking the \code{New()} operator // from the corresponding image type and assigning the result diff --git a/Examples/Image/Image2.cxx b/Examples/Image/Image2.cxx index 797cc357f3..811640cab6 100644 --- a/Examples/Image/Image2.cxx +++ b/Examples/Image/Image2.cxx @@ -32,10 +32,10 @@ int main(int, char* argv[]) // Then, the image type should be defined by specifying the // type used to represent pixels and the dimensions of the image. - typedef unsigned char PixelType; - const unsigned int Dimension = 2; + using PixelType = unsigned char; + const unsigned int Dimension = 2; - typedef otb::Image<PixelType, Dimension> ImageType; + using ImageType = otb::Image<PixelType, Dimension>; // Using the image type, it is now possible to instantiate the image reader // class. The image type is used as a template parameter to define how the @@ -51,7 +51,7 @@ int main(int, char* argv[]) // \index{otb::ImageFileReader!Instantiation} // \index{otb::Image!read} - typedef otb::ImageFileReader<ImageType> ReaderType; + using ReaderType = otb::ImageFileReader<ImageType>; // The reader type can now be used to create one reader object. A // \doxygen{itk}{SmartPointer} (defined by the \code{::Pointer} diff --git a/Examples/Image/Image3.cxx b/Examples/Image/Image3.cxx index b00873ccad..8ab782ef5f 100644 --- a/Examples/Image/Image3.cxx +++ b/Examples/Image/Image3.cxx @@ -32,10 +32,10 @@ #include "otbImage.h" -int main(int, char* []) +int main(int, char*[]) { // First the image type should be declared - typedef otb::Image<unsigned short, 2> ImageType; + using ImageType = otb::Image<unsigned short, 2>; // Then the image object can be created ImageType::Pointer image = ImageType::New(); diff --git a/Examples/Image/Image4.cxx b/Examples/Image/Image4.cxx index d339319131..0538d67953 100644 --- a/Examples/Image/Image4.cxx +++ b/Examples/Image/Image4.cxx @@ -61,9 +61,9 @@ #include "otbImage.h" #include "itkPoint.h" -int main(int, char* []) +int main(int, char*[]) { - typedef otb::Image<unsigned short, 2> ImageType; + using ImageType = otb::Image<unsigned short, 2>; ImageType::Pointer image = ImageType::New(); @@ -164,7 +164,7 @@ int main(int, char* []) // dimension of the space. In this particular case, the dimension of the // point must match the dimension of the image. - typedef itk::Point<double, ImageType::ImageDimension> PointType; + using PointType = itk::Point<double, ImageType::ImageDimension>; // The Point class, like an \doxygen{itk}{Index}, is a relatively small and // simple object. For this reason, it is not reference-counted like the diff --git a/Examples/Image/Image5.cxx b/Examples/Image/Image5.cxx index 45eb939ab0..6cf21c0843 100644 --- a/Examples/Image/Image5.cxx +++ b/Examples/Image/Image5.cxx @@ -58,16 +58,16 @@ int main(int argc, char* argv[]) // assume that the external block of memory uses the same data type to // represent the pixels. // - typedef unsigned char PixelType; - const unsigned int Dimension = 2; - typedef otb::Image<PixelType, Dimension> ImageType; + using PixelType = unsigned char; + const unsigned int Dimension = 2; + using ImageType = otb::Image<PixelType, Dimension>; // The type of the ImportImageFilter is instantiated in the // following line. // // \index{otb::ImportImageFilter!Instantiation} - typedef otb::ImportImageFilter<ImageType> ImportFilterType; + using ImportFilterType = otb::ImportImageFilter<ImageType>; // A filter object created using the \code{New()} method is then // assigned to a \code{SmartPointer}. @@ -174,8 +174,8 @@ int main(int argc, char* argv[]) // Finally, we can connect the output of this filter to a pipeline. // For simplicity we just use a writer here, but it could be any other filter. - typedef otb::ImageFileWriter<ImageType> WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = otb::ImageFileWriter<ImageType>; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[1]); diff --git a/Examples/Image/ImageListExample.cxx b/Examples/Image/ImageListExample.cxx index 2f1a7da5ca..717414b90b 100644 --- a/Examples/Image/ImageListExample.cxx +++ b/Examples/Image/ImageListExample.cxx @@ -49,18 +49,18 @@ int main(int itkNotUsed(argc), char* argv[]) // As usual, we start by defining the types for the pixel and image // types, as well as those for the readers and writers. - const unsigned int Dimension = 2; - typedef unsigned char InputPixelType; - typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<InputImageType> WriterType; + const unsigned int Dimension = 2; + using InputPixelType = unsigned char; + using InputImageType = otb::Image<InputPixelType, Dimension>; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<InputImageType>; // We can now define the type for the image list. The // \doxygen{otb}{ImageList} class is templated over the type of image // contained in it. This means that all images in a list must have the // same type. - typedef otb::ImageList<InputImageType> ImageListType; + using ImageListType = otb::ImageList<InputImageType>; // Let us assume now that we want to read an image from a file and // store it in a list. The first thing to do is to instantiate the diff --git a/Examples/Image/VectorImage.cxx b/Examples/Image/VectorImage.cxx index b6cfce05f4..41badc0686 100644 --- a/Examples/Image/VectorImage.cxx +++ b/Examples/Image/VectorImage.cxx @@ -46,7 +46,7 @@ #include "otbVectorImage.h" -int main(int, char* []) +int main(int, char*[]) { // The VectorImage class is templated over the type used to represent // the coordinate in space and over the dimension of the space. In @@ -55,8 +55,8 @@ int main(int, char* []) // // \index{otb::VectorImage!Instantiation} - typedef unsigned char PixelType; - typedef otb::VectorImage<PixelType, 2> ImageType; + using PixelType = unsigned char; + using ImageType = otb::VectorImage<PixelType, 2>; // Then the image object can be created ImageType::Pointer image = ImageType::New(); diff --git a/Examples/Installation/HelloWorld.cxx b/Examples/Installation/HelloWorld.cxx index f0040c92a6..211962f634 100644 --- a/Examples/Installation/HelloWorld.cxx +++ b/Examples/Installation/HelloWorld.cxx @@ -28,7 +28,7 @@ int main() { - typedef otb::Image<unsigned short, 2> ImageType; + using ImageType = otb::Image<unsigned short, 2>; ImageType::Pointer image = ImageType::New(); diff --git a/Examples/Iterators/ImageLinearIteratorWithIndex.cxx b/Examples/Iterators/ImageLinearIteratorWithIndex.cxx index 144eedb4cc..32a8f3861b 100644 --- a/Examples/Iterators/ImageLinearIteratorWithIndex.cxx +++ b/Examples/Iterators/ImageLinearIteratorWithIndex.cxx @@ -113,14 +113,14 @@ int main(int argc, char* argv[]) const unsigned int Dimension = 2; - typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType, Dimension> ImageType; + using RGBPixelType = itk::RGBPixel<unsigned char>; + using ImageType = otb::Image<RGBPixelType, Dimension>; - typedef itk::ImageLinearIteratorWithIndex<ImageType> IteratorType; - typedef itk::ImageLinearConstIteratorWithIndex<ImageType> ConstIteratorType; + using IteratorType = itk::ImageLinearIteratorWithIndex<ImageType>; + using ConstIteratorType = itk::ImageLinearConstIteratorWithIndex<ImageType>; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; ImageType::ConstPointer inputImage; ReaderType::Pointer reader = ReaderType::New(); diff --git a/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx b/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx index 56b7ce2f58..96da9b9e6a 100644 --- a/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx +++ b/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx @@ -46,12 +46,12 @@ int main(int argc, char* argv[]) // First we declare the types of the images - typedef unsigned char PixelType; - typedef otb::Image<PixelType, 3> Image3DType; - typedef otb::Image<PixelType, 4> Image4DType; + using PixelType = unsigned char; + using Image3DType = otb::Image<PixelType, 3>; + using Image4DType = otb::Image<PixelType, 4>; - typedef otb::ImageFileReader<Image4DType> Reader4DType; - typedef otb::ImageFileWriter<Image3DType> Writer3DType; + using Reader4DType = otb::ImageFileReader<Image4DType>; + using Writer3DType = otb::ImageFileWriter<Image3DType>; Reader4DType::Pointer reader4D = Reader4DType::New(); reader4D->SetFileName(argv[1]); @@ -69,17 +69,17 @@ int main(int argc, char* argv[]) Image4DType::ConstPointer image4D = reader4D->GetOutput(); - Image3DType::Pointer image3D = Image3DType::New(); - typedef Image3DType::IndexType Index3DType; - typedef Image3DType::SizeType Size3DType; - typedef Image3DType::RegionType Region3DType; - typedef Image3DType::SpacingType Spacing3DType; - typedef Image3DType::PointType Origin3DType; + Image3DType::Pointer image3D = Image3DType::New(); + using Index3DType = Image3DType::IndexType; + using Size3DType = Image3DType::SizeType; + using Region3DType = Image3DType::RegionType; + using Spacing3DType = Image3DType::SpacingType; + using Origin3DType = Image3DType::PointType; - typedef Image4DType::IndexType Index4DType; - typedef Image4DType::SizeType Size4DType; - typedef Image4DType::SpacingType Spacing4DType; - typedef Image4DType::PointType Origin4DType; + using Index4DType = Image4DType::IndexType; + using Size4DType = Image4DType::SizeType; + using Spacing4DType = Image4DType::SpacingType; + using Origin4DType = Image4DType::PointType; Index3DType index3D; Size3DType size3D; @@ -111,12 +111,12 @@ int main(int argc, char* argv[]) image3D->SetRegions(region3D); image3D->Allocate(); - typedef itk::NumericTraits<PixelType>::AccumulateType SumType; - typedef itk::NumericTraits<SumType>::RealType MeanType; + using SumType = itk::NumericTraits<PixelType>::AccumulateType; + using MeanType = itk::NumericTraits<SumType>::RealType; const unsigned int timeLength = region4D.GetSize()[3]; - typedef itk::ImageLinearConstIteratorWithIndex<Image4DType> IteratorType; + using IteratorType = itk::ImageLinearConstIteratorWithIndex<Image4DType>; IteratorType it(image4D, region4D); it.SetDirection(3); // Walk along time dimension diff --git a/Examples/Iterators/ImageRandomConstIteratorWithIndex.cxx b/Examples/Iterators/ImageRandomConstIteratorWithIndex.cxx index 4e24eb6405..414fdf1f3d 100644 --- a/Examples/Iterators/ImageRandomConstIteratorWithIndex.cxx +++ b/Examples/Iterators/ImageRandomConstIteratorWithIndex.cxx @@ -60,11 +60,11 @@ int main(int argc, char* argv[]) const unsigned int Dimension = 2; - typedef unsigned short PixelType; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef itk::ImageRandomConstIteratorWithIndex<ImageType> ConstIteratorType; + using PixelType = unsigned short; + using ImageType = otb::Image<PixelType, Dimension>; + using ConstIteratorType = itk::ImageRandomConstIteratorWithIndex<ImageType>; - typedef otb::ImageFileReader<ImageType> ReaderType; + using ReaderType = otb::ImageFileReader<ImageType>; ImageType::ConstPointer inputImage; ReaderType::Pointer reader = ReaderType::New(); diff --git a/Examples/Iterators/ImageRegionIterator.cxx b/Examples/Iterators/ImageRegionIterator.cxx index bbb348844d..331d86fb17 100644 --- a/Examples/Iterators/ImageRegionIterator.cxx +++ b/Examples/Iterators/ImageRegionIterator.cxx @@ -63,14 +63,14 @@ int main(int argc, char* argv[]) const unsigned int Dimension = 2; - typedef unsigned char PixelType; - typedef otb::Image<PixelType, Dimension> ImageType; + using PixelType = unsigned char; + using ImageType = otb::Image<PixelType, Dimension>; - typedef itk::ImageRegionConstIterator<ImageType> ConstIteratorType; - typedef itk::ImageRegionIterator<ImageType> IteratorType; + using ConstIteratorType = itk::ImageRegionConstIterator<ImageType>; + using IteratorType = itk::ImageRegionIterator<ImageType>; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; // Information about the subregion to copy is read from the command line. The // subregion is defined by an \doxygen{itk}{ImageRegion} object, with a starting diff --git a/Examples/Iterators/ImageRegionIteratorWithIndex.cxx b/Examples/Iterators/ImageRegionIteratorWithIndex.cxx index 299585c7f2..8fcffda237 100644 --- a/Examples/Iterators/ImageRegionIteratorWithIndex.cxx +++ b/Examples/Iterators/ImageRegionIteratorWithIndex.cxx @@ -67,13 +67,13 @@ int main(int argc, char* argv[]) const unsigned int Dimension = 2; - typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType, Dimension> ImageType; + using RGBPixelType = itk::RGBPixel<unsigned char>; + using ImageType = otb::Image<RGBPixelType, Dimension>; - typedef itk::ImageRegionIteratorWithIndex<ImageType> IteratorType; + using IteratorType = itk::ImageRegionIteratorWithIndex<ImageType>; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; ImageType::ConstPointer inputImage; ReaderType::Pointer reader = ReaderType::New(); diff --git a/Examples/Iterators/ImageSliceIteratorWithIndex.cxx b/Examples/Iterators/ImageSliceIteratorWithIndex.cxx index 6029258496..66dbf8336a 100644 --- a/Examples/Iterators/ImageSliceIteratorWithIndex.cxx +++ b/Examples/Iterators/ImageSliceIteratorWithIndex.cxx @@ -117,17 +117,17 @@ int main(int argc, char* argv[]) // we need two image types, a 3D image for the input, and a 2D image for the // intensity projection. - typedef unsigned short PixelType; - typedef otb::Image<PixelType, 2> ImageType2D; - typedef otb::Image<PixelType, 3> ImageType3D; + using PixelType = unsigned short; + using ImageType2D = otb::Image<PixelType, 2>; + using ImageType3D = otb::Image<PixelType, 3>; // A slice iterator type is defined to walk the input image. - typedef itk::ImageLinearIteratorWithIndex<ImageType2D> LinearIteratorType; - typedef itk::ImageSliceConstIteratorWithIndex<ImageType3D> SliceIteratorType; + using LinearIteratorType = itk::ImageLinearIteratorWithIndex<ImageType2D>; + using SliceIteratorType = itk::ImageSliceConstIteratorWithIndex<ImageType3D>; - typedef otb::ImageFileReader<ImageType3D> ReaderType; - typedef otb::ImageFileWriter<ImageType2D> WriterType; + using ReaderType = otb::ImageFileReader<ImageType3D>; + using WriterType = otb::ImageFileWriter<ImageType2D>; ImageType3D::ConstPointer inputImage; ReaderType::Pointer reader = ReaderType::New(); diff --git a/Examples/Iterators/NeighborhoodIterators1.cxx b/Examples/Iterators/NeighborhoodIterators1.cxx index a6b92d91c9..e35b336bca 100644 --- a/Examples/Iterators/NeighborhoodIterators1.cxx +++ b/Examples/Iterators/NeighborhoodIterators1.cxx @@ -68,12 +68,12 @@ int main(int argc, char* argv[]) // the boundary condition, has been omitted because the default condition is // appropriate for this algorithm. - typedef float PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + using PixelType = float; + using ImageType = otb::Image<PixelType, 2>; + using ReaderType = otb::ImageFileReader<ImageType>; - typedef itk::ConstNeighborhoodIterator<ImageType> NeighborhoodIteratorType; - typedef itk::ImageRegionIterator<ImageType> IteratorType; + using NeighborhoodIteratorType = itk::ConstNeighborhoodIterator<ImageType>; + using IteratorType = itk::ImageRegionIterator<ImageType>; // The following code creates and executes the OTB image reader. // The \code{Update} @@ -154,11 +154,11 @@ int main(int argc, char* argv[]) // is rescaled to intensity range $[0, 255]$ and cast to unsigned char so that // it can be saved and visualized as a PNG image. - typedef unsigned char WritePixelType; - typedef otb::Image<WritePixelType, 2> WriteImageType; - typedef otb::ImageFileWriter<WriteImageType> WriterType; + using WritePixelType = unsigned char; + using WriteImageType = otb::Image<WritePixelType, 2>; + using WriterType = otb::ImageFileWriter<WriteImageType>; - typedef itk::RescaleIntensityImageFilter<ImageType, WriteImageType> RescaleFilterType; + using RescaleFilterType = itk::RescaleIntensityImageFilter<ImageType, WriteImageType>; RescaleFilterType::Pointer rescaler = RescaleFilterType::New(); diff --git a/Examples/Iterators/NeighborhoodIterators2.cxx b/Examples/Iterators/NeighborhoodIterators2.cxx index e7833381e5..c615e5553a 100644 --- a/Examples/Iterators/NeighborhoodIterators2.cxx +++ b/Examples/Iterators/NeighborhoodIterators2.cxx @@ -63,12 +63,12 @@ int main(int argc, char* argv[]) return -1; } - typedef float PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + using PixelType = float; + using ImageType = otb::Image<PixelType, 2>; + using ReaderType = otb::ImageFileReader<ImageType>; - typedef itk::ConstNeighborhoodIterator<ImageType> NeighborhoodIteratorType; - typedef itk::ImageRegionIterator<ImageType> IteratorType; + using NeighborhoodIteratorType = itk::ConstNeighborhoodIterator<ImageType>; + using IteratorType = itk::ImageRegionIterator<ImageType>; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); @@ -130,11 +130,11 @@ int main(int argc, char* argv[]) // and right of Figure~\ref{fig:NeighborhoodExamples1}. Note that x-direction // operator produces the same output image as in the previous example. - typedef unsigned char WritePixelType; - typedef otb::Image<WritePixelType, 2> WriteImageType; - typedef otb::ImageFileWriter<WriteImageType> WriterType; + using WritePixelType = unsigned char; + using WriteImageType = otb::Image<WritePixelType, 2>; + using WriterType = otb::ImageFileWriter<WriteImageType>; - typedef itk::RescaleIntensityImageFilter<ImageType, WriteImageType> RescaleFilterType; + using RescaleFilterType = itk::RescaleIntensityImageFilter<ImageType, WriteImageType>; RescaleFilterType::Pointer rescaler = RescaleFilterType::New(); diff --git a/Examples/Iterators/NeighborhoodIterators3.cxx b/Examples/Iterators/NeighborhoodIterators3.cxx index 564097cfc6..683c6104e1 100644 --- a/Examples/Iterators/NeighborhoodIterators3.cxx +++ b/Examples/Iterators/NeighborhoodIterators3.cxx @@ -67,12 +67,12 @@ int main(int argc, char* argv[]) return -1; } - typedef float PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + using PixelType = float; + using ImageType = otb::Image<PixelType, 2>; + using ReaderType = otb::ImageFileReader<ImageType>; - typedef itk::ConstNeighborhoodIterator<ImageType> NeighborhoodIteratorType; - typedef itk::ImageRegionIterator<ImageType> IteratorType; + using NeighborhoodIteratorType = itk::ConstNeighborhoodIterator<ImageType>; + using IteratorType = itk::ImageRegionIterator<ImageType>; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); @@ -103,7 +103,7 @@ int main(int argc, char* argv[]) // created to hold the regions that will later on be returned by the face // calculator. - typedef itk::NeighborhoodAlgorithm ::ImageBoundaryFacesCalculator<ImageType> FaceCalculatorType; + using FaceCalculatorType = itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<ImageType>; FaceCalculatorType faceCalculator; FaceCalculatorType::FaceListType faceList; @@ -161,11 +161,11 @@ int main(int argc, char* argv[]) // face pixels, there is a corresponding increase in efficiency from disabling // bounds checking on interior pixels. - typedef unsigned char WritePixelType; - typedef otb::Image<WritePixelType, 2> WriteImageType; - typedef otb::ImageFileWriter<WriteImageType> WriterType; + using WritePixelType = unsigned char; + using WriteImageType = otb::Image<WritePixelType, 2>; + using WriterType = otb::ImageFileWriter<WriteImageType>; - typedef itk::RescaleIntensityImageFilter<ImageType, WriteImageType> RescaleFilterType; + using RescaleFilterType = itk::RescaleIntensityImageFilter<ImageType, WriteImageType>; RescaleFilterType::Pointer rescaler = RescaleFilterType::New(); diff --git a/Examples/Iterators/NeighborhoodIterators4.cxx b/Examples/Iterators/NeighborhoodIterators4.cxx index 828a96fc9f..d3bc066d2d 100644 --- a/Examples/Iterators/NeighborhoodIterators4.cxx +++ b/Examples/Iterators/NeighborhoodIterators4.cxx @@ -69,12 +69,12 @@ int main(int argc, char* argv[]) return -1; } - typedef float PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + using PixelType = float; + using ImageType = otb::Image<PixelType, 2>; + using ReaderType = otb::ImageFileReader<ImageType>; - typedef itk::ConstNeighborhoodIterator<ImageType> NeighborhoodIteratorType; - typedef itk::ImageRegionIterator<ImageType> IteratorType; + using NeighborhoodIteratorType = itk::ConstNeighborhoodIterator<ImageType>; + using IteratorType = itk::ImageRegionIterator<ImageType>; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); @@ -95,7 +95,7 @@ int main(int argc, char* argv[]) itk::NeighborhoodInnerProduct<ImageType> innerProduct; - typedef itk::NeighborhoodAlgorithm ::ImageBoundaryFacesCalculator<ImageType> FaceCalculatorType; + using FaceCalculatorType = itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<ImageType>; FaceCalculatorType faceCalculator; FaceCalculatorType::FaceListType faceList; @@ -173,11 +173,11 @@ int main(int argc, char* argv[]) // \protect\label{fig:NeighborhoodExample4} // \end{figure} - typedef unsigned char WritePixelType; - typedef otb::Image<WritePixelType, 2> WriteImageType; - typedef otb::ImageFileWriter<WriteImageType> WriterType; + using WritePixelType = unsigned char; + using WriteImageType = otb::Image<WritePixelType, 2>; + using WriterType = otb::ImageFileWriter<WriteImageType>; - typedef itk::RescaleIntensityImageFilter<ImageType, WriteImageType> RescaleFilterType; + using RescaleFilterType = itk::RescaleIntensityImageFilter<ImageType, WriteImageType>; RescaleFilterType::Pointer rescaler = RescaleFilterType::New(); diff --git a/Examples/Iterators/NeighborhoodIterators5.cxx b/Examples/Iterators/NeighborhoodIterators5.cxx index 33ea5516d2..6718c9ce46 100644 --- a/Examples/Iterators/NeighborhoodIterators5.cxx +++ b/Examples/Iterators/NeighborhoodIterators5.cxx @@ -67,12 +67,12 @@ int main(int argc, char* argv[]) return -1; } - typedef float PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + using PixelType = float; + using ImageType = otb::Image<PixelType, 2>; + using ReaderType = otb::ImageFileReader<ImageType>; - typedef itk::ConstNeighborhoodIterator<ImageType> NeighborhoodIteratorType; - typedef itk::ImageRegionIterator<ImageType> IteratorType; + using NeighborhoodIteratorType = itk::ConstNeighborhoodIterator<ImageType>; + using IteratorType = itk::ImageRegionIterator<ImageType>; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); @@ -93,7 +93,7 @@ int main(int argc, char* argv[]) itk::NeighborhoodInnerProduct<ImageType> innerProduct; - typedef itk::NeighborhoodAlgorithm ::ImageBoundaryFacesCalculator<ImageType> FaceCalculatorType; + using FaceCalculatorType = itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<ImageType>; FaceCalculatorType faceCalculator; FaceCalculatorType::FaceListType faceList; @@ -159,11 +159,11 @@ int main(int argc, char* argv[]) // derivatives or convolution products over the same neighborhood, slice-based // processing can increase efficiency and simplify the implementation. - typedef unsigned char WritePixelType; - typedef otb::Image<WritePixelType, 2> WriteImageType; - typedef otb::ImageFileWriter<WriteImageType> WriterType; + using WritePixelType = unsigned char; + using WriteImageType = otb::Image<WritePixelType, 2>; + using WriterType = otb::ImageFileWriter<WriteImageType>; - typedef itk::RescaleIntensityImageFilter<ImageType, WriteImageType> RescaleFilterType; + using RescaleFilterType = itk::RescaleIntensityImageFilter<ImageType, WriteImageType>; RescaleFilterType::Pointer rescaler = RescaleFilterType::New(); diff --git a/Examples/Iterators/NeighborhoodIterators6.cxx b/Examples/Iterators/NeighborhoodIterators6.cxx index a2402077f7..afc136a7bd 100644 --- a/Examples/Iterators/NeighborhoodIterators6.cxx +++ b/Examples/Iterators/NeighborhoodIterators6.cxx @@ -74,16 +74,16 @@ int main(int argc, char* argv[]) return -1; } - typedef float PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef itk::NeighborhoodIterator<ImageType> NeighborhoodIteratorType; + using PixelType = float; + using ImageType = otb::Image<PixelType, 2>; + using NeighborhoodIteratorType = itk::NeighborhoodIterator<ImageType>; - typedef itk::FastMarchingImageFilter<ImageType, ImageType> FastMarchingFilterType; + using FastMarchingFilterType = itk::FastMarchingImageFilter<ImageType, ImageType>; FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New(); - typedef FastMarchingFilterType::NodeContainer NodeContainer; - typedef FastMarchingFilterType::NodeType NodeType; + using NodeContainer = FastMarchingFilterType::NodeContainer; + using NodeType = FastMarchingFilterType::NodeType; NodeContainer::Pointer seeds = NodeContainer::New(); @@ -217,11 +217,11 @@ int main(int argc, char* argv[]) // noise in the image is seen as small perturbations in each path. } // \protect\label{fig:NeighborhoodExample6} \end{figure} - typedef unsigned char WritePixelType; - typedef otb::Image<WritePixelType, 2> WriteImageType; - typedef otb::ImageFileWriter<WriteImageType> WriterType; + using WritePixelType = unsigned char; + using WriteImageType = otb::Image<WritePixelType, 2>; + using WriterType = otb::ImageFileWriter<WriteImageType>; - typedef itk::RescaleIntensityImageFilter<ImageType, WriteImageType> RescaleFilterType; + using RescaleFilterType = itk::RescaleIntensityImageFilter<ImageType, WriteImageType>; RescaleFilterType::Pointer rescaler = RescaleFilterType::New(); diff --git a/Examples/Iterators/ShapedNeighborhoodIterators1.cxx b/Examples/Iterators/ShapedNeighborhoodIterators1.cxx index cfc75e48ed..d994592eec 100644 --- a/Examples/Iterators/ShapedNeighborhoodIterators1.cxx +++ b/Examples/Iterators/ShapedNeighborhoodIterators1.cxx @@ -57,15 +57,15 @@ int main(int argc, char* argv[]) // char} pixel type will do. The image and iterator types are defined using // the pixel type. - typedef unsigned char PixelType; - typedef otb::Image<PixelType, 2> ImageType; + using PixelType = unsigned char; + using ImageType = otb::Image<PixelType, 2>; - typedef itk::ConstShapedNeighborhoodIterator<ImageType> ShapedNeighborhoodIteratorType; + using ShapedNeighborhoodIteratorType = itk::ConstShapedNeighborhoodIterator<ImageType>; - typedef itk::ImageRegionIterator<ImageType> IteratorType; + using IteratorType = itk::ImageRegionIterator<ImageType>; - typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); + using ReaderType = otb::ImageFileReader<ImageType>; + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); try @@ -100,7 +100,7 @@ int main(int argc, char* argv[]) // The face calculator object introduced in // Section~\ref{sec:NeighborhoodExample3} is created and used as before. - typedef itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<ImageType> FaceCalculatorType; + using FaceCalculatorType = itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<ImageType>; FaceCalculatorType faceCalculator; FaceCalculatorType::FaceListType faceList; @@ -183,7 +183,7 @@ int main(int argc, char* argv[]) } } - typedef otb::ImageFileWriter<ImageType> WriterType; + using WriterType = otb::ImageFileWriter<ImageType>; WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[2]); diff --git a/Examples/Iterators/ShapedNeighborhoodIterators2.cxx b/Examples/Iterators/ShapedNeighborhoodIterators2.cxx index ba78734d54..082d60a162 100644 --- a/Examples/Iterators/ShapedNeighborhoodIterators2.cxx +++ b/Examples/Iterators/ShapedNeighborhoodIterators2.cxx @@ -43,12 +43,12 @@ int main(int argc, char* argv[]) return -1; } - typedef unsigned char PixelType; - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + using PixelType = unsigned char; + using ImageType = otb::Image<PixelType, 2>; + using ReaderType = otb::ImageFileReader<ImageType>; - typedef itk::ConstShapedNeighborhoodIterator<ImageType> ShapedNeighborhoodIteratorType; - typedef itk::ImageRegionIterator<ImageType> IteratorType; + using ShapedNeighborhoodIteratorType = itk::ConstShapedNeighborhoodIterator<ImageType>; + using IteratorType = itk::ImageRegionIterator<ImageType>; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) output->SetRegions(reader->GetOutput()->GetRequestedRegion()); output->Allocate(); - typedef itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<ImageType> FaceCalculatorType; + using FaceCalculatorType = itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<ImageType>; FaceCalculatorType faceCalculator; FaceCalculatorType::FaceListType faceList; @@ -157,7 +157,7 @@ int main(int argc, char* argv[]) // \protect\label{fig:ShapedNeighborhoodExample2} // \end{figure} - typedef otb::ImageFileWriter<ImageType> WriterType; + using WriterType = otb::ImageFileWriter<ImageType>; WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[2]); diff --git a/Examples/Learning/GenerateTrainingImageExample.cxx b/Examples/Learning/GenerateTrainingImageExample.cxx index c195330765..2bcd6ae5e9 100644 --- a/Examples/Learning/GenerateTrainingImageExample.cxx +++ b/Examples/Learning/GenerateTrainingImageExample.cxx @@ -50,16 +50,16 @@ int main(int argc, char* argv[]) const char* roiFilename = argv[2]; const char* outputFilename = argv[3]; - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; + using InputPixelType = unsigned char; + using OutputPixelType = unsigned char; const unsigned int Dimension = 2; - typedef otb::Image<InputPixelType, Dimension> InputImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + using InputImageType = otb::Image<InputPixelType, Dimension>; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -73,13 +73,13 @@ int main(int argc, char* argv[]) OutputImageType::Pointer trainingImage = OutputImageType::New(); // Declare the type of the index to access images - typedef itk::Index<Dimension> myIndexType; + using myIndexType = itk::Index<Dimension>; // Declare the type of the size - typedef itk::Size<Dimension> mySizeType; + using mySizeType = itk::Size<Dimension>; // Declare the type of the Region - typedef itk::ImageRegion<Dimension> myRegionType; + using myRegionType = itk::ImageRegion<Dimension>; // Define their size, and start index mySizeType size; @@ -146,8 +146,8 @@ int main(int argc, char* argv[]) region.SetIndex(start); // Iterator creation - typedef itk::ImageRegionIterator<OutputImageType> IteratorType; - IteratorType it(trainingImage, region); + using IteratorType = itk::ImageRegionIterator<OutputImageType>; + IteratorType it(trainingImage, region); it.GoToBegin(); diff --git a/Examples/Learning/SEMModelEstimatorExample.cxx b/Examples/Learning/SEMModelEstimatorExample.cxx index d611334748..c1291eafd6 100644 --- a/Examples/Learning/SEMModelEstimatorExample.cxx +++ b/Examples/Learning/SEMModelEstimatorExample.cxx @@ -74,13 +74,13 @@ int main(int argc, char* argv[]) // considered for the templated \code{MeasurementVectorType}, which // will be used in the \code{ListSample} interface. - typedef double PixelType; + using PixelType = double; - typedef otb::VectorImage<PixelType, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + using ImageType = otb::VectorImage<PixelType, 2>; + using ReaderType = otb::ImageFileReader<ImageType>; - typedef otb::Image<unsigned char, 2> OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using OutputImageType = otb::Image<unsigned char, 2>; + using WriterType = otb::ImageFileWriter<OutputImageType>; char* fileNameIn = argv[1]; char* fileNameImgInit = nullptr; @@ -97,8 +97,8 @@ int main(int argc, char* argv[]) // Once the input image is opened, the classifier may be initialised by // \code{SmartPointer}. - typedef otb::SEMClassifier<ImageType, OutputImageType> ClassifType; - ClassifType::Pointer classifier = ClassifType::New(); + using ClassifType = otb::SEMClassifier<ImageType, OutputImageType>; + ClassifType::Pointer classifier = ClassifType::New(); // Then, it follows, classical initializations of the pipeline. @@ -115,8 +115,8 @@ int main(int argc, char* argv[]) if (fileNameImgInit != nullptr) { - typedef otb::ImageFileReader<OutputImageType> ImgInitReaderType; - ImgInitReaderType::Pointer segReader = ImgInitReaderType::New(); + using ImgInitReaderType = otb::ImageFileReader<OutputImageType>; + ImgInitReaderType::Pointer segReader = ImgInitReaderType::New(); segReader->SetFileName(fileNameImgInit); segReader->Update(); classifier->SetClassLabels(segReader->GetOutput()); @@ -131,8 +131,8 @@ int main(int argc, char* argv[]) std::cerr << "Explicit component initialization\n"; - typedef ClassifType::ClassSampleType ClassSampleType; - typedef otb::Statistics::GaussianModelComponent<ClassSampleType> GaussianType; + using ClassSampleType = ClassifType::ClassSampleType; + using GaussianType = otb::Statistics::GaussianModelComponent<ClassSampleType>; for (int i = 0; i < numberOfClasses; ++i) { @@ -164,8 +164,8 @@ int main(int argc, char* argv[]) // classes before saving it to a file. We will use the // \doxygen{itk}{RescaleIntensityImageFilter} for this purpose. - typedef itk::RescaleIntensityImageFilter<OutputImageType, OutputImageType> RescalerType; - RescalerType::Pointer rescaler = RescalerType::New(); + using RescalerType = itk::RescaleIntensityImageFilter<OutputImageType, OutputImageType>; + RescalerType::Pointer rescaler = RescalerType::New(); rescaler->SetOutputMinimum(itk::NumericTraits<unsigned char>::min()); rescaler->SetOutputMaximum(itk::NumericTraits<unsigned char>::max()); diff --git a/Examples/Learning/SOMClassifierExample.cxx b/Examples/Learning/SOMClassifierExample.cxx index de113b80b0..6dd1624667 100644 --- a/Examples/Learning/SOMClassifierExample.cxx +++ b/Examples/Learning/SOMClassifierExample.cxx @@ -59,11 +59,11 @@ int main(int argc, char* argv[]) const char* mapFilename = argv[2]; const char* outputFilename = argv[3]; - typedef double InputPixelType; - typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; + using InputPixelType = double; + using LabelPixelType = unsigned char; + const unsigned int Dimension = 2; - typedef itk::VariableLengthVector<InputPixelType> PixelType; + using PixelType = itk::VariableLengthVector<InputPixelType>; // As for the SOM learning step, we must define the types for the // \code{otb::SOMMap}, and therefore, also for the distance to be @@ -71,12 +71,12 @@ int main(int argc, char* argv[]) // actually an \doxygen{otb}{ImageFileReader} which the appropriate // image type. - typedef itk::Statistics::EuclideanDistanceMetric<PixelType> DistanceType; - typedef otb::SOMMap<PixelType, DistanceType, Dimension> SOMMapType; - typedef otb::ImageFileReader<SOMMapType> SOMReaderType; + using DistanceType = itk::Statistics::EuclideanDistanceMetric<PixelType>; + using SOMMapType = otb::SOMMap<PixelType, DistanceType, Dimension>; + using SOMReaderType = otb::ImageFileReader<SOMMapType>; - typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; - typedef otb::ImageFileReader<InputImageType> ReaderType; + using InputImageType = otb::VectorImage<InputPixelType, Dimension>; + using ReaderType = otb::ImageFileReader<InputImageType>; // The classification will be performed by the // \doxygen{otb}{SOMClassifier}, which, as most of the @@ -88,14 +88,14 @@ int main(int argc, char* argv[]) // \code{SOMClassifier} is templated over the sample type, the SOMMap // type and the pixel type for the labels. - typedef itk::Statistics::ListSample<PixelType> SampleType; - typedef otb::SOMClassifier<SampleType, SOMMapType, LabelPixelType> ClassifierType; + using SampleType = itk::Statistics::ListSample<PixelType>; + using ClassifierType = otb::SOMClassifier<SampleType, SOMMapType, LabelPixelType>; // // The result of the classification will be stored on an image and // saved to a file. Therefore, we define the types needed for this step. - typedef otb::Image<LabelPixelType, Dimension> OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using OutputImageType = otb::Image<LabelPixelType, Dimension>; + using WriterType = otb::ImageFileWriter<OutputImageType>; // // We can now start reading the input image and the SOM given as // inputs to the program. We instantiate the readers as usual. @@ -155,7 +155,7 @@ int main(int argc, char* argv[]) // We also declare an \doxygen{itk}{ImageRegionIterator} in order // to fill the output image with the class labels. - typedef itk::ImageRegionIterator<OutputImageType> OutputIteratorType; + using OutputIteratorType = itk::ImageRegionIterator<OutputImageType>; OutputIteratorType outIt(outputImage, outputImage->GetLargestPossibleRegion()); // diff --git a/Examples/Learning/SOMExample.cxx b/Examples/Learning/SOMExample.cxx index 5b1b90bcad..bad9b7ca1d 100644 --- a/Examples/Learning/SOMExample.cxx +++ b/Examples/Learning/SOMExample.cxx @@ -83,15 +83,15 @@ int main(int itkNotUsed(argc), char* argv[]) // a 2-dimensional SOM, where the neurons store RGB values with // floating point precision. - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef ImageType::PixelType VectorType; + const unsigned int Dimension = 2; + using PixelType = double; + using ImageType = otb::VectorImage<PixelType, Dimension>; + using VectorType = ImageType::PixelType; // The distance that we want to apply between the RGB values is the // Euclidean one. Of course we could choose to use other type of // distance, as for instance, a distance defined in any other color space. - typedef itk::Statistics::EuclideanDistanceMetric<VectorType> DistanceType; + using DistanceType = itk::Statistics::EuclideanDistanceMetric<VectorType>; // // We can now define the type for the map. The \doxygen{otb}{SOMMap} // class is templated over the neuron type -- \code{PixelType} here @@ -99,28 +99,28 @@ int main(int itkNotUsed(argc), char* argv[]) // number of dimensions of the map could be different from the one of // the images to be processed. - typedef otb::SOMMap<VectorType, DistanceType, Dimension> MapType; + using MapType = otb::SOMMap<VectorType, DistanceType, Dimension>; // // We are going to perform the learning directly on the pixels of the // input image. Therefore, the image type is defined using the same // pixel type as we used for the map. We also define the type for the // imge file reader. - typedef otb::ImageFileReader<ImageType> ReaderType; + using ReaderType = otb::ImageFileReader<ImageType>; // // Since the \doxygen{otb}{SOM} class works on lists of samples, it // will need to access the input image through an adaptor. Its type is // defined as follows: - typedef itk::Statistics::ListSample<VectorType> SampleListType; + using SampleListType = itk::Statistics::ListSample<VectorType>; // // We can now define the type for the SOM, which is templated over the // input sample list and the type of the map to be produced and the two // functors that hold the training behavior. - typedef otb::Functor::CzihoSOMLearningBehaviorFunctor LearningBehaviorFunctorType; - typedef otb::Functor::CzihoSOMNeighborhoodBehaviorFunctor NeighborhoodBehaviorFunctorType; - typedef otb::SOM<SampleListType, MapType, LearningBehaviorFunctorType, NeighborhoodBehaviorFunctorType> SOMType; + using LearningBehaviorFunctorType = otb::Functor::CzihoSOMLearningBehaviorFunctor; + using NeighborhoodBehaviorFunctorType = otb::Functor::CzihoSOMNeighborhoodBehaviorFunctor; + using SOMType = otb::SOM<SampleListType, MapType, LearningBehaviorFunctorType, NeighborhoodBehaviorFunctorType>; // // As an alternative to standard \code{SOMType}, one can decide to use // an \doxygen{otb}{PeriodicSOM}, which behaves like \doxygen{otb}{SOM} but @@ -199,12 +199,12 @@ int main(int itkNotUsed(argc), char* argv[]) // \doxygen{otb}{ImageFileWriter}. // Just for visualization purposes, we zoom the image, and pass it to the printable image filter - typedef otb::Image<PixelType, 2> SingleImageType; - typedef itk::ExpandImageFilter<SingleImageType, SingleImageType> ExpandType; - typedef otb::PerBandVectorImageFilter<MapType, MapType, ExpandType> VectorExpandType; - typedef itk::NearestNeighborInterpolateImageFunction<SingleImageType, double> InterpolatorType; - typedef otb::PrintableImageFilter<MapType> PrintableFilterType; - typedef otb::ImageFileWriter<PrintableFilterType::OutputImageType> PrintableWriterType; + using SingleImageType = otb::Image<PixelType, 2>; + using ExpandType = itk::ExpandImageFilter<SingleImageType, SingleImageType>; + using VectorExpandType = otb::PerBandVectorImageFilter<MapType, MapType, ExpandType>; + using InterpolatorType = itk::NearestNeighborInterpolateImageFunction<SingleImageType, double>; + using PrintableFilterType = otb::PrintableImageFilter<MapType>; + using PrintableWriterType = otb::ImageFileWriter<PrintableFilterType::OutputImageType>; InterpolatorType::Pointer interpolator = InterpolatorType::New(); VectorExpandType::Pointer expand = VectorExpandType::New(); @@ -259,16 +259,16 @@ int main(int itkNotUsed(argc), char* argv[]) // for the set of examples given to the map. The activation map is // stored as a scalar image and an integer pixel type is usually enough. - typedef unsigned char OutputPixelType; + using OutputPixelType = unsigned char; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> ActivationWriterType; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; + using ActivationWriterType = otb::ImageFileWriter<OutputImageType>; // In a similar way to the \doxygen{otb}{SOM} class the // \doxygen{otb}{SOMActivationBuilder} is templated over the sample // list given as input, the SOM map type and the activation map to be // built as output. - typedef otb::SOMActivationBuilder<SampleListType, MapType, OutputImageType> SOMActivationBuilderType; + using SOMActivationBuilderType = otb::SOMActivationBuilder<SampleListType, MapType, OutputImageType>; // We instantiate the activation map builder and set as input the SOM // map build before and the image (using the adaptor). @@ -287,8 +287,8 @@ int main(int itkNotUsed(argc), char* argv[]) // map obtained. // Just for visualization purposes, we zoom the image. - typedef itk::ExpandImageFilter<OutputImageType, OutputImageType> ExpandType2; - typedef itk::NearestNeighborInterpolateImageFunction<OutputImageType, double> InterpolatorType2; + using ExpandType2 = itk::ExpandImageFilter<OutputImageType, OutputImageType>; + using InterpolatorType2 = itk::NearestNeighborInterpolateImageFunction<OutputImageType, double>; InterpolatorType2::Pointer interpolator2 = InterpolatorType2::New(); ExpandType2::Pointer expand2 = ExpandType2::New(); diff --git a/Examples/Learning/SVMImageEstimatorClassificationMultiExample.cxx b/Examples/Learning/SVMImageEstimatorClassificationMultiExample.cxx index e79af559e1..910b99e524 100644 --- a/Examples/Learning/SVMImageEstimatorClassificationMultiExample.cxx +++ b/Examples/Learning/SVMImageEstimatorClassificationMultiExample.cxx @@ -76,21 +76,21 @@ int main(int itkNotUsed(argc), char* argv[]) // input image will be an RGB image, we can read it as a 3 component // vector image. This simplifies the interfacing with OTB's SVM // framework. - typedef unsigned short InputPixelType; - const unsigned int Dimension = 2; + using InputPixelType = unsigned short; + const unsigned int Dimension = 2; - typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; + using InputImageType = otb::VectorImage<InputPixelType, Dimension>; - typedef otb::Image<InputPixelType, Dimension> TrainingImageType; + using TrainingImageType = otb::Image<InputPixelType, Dimension>; // The \doxygen{otb}{LibSVMMachineLearningModel} class is templated over // the input (features) and the training (labels) values. - typedef otb::LibSVMMachineLearningModel<InputPixelType, InputPixelType> ModelType; + using ModelType = otb::LibSVMMachineLearningModel<InputPixelType, InputPixelType>; // As usual, we define the readers for the images. - typedef otb::ImageFileReader<InputImageType> InputReaderType; - typedef otb::ImageFileReader<TrainingImageType> TrainingReaderType; + using InputReaderType = otb::ImageFileReader<InputImageType>; + using TrainingReaderType = otb::ImageFileReader<TrainingImageType>; InputReaderType::Pointer inputReader = InputReaderType::New(); TrainingReaderType::Pointer trainingReader = TrainingReaderType::New(); @@ -112,15 +112,15 @@ int main(int itkNotUsed(argc), char* argv[]) // ListSamples. - typedef itk::BinaryThresholdImageFilter<TrainingImageType, TrainingImageType> ThresholdFilterType; - ThresholdFilterType::Pointer thresholder = ThresholdFilterType::New(); + using ThresholdFilterType = itk::BinaryThresholdImageFilter<TrainingImageType, TrainingImageType>; + ThresholdFilterType::Pointer thresholder = ThresholdFilterType::New(); thresholder->SetInput(trainingReader->GetOutput()); thresholder->SetLowerThreshold(1); thresholder->SetOutsideValue(0); thresholder->SetInsideValue(1); - typedef itk::Statistics::ImageToListSampleFilter<InputImageType, TrainingImageType> ImageToListSample; - typedef itk::Statistics::ImageToListSampleFilter<TrainingImageType, TrainingImageType> ImageToTargetListSample; + using ImageToListSample = itk::Statistics::ImageToListSampleFilter<InputImageType, TrainingImageType>; + using ImageToTargetListSample = itk::Statistics::ImageToListSampleFilter<TrainingImageType, TrainingImageType>; ImageToListSample::Pointer imToList = ImageToListSample::New(); imToList->SetInput(inputReader->GetOutput()); @@ -150,7 +150,7 @@ int main(int itkNotUsed(argc), char* argv[]) // is templated over the sample type (the type of the data to be // classified) and the label type (the type of the output of the classifier). - typedef otb::ImageClassificationFilter<InputImageType, TrainingImageType> ClassifierType; + using ClassifierType = otb::ImageClassificationFilter<InputImageType, TrainingImageType>; ClassifierType::Pointer classifier = ClassifierType::New(); @@ -181,7 +181,7 @@ int main(int itkNotUsed(argc), char* argv[]) // values to the output image. - typedef otb::ImageFileWriter<TrainingImageType> WriterType; + using WriterType = otb::ImageFileWriter<TrainingImageType>; WriterType::Pointer writer = WriterType::New(); @@ -198,17 +198,17 @@ int main(int itkNotUsed(argc), char* argv[]) // \doxygen{itk}{UnaryFunctorImageFilter} creates an image filter for that // converts scalar images to RGB images. - typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType, 2> RGBImageType; - typedef itk::Functor::ScalarToRGBPixelFunctor<unsigned long> ColorMapFunctorType; - typedef itk::UnaryFunctorImageFilter<TrainingImageType, RGBImageType, ColorMapFunctorType> ColorMapFilterType; - ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); + using RGBPixelType = itk::RGBPixel<unsigned char>; + using RGBImageType = otb::Image<RGBPixelType, 2>; + using ColorMapFunctorType = itk::Functor::ScalarToRGBPixelFunctor<unsigned long>; + using ColorMapFilterType = itk::UnaryFunctorImageFilter<TrainingImageType, RGBImageType, ColorMapFunctorType>; + ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); colormapper->SetInput(classifier->GetOutput()); // We can now create an image file writer and save the image. - typedef otb::ImageFileWriter<RGBImageType> WriterRescaledType; + using WriterRescaledType = otb::ImageFileWriter<RGBImageType>; WriterRescaledType::Pointer writerRescaled = WriterRescaledType::New(); diff --git a/Examples/Learning/TrainMachineLearningModelFromImagesExample.cxx b/Examples/Learning/TrainMachineLearningModelFromImagesExample.cxx index 227776c73f..1016a6581b 100644 --- a/Examples/Learning/TrainMachineLearningModelFromImagesExample.cxx +++ b/Examples/Learning/TrainMachineLearningModelFromImagesExample.cxx @@ -56,12 +56,12 @@ int main(int itkNotUsed(argc), char* argv[]) const char* trainingShpFileName = argv[2]; const char* outputModelFileName = argv[3]; - typedef unsigned int InputPixelType; - const unsigned int Dimension = 2; - typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; - typedef otb::VectorData<double, 2> VectorDataType; - typedef otb::ImageFileReader<InputImageType> InputReaderType; - typedef otb::VectorDataFileReader<VectorDataType> VectorDataReaderType; + using InputPixelType = unsigned int; + const unsigned int Dimension = 2; + using InputImageType = otb::VectorImage<InputPixelType, Dimension>; + using VectorDataType = otb::VectorData<double, 2>; + using InputReaderType = otb::ImageFileReader<InputImageType>; + using VectorDataReaderType = otb::VectorDataFileReader<VectorDataType>; // In this framework, we must transform the input samples store in a vector // data into a \subdoxygen{itk}{Statistics}{ListSample} which is the structure @@ -74,7 +74,7 @@ int main(int itkNotUsed(argc), char* argv[]) // \doxygen{otb}{ListSampleGenerator} class. // VectorData projection filter - typedef otb::VectorDataIntoImageProjectionFilter<VectorDataType, InputImageType> VectorDataReprojectionType; + using VectorDataReprojectionType = otb::VectorDataIntoImageProjectionFilter<VectorDataType, InputImageType>; InputReaderType::Pointer inputReader = InputReaderType::New(); inputReader->SetFileName(inputImageFileName); @@ -98,8 +98,8 @@ int main(int itkNotUsed(argc), char* argv[]) vdreproj->Update(); - typedef otb::ListSampleGenerator<InputImageType, VectorDataType> ListSampleGeneratorType; - ListSampleGeneratorType::Pointer sampleGenerator; + using ListSampleGeneratorType = otb::ListSampleGenerator<InputImageType, VectorDataType>; + ListSampleGeneratorType::Pointer sampleGenerator; sampleGenerator = ListSampleGeneratorType::New(); sampleGenerator->SetInput(image); @@ -111,8 +111,8 @@ int main(int itkNotUsed(argc), char* argv[]) // std::cout << "Number of classes: " << sampleGenerator->GetNumberOfClasses() << std::endl; - // typedef ListSampleGeneratorType::ListSampleType ListSampleType; - // typedef otb::Statistics::ShiftScaleSampleListFilter<ListSampleType, ListSampleType> ShiftScaleFilterType; + // using ListSampleType = ListSampleGeneratorType::ListSampleType; + // using ShiftScaleFilterType = otb::Statistics::ShiftScaleSampleListFilter<ListSampleType, ListSampleType>; // // Shift scale the samples // ShiftScaleFilterType::Pointer trainingShiftScaleFilter = ShiftScaleFilterType::New(); @@ -132,7 +132,7 @@ int main(int itkNotUsed(argc), char* argv[]) // can be used to set classifier parameters. In the case of SVM, we set here the type // of the kernel. Other parameters are let with their default values. - typedef otb::SVMMachineLearningModel<InputImageType::InternalPixelType, ListSampleGeneratorType::ClassLabelType> SVMType; + using SVMType = otb::SVMMachineLearningModel<InputImageType::InternalPixelType, ListSampleGeneratorType::ClassLabelType>; SVMType::Pointer SVMClassifier = SVMType::New(); diff --git a/Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx b/Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx index ceacdeef13..1551fcf8bf 100644 --- a/Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx +++ b/Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx @@ -62,14 +62,14 @@ int main(int argc, char* argv[]) // Input related typedefs - typedef float InputValueType; - typedef itk::VariableLengthVector<InputValueType> InputSampleType; - typedef itk::Statistics::ListSample<InputSampleType> InputListSampleType; + using InputValueType = float; + using InputSampleType = itk::VariableLengthVector<InputValueType>; + using InputListSampleType = itk::Statistics::ListSample<InputSampleType>; // Target related typedefs - typedef int TargetValueType; - typedef itk::FixedArray<TargetValueType, 1> TargetSampleType; - typedef itk::Statistics::ListSample<TargetSampleType> TargetListSampleType; + using TargetValueType = int; + using TargetSampleType = itk::FixedArray<TargetValueType, 1>; + using TargetListSampleType = itk::Statistics::ListSample<TargetSampleType>; InputListSampleType::Pointer InputListSample = InputListSampleType::New(); TargetListSampleType::Pointer TargetListSample = TargetListSampleType::New(); @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) // OpenCV library (\cite{opencv_library}) which handles other classifiers than // the SVM. - typedef otb::SVMMachineLearningModel<InputValueType, TargetValueType> SVMType; + using SVMType = otb::SVMMachineLearningModel<InputValueType, TargetValueType>; SVMType::Pointer SVMClassifier = SVMType::New(); diff --git a/Examples/Markov/MarkovClassification1Example.cxx b/Examples/Markov/MarkovClassification1Example.cxx index d1b5cf4b33..c37508180b 100644 --- a/Examples/Markov/MarkovClassification1Example.cxx +++ b/Examples/Markov/MarkovClassification1Example.cxx @@ -69,17 +69,17 @@ int main(int argc, char* argv[]) const unsigned int Dimension = 2; - typedef double InternalPixelType; - typedef unsigned char LabelledPixelType; - typedef otb::Image<InternalPixelType, Dimension> InputImageType; - typedef otb::Image<LabelledPixelType, Dimension> LabelledImageType; + using InternalPixelType = double; + using LabelledPixelType = unsigned char; + using InputImageType = otb::Image<InternalPixelType, Dimension>; + using LabelledImageType = otb::Image<LabelledPixelType, Dimension>; // We define a reader for the image to be classified, an initialization for the // classification (which could be random) and a writer for the final // classification. - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<LabelledImageType> WriterType; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<LabelledImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -94,7 +94,7 @@ int main(int argc, char* argv[]) // A \doxygen{otb}{MarkovRandomFieldFilter} is instantiated, this is the // main class which connect the other to do the Markov classification. - typedef otb::MarkovRandomFieldFilter<InputImageType, LabelledImageType> MarkovRandomFieldFilterType; + using MarkovRandomFieldFilterType = otb::MarkovRandomFieldFilter<InputImageType, LabelledImageType>; // An \doxygen{otb}{MRFSamplerRandomMAP}, which derives from the // \doxygen{otb}{MRFSampler}, is instantiated. The sampler is in charge of @@ -102,7 +102,7 @@ int main(int argc, char* argv[]) // \doxygen{otb}{MRFSamplerRandomMAP}, randomly pick one possible value // according to the MAP probability. - typedef otb::MRFSamplerRandom<InputImageType, LabelledImageType> SamplerType; + using SamplerType = otb::MRFSamplerRandom<InputImageType, LabelledImageType>; // An \doxygen{otb}{MRFOptimizerMetropoli}, which derives from the // \doxygen{otb}{MRFOptimizer}, is instantiated. The optimizer is in charge @@ -110,7 +110,7 @@ int main(int argc, char* argv[]) // \doxygen{otb}{MRFSamplerRandomMAP}, accept the proposal according to the // variation of energy it causes and a temperature parameter. - typedef otb::MRFOptimizerMetropolis OptimizerType; + using OptimizerType = otb::MRFOptimizerMetropolis; // Two energy, deriving from the \doxygen{otb}{MRFEnergy} class need to be instantiated. One energy // is required for the regularization, taking into account the relashionship between neighborhing pixels @@ -120,8 +120,8 @@ int main(int argc, char* argv[]) // The second energy is for the fidelity to the original data. Here it is done with an // \doxygen{otb}{MRFEnergyGaussianClassification} class, which defines a gaussian model for the data. - typedef otb::MRFEnergyPotts<LabelledImageType, LabelledImageType> EnergyRegularizationType; - typedef otb::MRFEnergyGaussianClassification<InputImageType, LabelledImageType> EnergyFidelityType; + using EnergyRegularizationType = otb::MRFEnergyPotts<LabelledImageType, LabelledImageType>; + using EnergyFidelityType = otb::MRFEnergyGaussianClassification<InputImageType, LabelledImageType>; // The different filters composing our pipeline are created by invoking their // \code{New()} methods, assigning the results to smart pointers. @@ -179,8 +179,8 @@ int main(int argc, char* argv[]) markovFilter->SetInput(reader->GetOutput()); - typedef itk::RescaleIntensityImageFilter<LabelledImageType, LabelledImageType> RescaleType; - RescaleType::Pointer rescaleFilter = RescaleType::New(); + using RescaleType = itk::RescaleIntensityImageFilter<LabelledImageType, LabelledImageType>; + RescaleType::Pointer rescaleFilter = RescaleType::New(); rescaleFilter->SetOutputMinimum(0); rescaleFilter->SetOutputMaximum(255); diff --git a/Examples/Markov/MarkovClassification2Example.cxx b/Examples/Markov/MarkovClassification2Example.cxx index 533e8e7e47..cb1091b2b5 100644 --- a/Examples/Markov/MarkovClassification2Example.cxx +++ b/Examples/Markov/MarkovClassification2Example.cxx @@ -60,13 +60,13 @@ int main(int argc, char* argv[]) const unsigned int Dimension = 2; - typedef double InternalPixelType; - typedef unsigned char LabelledPixelType; - typedef otb::Image<InternalPixelType, Dimension> InputImageType; - typedef otb::Image<LabelledPixelType, Dimension> LabelledImageType; + using InternalPixelType = double; + using LabelledPixelType = unsigned char; + using InputImageType = otb::Image<InternalPixelType, Dimension>; + using LabelledImageType = otb::Image<LabelledPixelType, Dimension>; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<LabelledImageType> WriterType; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<LabelledImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -77,17 +77,17 @@ int main(int argc, char* argv[]) reader->SetFileName(inputFilename); writer->SetFileName(outputFilename); - typedef otb::MarkovRandomFieldFilter<InputImageType, LabelledImageType> MarkovRandomFieldFilterType; + using MarkovRandomFieldFilterType = otb::MarkovRandomFieldFilter<InputImageType, LabelledImageType>; // And to declare these new type: - typedef otb::MRFSamplerRandomMAP<InputImageType, LabelledImageType> SamplerType; - // typedef otb::MRFSamplerRandom< InputImageType, LabelledImageType> SamplerType; + using SamplerType = otb::MRFSamplerRandomMAP<InputImageType, LabelledImageType>; + // using SamplerType = otb::MRFSamplerRandom< InputImageType, LabelledImageType>; - typedef otb::MRFOptimizerICM OptimizerType; + using OptimizerType = otb::MRFOptimizerICM; - typedef otb::MRFEnergyPotts<LabelledImageType, LabelledImageType> EnergyRegularizationType; - typedef otb::MRFEnergyGaussianClassification<InputImageType, LabelledImageType> EnergyFidelityType; + using EnergyRegularizationType = otb::MRFEnergyPotts<LabelledImageType, LabelledImageType>; + using EnergyFidelityType = otb::MRFEnergyGaussianClassification<InputImageType, LabelledImageType>; MarkovRandomFieldFilterType::Pointer markovFilter = MarkovRandomFieldFilterType::New(); EnergyRegularizationType::Pointer energyRegularization = EnergyRegularizationType::New(); @@ -132,8 +132,8 @@ int main(int argc, char* argv[]) markovFilter->SetInput(reader->GetOutput()); - typedef itk::RescaleIntensityImageFilter<LabelledImageType, LabelledImageType> RescaleType; - RescaleType::Pointer rescaleFilter = RescaleType::New(); + using RescaleType = itk::RescaleIntensityImageFilter<LabelledImageType, LabelledImageType>; + RescaleType::Pointer rescaleFilter = RescaleType::New(); rescaleFilter->SetOutputMinimum(0); rescaleFilter->SetOutputMaximum(255); diff --git a/Examples/Markov/MarkovClassification3Example.cxx b/Examples/Markov/MarkovClassification3Example.cxx index b72cc339d3..d71db51270 100644 --- a/Examples/Markov/MarkovClassification3Example.cxx +++ b/Examples/Markov/MarkovClassification3Example.cxx @@ -71,19 +71,19 @@ int main(int argc, char* argv[]) // The labeled image is of type unsigned char which allows up to 256 different // classes. - const unsigned int Dimension = 2; - typedef double InternalPixelType; - typedef unsigned char LabelledPixelType; + const unsigned int Dimension = 2; + using InternalPixelType = double; + using LabelledPixelType = unsigned char; - typedef otb::Image<InternalPixelType, Dimension> InputImageType; - typedef otb::Image<LabelledPixelType, Dimension> LabelledImageType; + using InputImageType = otb::Image<InternalPixelType, Dimension>; + using LabelledImageType = otb::Image<LabelledPixelType, Dimension>; // We define a reader for the image to be classified, an initialization for the // classification (which could be random) and a writer for the final // classification. - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<LabelledImageType> WriterType; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<LabelledImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -99,7 +99,7 @@ int main(int argc, char* argv[]) // A MarkovRandomFieldFilter is instantiated, this is the // main class which connect the other to do the Markov classification. - typedef otb::MarkovRandomFieldFilter<InputImageType, LabelledImageType> MarkovRandomFieldFilterType; + using MarkovRandomFieldFilterType = otb::MarkovRandomFieldFilter<InputImageType, LabelledImageType>; // An MRFSamplerRandomMAP, which derives from the // MRFSampler, is instantiated. The sampler is in charge of @@ -107,7 +107,7 @@ int main(int argc, char* argv[]) // MRFSamplerRandomMAP, randomly pick one possible value // according to the MAP probability. - typedef otb::MRFSamplerRandom<InputImageType, LabelledImageType> SamplerType; + using SamplerType = otb::MRFSamplerRandom<InputImageType, LabelledImageType>; // An MRFOptimizerMetropolis, which derives from the // MRFOptimizer, is instantiated. The optimizer is in charge @@ -115,7 +115,7 @@ int main(int argc, char* argv[]) // MRFSamplerRandomMAP, accept the proposal according to the // variation of energy it causes and a temperature parameter. - typedef otb::MRFOptimizerMetropolis OptimizerType; + using OptimizerType = otb::MRFOptimizerMetropolis; // Two energy, deriving from the MRFEnergy class need to be instantiated. One energy // is required for the regularization, taking into account the relationship between neighboring pixels @@ -125,8 +125,8 @@ int main(int argc, char* argv[]) // The second energy is used for the fidelity to the original data. Here it is done with a // MRFEnergyFisherClassification class, which defines a Fisher distribution to model the data. - typedef otb::MRFEnergyPotts<LabelledImageType, LabelledImageType> EnergyRegularizationType; - typedef otb::MRFEnergyFisherClassification<InputImageType, LabelledImageType> EnergyFidelityType; + using EnergyRegularizationType = otb::MRFEnergyPotts<LabelledImageType, LabelledImageType>; + using EnergyFidelityType = otb::MRFEnergyFisherClassification<InputImageType, LabelledImageType>; // The different filters composing our pipeline are created by invoking their // New() methods, assigning the results to smart pointers. @@ -194,8 +194,8 @@ int main(int argc, char* argv[]) markovFilter->SetInput(reader->GetOutput()); - typedef itk::RescaleIntensityImageFilter<LabelledImageType, LabelledImageType> RescaleType; - RescaleType::Pointer rescaleFilter = RescaleType::New(); + using RescaleType = itk::RescaleIntensityImageFilter<LabelledImageType, LabelledImageType>; + RescaleType::Pointer rescaleFilter = RescaleType::New(); rescaleFilter->SetOutputMinimum(0); rescaleFilter->SetOutputMaximum(255); @@ -205,17 +205,17 @@ int main(int argc, char* argv[]) writer->Update(); // convert output image to color - typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType, 2> RGBImageType; - typedef itk::Functor::ScalarToRGBPixelFunctor<unsigned long> ColorMapFunctorType; + using RGBPixelType = itk::RGBPixel<unsigned char>; + using RGBImageType = otb::Image<RGBPixelType, 2>; + using ColorMapFunctorType = itk::Functor::ScalarToRGBPixelFunctor<unsigned long>; - typedef itk::UnaryFunctorImageFilter<LabelledImageType, RGBImageType, ColorMapFunctorType> ColorMapFilterType; - ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); + using ColorMapFilterType = itk::UnaryFunctorImageFilter<LabelledImageType, RGBImageType, ColorMapFunctorType>; + ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New(); colormapper->SetInput(rescaleFilter->GetOutput()); // We can now create an image file writer and save the image. - typedef otb::ImageFileWriter<RGBImageType> WriterRescaledType; + using WriterRescaledType = otb::ImageFileWriter<RGBImageType>; WriterRescaledType::Pointer writerRescaled = WriterRescaledType::New(); diff --git a/Examples/Markov/MarkovRegularizationExample.cxx b/Examples/Markov/MarkovRegularizationExample.cxx index 8f23044653..71f8d57784 100644 --- a/Examples/Markov/MarkovRegularizationExample.cxx +++ b/Examples/Markov/MarkovRegularizationExample.cxx @@ -64,11 +64,11 @@ int main(int argc, char* argv[]) const unsigned int Dimension = 2; - typedef unsigned char LabelledPixelType; - typedef otb::Image<LabelledPixelType, Dimension> LabelledImageType; + using LabelledPixelType = unsigned char; + using LabelledImageType = otb::Image<LabelledPixelType, Dimension>; - typedef otb::ImageFileReader<LabelledImageType> ReaderType; - typedef otb::ImageFileWriter<LabelledImageType> WriterType; + using ReaderType = otb::ImageFileReader<LabelledImageType>; + using WriterType = otb::ImageFileWriter<LabelledImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -80,14 +80,14 @@ int main(int argc, char* argv[]) reader->SetFileName(inputFilename); writer->SetFileName(outputFilename); - typedef otb::MarkovRandomFieldFilter<LabelledImageType, LabelledImageType> MarkovRandomFieldFilterType; + using MarkovRandomFieldFilterType = otb::MarkovRandomFieldFilter<LabelledImageType, LabelledImageType>; - typedef otb::MRFSamplerRandom<LabelledImageType, LabelledImageType> SamplerType; + using SamplerType = otb::MRFSamplerRandom<LabelledImageType, LabelledImageType>; - typedef otb::MRFOptimizerMetropolis OptimizerType; + using OptimizerType = otb::MRFOptimizerMetropolis; - typedef otb::MRFEnergyPotts<LabelledImageType, LabelledImageType> EnergyRegularizationType; - typedef otb::MRFEnergyPotts<LabelledImageType, LabelledImageType> EnergyFidelityType; + using EnergyRegularizationType = otb::MRFEnergyPotts<LabelledImageType, LabelledImageType>; + using EnergyFidelityType = otb::MRFEnergyPotts<LabelledImageType, LabelledImageType>; MarkovRandomFieldFilterType::Pointer markovFilter = MarkovRandomFieldFilterType::New(); EnergyRegularizationType::Pointer energyRegularization = EnergyRegularizationType::New(); @@ -107,8 +107,8 @@ int main(int argc, char* argv[]) // \doxygen{itk}{LabelStatisticsImageFilter} and more particularly the method // \code{GetNumberOfLabels()}. - typedef itk::LabelStatisticsImageFilter<LabelledImageType, LabelledImageType> LabelledStatType; - LabelledStatType::Pointer labelledStat = LabelledStatType::New(); + using LabelledStatType = itk::LabelStatisticsImageFilter<LabelledImageType, LabelledImageType>; + LabelledStatType::Pointer labelledStat = LabelledStatType::New(); labelledStat->SetInput(reader->GetOutput()); labelledStat->SetLabelInput(reader->GetOutput()); labelledStat->Update(); @@ -134,8 +134,8 @@ int main(int argc, char* argv[]) writer->Update(); - typedef itk::RescaleIntensityImageFilter<LabelledImageType, LabelledImageType> RescaleType; - RescaleType::Pointer rescaleFilter = RescaleType::New(); + using RescaleType = itk::RescaleIntensityImageFilter<LabelledImageType, LabelledImageType>; + RescaleType::Pointer rescaleFilter = RescaleType::New(); rescaleFilter->SetOutputMinimum(0); rescaleFilter->SetOutputMaximum(255); diff --git a/Examples/Markov/MarkovRestorationExample.cxx b/Examples/Markov/MarkovRestorationExample.cxx index 7bdb98a213..fbadae46d1 100644 --- a/Examples/Markov/MarkovRestorationExample.cxx +++ b/Examples/Markov/MarkovRestorationExample.cxx @@ -75,17 +75,17 @@ int main(int argc, char* argv[]) const unsigned int Dimension = 2; - typedef double InternalPixelType; - typedef unsigned char LabelledPixelType; - typedef otb::Image<InternalPixelType, Dimension> InputImageType; - typedef otb::Image<LabelledPixelType, Dimension> LabelledImageType; + using InternalPixelType = double; + using LabelledPixelType = unsigned char; + using InputImageType = otb::Image<InternalPixelType, Dimension>; + using LabelledImageType = otb::Image<LabelledPixelType, Dimension>; // We need to declare an additional reader for the initial state of the // MRF. This reader has to be instantiated on the LabelledImageType. - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileReader<LabelledImageType> ReaderLabelledType; - typedef otb::ImageFileWriter<LabelledImageType> WriterType; + using ReaderType = otb::ImageFileReader<InputImageType>; + using ReaderLabelledType = otb::ImageFileReader<LabelledImageType>; + using WriterType = otb::ImageFileWriter<LabelledImageType>; ReaderType::Pointer reader = ReaderType::New(); ReaderLabelledType::Pointer reader2 = ReaderLabelledType::New(); @@ -101,16 +101,16 @@ int main(int argc, char* argv[]) // We declare all the necessary types for the MRF: - typedef otb::MarkovRandomFieldFilter<InputImageType, LabelledImageType> MarkovRandomFieldFilterType; + using MarkovRandomFieldFilterType = otb::MarkovRandomFieldFilter<InputImageType, LabelledImageType>; - typedef otb::MRFSamplerRandom<InputImageType, LabelledImageType> SamplerType; + using SamplerType = otb::MRFSamplerRandom<InputImageType, LabelledImageType>; - typedef otb::MRFOptimizerMetropolis OptimizerType; + using OptimizerType = otb::MRFOptimizerMetropolis; // The regularization and the fidelity energy are declared and instantiated: - typedef otb::MRFEnergyEdgeFidelity<LabelledImageType, LabelledImageType> EnergyRegularizationType; - typedef otb::MRFEnergyGaussian<InputImageType, LabelledImageType> EnergyFidelityType; + using EnergyRegularizationType = otb::MRFEnergyEdgeFidelity<LabelledImageType, LabelledImageType>; + using EnergyFidelityType = otb::MRFEnergyGaussian<InputImageType, LabelledImageType>; MarkovRandomFieldFilterType::Pointer markovFilter = MarkovRandomFieldFilterType::New(); @@ -154,8 +154,8 @@ int main(int argc, char* argv[]) markovFilter->SetInput(reader->GetOutput()); - typedef itk::RescaleIntensityImageFilter<LabelledImageType, LabelledImageType> RescaleType; - RescaleType::Pointer rescaleFilter = RescaleType::New(); + using RescaleType = itk::RescaleIntensityImageFilter<LabelledImageType, LabelledImageType>; + RescaleType::Pointer rescaleFilter = RescaleType::New(); rescaleFilter->SetOutputMinimum(0); rescaleFilter->SetOutputMaximum(255); diff --git a/Examples/OBIA/HooverMetricsEstimation.cxx b/Examples/OBIA/HooverMetricsEstimation.cxx index 3a08bd9d29..bcd6adcc46 100644 --- a/Examples/OBIA/HooverMetricsEstimation.cxx +++ b/Examples/OBIA/HooverMetricsEstimation.cxx @@ -74,18 +74,18 @@ int main(int argc, char* argv[]) // This type of label object allows storing generic attributes. Each region can store // a set of attributes: in this case, Hoover instances and metrics will be stored. - typedef otb::AttributesMapLabelObject<unsigned int, 2, float> LabelObjectType; - typedef itk::LabelMap<LabelObjectType> LabelMapType; - typedef otb::HooverMatrixFilter<LabelMapType> HooverMatrixFilterType; - typedef otb::HooverInstanceFilter<LabelMapType> InstanceFilterType; - - typedef otb::Image<unsigned int, 2> ImageType; - typedef itk::LabelImageToLabelMapFilter<ImageType, LabelMapType> ImageToLabelMapFilterType; - - typedef otb::VectorImage<float, 2> VectorImageType; - typedef otb::LabelMapToAttributeImageFilter<LabelMapType, VectorImageType> AttributeImageFilterType; - typedef otb::ImageFileReader<ImageType> ImageReaderType; - typedef otb::ImageFileWriter<VectorImageType> WriterType; + using LabelObjectType = otb::AttributesMapLabelObject<unsigned int, 2, float>; + using LabelMapType = itk::LabelMap<LabelObjectType>; + using HooverMatrixFilterType = otb::HooverMatrixFilter<LabelMapType>; + using InstanceFilterType = otb::HooverInstanceFilter<LabelMapType>; + + using ImageType = otb::Image<unsigned int, 2>; + using ImageToLabelMapFilterType = itk::LabelImageToLabelMapFilter<ImageType, LabelMapType>; + + using VectorImageType = otb::VectorImage<float, 2>; + using AttributeImageFilterType = otb::LabelMapToAttributeImageFilter<LabelMapType, VectorImageType>; + using ImageReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<VectorImageType>; ImageReaderType::Pointer gt_reader = ImageReaderType::New(); gt_reader->SetFileName(argv[1]); diff --git a/Examples/OBIA/LabelMapToVectorData.cxx b/Examples/OBIA/LabelMapToVectorData.cxx index 2f2a142340..b88ee2425c 100644 --- a/Examples/OBIA/LabelMapToVectorData.cxx +++ b/Examples/OBIA/LabelMapToVectorData.cxx @@ -68,23 +68,23 @@ int main(int argc, char* argv[]) // dimension. The input image is defined as an \doxygen{itk}{Image}, // the output is a \doxygen{otb}{VectorData}. - const unsigned int Dimension = 2; - typedef unsigned short LabelType; - typedef otb::Image<LabelType, Dimension> LabeledImageType; - typedef otb::VectorData<double, 2> VectorDataType; + const unsigned int Dimension = 2; + using LabelType = unsigned short; + using LabeledImageType = otb::Image<LabelType, Dimension>; + using VectorDataType = otb::VectorData<double, 2>; // We instantiate reader and writer types - typedef otb::ImageFileReader<LabeledImageType> LabeledReaderType; - typedef otb::VectorDataFileWriter<VectorDataType> WriterType; + using LabeledReaderType = otb::ImageFileReader<LabeledImageType>; + using WriterType = otb::VectorDataFileWriter<VectorDataType>; // Label map typedef // The Attribute Label Map is // instantiated using the image pixel types as template parameters. // The LabelObjectToPolygonFunctor is instantiated with LabelObjectType and PolygonType. - typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; - typedef itk::LabelMap<LabelObjectType> LabelMapType; - typedef itk::LabelImageToLabelMapFilter<LabeledImageType, LabelMapType> LabelMapFilterType; + using LabelObjectType = otb::AttributesMapLabelObject<LabelType, Dimension, double>; + using LabelMapType = itk::LabelMap<LabelObjectType>; + using LabelMapFilterType = itk::LabelImageToLabelMapFilter<LabeledImageType, LabelMapType>; LabeledReaderType::Pointer lreader = LabeledReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -106,7 +106,7 @@ int main(int argc, char* argv[]) // Then, the \doxygen{otb}{LabelMapToVectorDataFilter} is instantiated. This is // the main filter which performs the vectorization. - typedef otb::LabelMapToVectorDataFilter<LabelMapType, VectorDataType> LabelMapToVectorDataFilterType; + using LabelMapToVectorDataFilterType = otb::LabelMapToVectorDataFilter<LabelMapType, VectorDataType>; LabelMapToVectorDataFilterType::Pointer MyFilter = LabelMapToVectorDataFilterType::New(); diff --git a/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx b/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx index 1ab6443c04..848dd62674 100644 --- a/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx +++ b/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx @@ -84,31 +84,31 @@ int main(int argc, char* argv[]) const unsigned int Dimension = 2; // Labeled image type - typedef unsigned int LabelType; - typedef unsigned char MaskPixelType; - typedef double PixelType; - typedef otb::Image<LabelType, Dimension> LabeledImageType; - typedef otb::Image<MaskPixelType, Dimension> MaskImageType; - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::VectorImage<PixelType, Dimension> VectorImageType; - typedef otb::VectorImage<unsigned char, Dimension> OutputVectorImageType; - typedef otb::ImageFileReader<LabeledImageType> LabeledReaderType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileReader<VectorImageType> VectorReaderType; - typedef otb::ImageFileWriter<MaskImageType> WriterType; - typedef otb::ImageFileWriter<OutputVectorImageType> VectorWriterType; - typedef otb::VectorRescaleIntensityImageFilter<VectorImageType, OutputVectorImageType> VectorRescalerType; - typedef otb::MultiChannelExtractROI<unsigned char, unsigned char> ChannelExtractorType; + using LabelType = unsigned int; + using MaskPixelType = unsigned char; + using PixelType = double; + using LabeledImageType = otb::Image<LabelType, Dimension>; + using MaskImageType = otb::Image<MaskPixelType, Dimension>; + using ImageType = otb::Image<PixelType, Dimension>; + using VectorImageType = otb::VectorImage<PixelType, Dimension>; + using OutputVectorImageType = otb::VectorImage<unsigned char, Dimension>; + using LabeledReaderType = otb::ImageFileReader<LabeledImageType>; + using ReaderType = otb::ImageFileReader<ImageType>; + using VectorReaderType = otb::ImageFileReader<VectorImageType>; + using WriterType = otb::ImageFileWriter<MaskImageType>; + using VectorWriterType = otb::ImageFileWriter<OutputVectorImageType>; + using VectorRescalerType = otb::VectorRescaleIntensityImageFilter<VectorImageType, OutputVectorImageType>; + using ChannelExtractorType = otb::MultiChannelExtractROI<unsigned char, unsigned char>; // Label map typedef - typedef otb::AttributesMapLabelObject<LabelType, Dimension, double> LabelObjectType; - typedef itk::LabelMap<LabelObjectType> LabelMapType; - typedef itk::LabelImageToLabelMapFilter<LabeledImageType, LabelMapType> LabelMapFilterType; - typedef otb::ShapeAttributesLabelMapFilter<LabelMapType> ShapeLabelMapFilterType; - typedef otb::BandsStatisticsAttributesLabelMapFilter<LabelMapType, VectorImageType> RadiometricLabelMapFilterType; - typedef otb::AttributesMapOpeningLabelMapFilter<LabelMapType> OpeningLabelMapFilterType; - typedef itk::LabelMapToBinaryImageFilter<LabelMapType, MaskImageType> LabelMapToBinaryImageFilterType; - typedef itk::UnaryFunctorImageFilter<VectorImageType, ImageType, otb::Functor::NDVI<PixelType, PixelType>> NDVIImageFilterType; - typedef otb::ImageToVectorImageCastFilter<ImageType, VectorImageType> ImageToVectorImageCastFilterType; + using LabelObjectType = otb::AttributesMapLabelObject<LabelType, Dimension, double>; + using LabelMapType = itk::LabelMap<LabelObjectType>; + using LabelMapFilterType = itk::LabelImageToLabelMapFilter<LabeledImageType, LabelMapType>; + using ShapeLabelMapFilterType = otb::ShapeAttributesLabelMapFilter<LabelMapType>; + using RadiometricLabelMapFilterType = otb::BandsStatisticsAttributesLabelMapFilter<LabelMapType, VectorImageType>; + using OpeningLabelMapFilterType = otb::AttributesMapOpeningLabelMapFilter<LabelMapType>; + using LabelMapToBinaryImageFilterType = itk::LabelMapToBinaryImageFilter<LabelMapType, MaskImageType>; + using NDVIImageFilterType = itk::UnaryFunctorImageFilter<VectorImageType, ImageType, otb::Functor::NDVI<PixelType, PixelType>>; + using ImageToVectorImageCastFilterType = otb::ImageToVectorImageCastFilter<ImageType, VectorImageType>; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(reffname); @@ -122,8 +122,8 @@ int main(int argc, char* argv[]) // Firstly, segment the input image by using the Mean Shift algorithm (see \ref{sec:MeanShift} for deeper // explanations). - typedef otb::MeanShiftSegmentationFilter<VectorImageType, LabeledImageType, VectorImageType> FilterType; - FilterType::Pointer filter = FilterType::New(); + using FilterType = otb::MeanShiftSegmentationFilter<VectorImageType, LabeledImageType, VectorImageType>; + FilterType::Pointer filter = FilterType::New(); filter->SetSpatialBandwidth(spatialRadius); filter->SetRangeBandwidth(rangeRadius); filter->SetMinRegionSize(minRegionSize); diff --git a/Examples/Patented/SIFTDensityExample.cxx b/Examples/Patented/SIFTDensityExample.cxx index 90e818e5e9..e235feb606 100644 --- a/Examples/Patented/SIFTDensityExample.cxx +++ b/Examples/Patented/SIFTDensityExample.cxx @@ -55,27 +55,27 @@ int main(int itkNotUsed(argc), char* argv[]) const unsigned int radius = atoi(argv[6]); const unsigned int Dimension = 2; - typedef float PixelType; + using PixelType = float; // As usual, we start by defining the types for the images, the reader // and the writer. - typedef otb::Image<PixelType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; + using ImageType = otb::Image<PixelType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; // We define now the type for the keypoint detection. The keypoints // will be stored in vector form (they may contain many descriptors) // into a point set. The filter for detecting the SIFT is templated // over the input image type and the output pointset type. - typedef itk::VariableLengthVector<PixelType> RealVectorType; - typedef itk::PointSet<RealVectorType, Dimension> PointSetType; - typedef otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType> DetectorType; + using RealVectorType = itk::VariableLengthVector<PixelType>; + using PointSetType = itk::PointSet<RealVectorType, Dimension>; + using DetectorType = otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType>; // We can now define the filter which will compute the SIFT // density. It will be templated over the input and output image // types and the SIFT detector. - typedef otb::KeyPointDensityImageFilter<ImageType, ImageType, DetectorType> FilterType; + using FilterType = otb::KeyPointDensityImageFilter<ImageType, ImageType, DetectorType>; // We can instantiate the reader and the writer as wella s the // filter and the detector. The detector needs to be instantiated in // order to set its parameters. @@ -129,9 +129,9 @@ int main(int itkNotUsed(argc), char* argv[]) /************* Image for printing **************/ - typedef otb::Image<unsigned char, 2> OutputImageType; + using OutputImageType = otb::Image<unsigned char, 2>; - typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> RescalerType; + using RescalerType = itk::RescaleIntensityImageFilter<ImageType, OutputImageType>; RescalerType::Pointer rescaler = RescalerType::New(); @@ -140,8 +140,8 @@ int main(int itkNotUsed(argc), char* argv[]) rescaler->SetInput(filter->GetOutput()); - typedef otb::ImageFileWriter<OutputImageType> OutputWriterType; - OutputWriterType::Pointer outwriter = OutputWriterType::New(); + using OutputWriterType = otb::ImageFileWriter<OutputImageType>; + OutputWriterType::Pointer outwriter = OutputWriterType::New(); outwriter->SetFileName(prettyfname); outwriter->SetInput(rescaler->GetOutput()); diff --git a/Examples/Patented/SIFTDisparityMapEstimation.cxx b/Examples/Patented/SIFTDisparityMapEstimation.cxx index e56bd0c55d..be80a5044c 100644 --- a/Examples/Patented/SIFTDisparityMapEstimation.cxx +++ b/Examples/Patented/SIFTDisparityMapEstimation.cxx @@ -65,35 +65,35 @@ int main(int argc, char* argv[]) // all the computations in floating point precision and rescale the results // between 0 and 255 in order to export PNG images. - typedef double RealType; - typedef unsigned char OutputPixelType; + using RealType = double; + using OutputPixelType = unsigned char; - typedef otb::Image<RealType, Dimension> ImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + using ImageType = otb::Image<RealType, Dimension>; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; // The SIFTs obtained for the matching will be stored in vector // form inside a point set. So we need the following types: - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + using RealVectorType = itk::VariableLengthVector<RealType>; + using PointSetType = itk::PointSet<RealVectorType, Dimension>; // The filter for computing the SIFTs has a type defined as follows: - typedef otb::SiftFastImageFilter<ImageType, PointSetType> ImageToSIFTKeyPointSetFilterType; + using ImageToSIFTKeyPointSetFilterType = otb::SiftFastImageFilter<ImageType, PointSetType>; // Although many choices for evaluating the distances during the // matching procedure exist, we choose here to use a simple // Euclidean distance. We can then define the type for the matching filter. - typedef itk::Statistics::EuclideanDistanceMetric<RealVectorType> DistanceType; - typedef otb::KeyPointSetsMatchingFilter<PointSetType, DistanceType> EuclideanDistanceMetricMatchingFilterType; + using DistanceType = itk::Statistics::EuclideanDistanceMetric<RealVectorType>; + using EuclideanDistanceMetricMatchingFilterType = otb::KeyPointSetsMatchingFilter<PointSetType, DistanceType>; // The following types are needed for dealing with the matched points. - typedef PointSetType::PointType PointType; - typedef std::pair<PointType, PointType> MatchType; - typedef std::vector<MatchType> MatchVectorType; - typedef EuclideanDistanceMetricMatchingFilterType::LandmarkListType LandmarkListType; + using PointType = PointSetType::PointType; + using MatchType = std::pair<PointType, PointType>; + using MatchVectorType = std::vector<MatchType>; + using LandmarkListType = EuclideanDistanceMetricMatchingFilterType::LandmarkListType; // We define the type for the image reader. - typedef otb::ImageFileReader<ImageType> ReaderType; + using ReaderType = otb::ImageFileReader<ImageType>; // Two readers are instantiated : one for the fixed image, and one // for the moving image. @@ -144,7 +144,7 @@ int main(int argc, char* argv[]) } // Displaying the matches - typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> PrintableFilterType; + using PrintableFilterType = itk::RescaleIntensityImageFilter<ImageType, OutputImageType>; PrintableFilterType::Pointer printable1 = PrintableFilterType::New(); PrintableFilterType::Pointer printable2 = PrintableFilterType::New(); @@ -159,7 +159,7 @@ int main(int argc, char* argv[]) printable2->SetOutputMaximum(255); printable2->Update(); - typedef otb::Image<itk::RGBPixel<unsigned char>, 2> RGBImageType; + using RGBImageType = otb::Image<itk::RGBPixel<unsigned char>, 2>; RGBImageType::Pointer rgbimage1 = RGBImageType::New(); rgbimage1->SetRegions(printable1->GetOutput()->GetLargestPossibleRegion()); @@ -201,10 +201,10 @@ int main(int argc, char* argv[]) // deformation field is an image of vectors created by the // \doxygen{itk}{DisplacementFieldSource} class. - typedef itk::Vector<RealType, Dimension> VectorType; - typedef otb::Image<VectorType, Dimension> DisplacementFieldType; + using VectorType = itk::Vector<RealType, Dimension>; + using DisplacementFieldType = otb::Image<VectorType, Dimension>; - typedef itk::LandmarkDisplacementFieldSource<DisplacementFieldType> DisplacementSourceType; + using DisplacementSourceType = itk::LandmarkDisplacementFieldSource<DisplacementFieldType>; DisplacementSourceType::Pointer deformer = DisplacementSourceType::New(); // The deformation field needs information about the extent and @@ -216,8 +216,8 @@ int main(int argc, char* argv[]) deformer->SetOutputRegion(fixedImage->GetLargestPossibleRegion()); // We will need some intermediate variables in order to pass the // matched SIFTs to the deformation field source. - typedef DisplacementSourceType::LandmarkContainer LandmarkContainerType; - typedef DisplacementSourceType::LandmarkPointType LandmarkPointType; + using LandmarkContainerType = DisplacementSourceType::LandmarkContainer; + using LandmarkPointType = DisplacementSourceType::LandmarkPointType; LandmarkContainerType::Pointer sourceLandmarks = LandmarkContainerType::New(); LandmarkContainerType::Pointer targetLandmarks = LandmarkContainerType::New(); @@ -275,15 +275,15 @@ int main(int argc, char* argv[]) ++outIt; } - typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> RescaleType; + using RescaleType = itk::RescaleIntensityImageFilter<ImageType, OutputImageType>; RescaleType::Pointer rescaler = RescaleType::New(); rescaler->SetInput(outdf); rescaler->SetOutputMinimum(0); rescaler->SetOutputMaximum(255); - typedef otb::ImageFileWriter<OutputImageType> WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = otb::ImageFileWriter<OutputImageType>; + WriterType::Pointer writer = WriterType::New(); writer->SetInput(rescaler->GetOutput()); writer->SetFileName(argv[3]); diff --git a/Examples/Patented/SIFTExample.cxx b/Examples/Patented/SIFTExample.cxx index 2edddf27fa..697206fe3a 100644 --- a/Examples/Patented/SIFTExample.cxx +++ b/Examples/Patented/SIFTExample.cxx @@ -82,24 +82,24 @@ int main(int argc, char* argv[]) float threshold = atof(argv[6]); float ratio = atof(argv[7]); - typedef float RealType; + using RealType = float; const unsigned int Dimension = 2; // The \doxygen{otb}{ImageToSIFTKeyPointSetFilter} is templated over // its input image type and the output point set type. Therefore, we // start by defining the needed types. - typedef otb::Image<RealType, Dimension> ImageType; - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + using ImageType = otb::Image<RealType, Dimension>; + using RealVectorType = itk::VariableLengthVector<RealType>; + using ReaderType = otb::ImageFileReader<ImageType>; + using PointSetType = itk::PointSet<RealVectorType, Dimension>; - typedef otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType> ImageToSIFTKeyPointSetFilterType; + using ImageToSIFTKeyPointSetFilterType = otb::ImageToSIFTKeyPointSetFilter<ImageType, PointSetType>; // Since the SIFT detector produces a point set, we will need // iterators for the coordinates of the points and the data associated // with them. - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointsContainerType::Iterator PointsIteratorType; + using PointsContainerType = PointSetType::PointsContainer; + using PointsIteratorType = PointsContainerType::Iterator; // We can now instantiate the reader and the SIFT filter and plug the pipeline. ReaderType::Pointer reader = ReaderType::New(); @@ -162,10 +162,10 @@ int main(int argc, char* argv[]) ImageType::OffsetType r = {{1, 0}}; ImageType::OffsetType l = {{-1, 0}}; - typedef itk::RGBPixel<unsigned char> RGBPixelType; - typedef otb::Image<RGBPixelType, 2> OutputImageType; + using RGBPixelType = itk::RGBPixel<unsigned char>; + using OutputImageType = otb::Image<RGBPixelType, 2>; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using WriterType = otb::ImageFileWriter<OutputImageType>; OutputImageType::Pointer outputImage = OutputImageType::New(); diff --git a/Examples/Patented/SIFTFastExample.cxx b/Examples/Patented/SIFTFastExample.cxx index 5ffeb43368..4a5f8251a6 100644 --- a/Examples/Patented/SIFTFastExample.cxx +++ b/Examples/Patented/SIFTFastExample.cxx @@ -66,18 +66,18 @@ int main(int argc, char* argv[]) // scalar image of float pixels. We also define the corresponding // image reader. - typedef float RealType; - typedef otb::Image<RealType, Dimension> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + using RealType = float; + using ImageType = otb::Image<RealType, Dimension>; + using ReaderType = otb::ImageFileReader<ImageType>; // The SIFT descriptors will be stored in a point set containing the // vector of features. - typedef itk::VariableLengthVector<RealType> RealVectorType; - typedef itk::PointSet<RealVectorType, Dimension> PointSetType; + using RealVectorType = itk::VariableLengthVector<RealType>; + using PointSetType = itk::PointSet<RealVectorType, Dimension>; // The SIFT filter itself is templated over the input image and the // generated point set. - typedef otb::SiftFastImageFilter<ImageType, PointSetType> ImageToFastSIFTKeyPointSetFilterType; + using ImageToFastSIFTKeyPointSetFilterType = otb::SiftFastImageFilter<ImageType, PointSetType>; // We instantiate the reader. ReaderType::Pointer reader = ReaderType::New(); @@ -96,10 +96,10 @@ int main(int argc, char* argv[]) // input image. In order to do this, we will create the following RGB // image and the corresponding writer: - typedef unsigned char PixelType; - typedef itk::RGBPixel<PixelType> RGBPixelType; - typedef otb::Image<RGBPixelType, 2> OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using PixelType = unsigned char; + using RGBPixelType = itk::RGBPixel<PixelType>; + using OutputImageType = otb::Image<RGBPixelType, 2>; + using WriterType = otb::ImageFileWriter<OutputImageType>; OutputImageType::Pointer outputImage = OutputImageType::New(); // We set the regions of the image by copying the information from the @@ -138,8 +138,8 @@ int main(int argc, char* argv[]) // going to walk through using an iterator. These are the types needed // for this task: - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointsContainerType::Iterator PointsIteratorType; + using PointsContainerType = PointSetType::PointsContainer; + using PointsIteratorType = PointsContainerType::Iterator; // We set the iterator to the beginning of the point set. PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); diff --git a/Examples/Projections/EstimateRPCSensorModelExample.cxx b/Examples/Projections/EstimateRPCSensorModelExample.cxx index 67aaebd276..cdf0fb28d0 100644 --- a/Examples/Projections/EstimateRPCSensorModelExample.cxx +++ b/Examples/Projections/EstimateRPCSensorModelExample.cxx @@ -60,13 +60,13 @@ int main(int argc, char* argv[]) // We declare the image type based on a particular pixel type and // dimension. In this case the \code{float} type is used for the pixels. - typedef otb::Image<float, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; + using ImageType = otb::Image<float, 2>; + using ReaderType = otb::ImageFileReader<ImageType>; - typedef otb::GCPsToRPCSensorModelImageFilter<ImageType> GCPsToSensorModelFilterType; + using GCPsToSensorModelFilterType = otb::GCPsToRPCSensorModelImageFilter<ImageType>; - typedef GCPsToSensorModelFilterType::Point2DType Point2DType; - typedef GCPsToSensorModelFilterType::Point3DType Point3DType; + using Point2DType = GCPsToSensorModelFilterType::Point2DType; + using Point3DType = GCPsToSensorModelFilterType::Point3DType; // We instantiate reader and writer types ReaderType::Pointer reader = ReaderType::New(); diff --git a/Examples/Projections/GeometriesProjectionExample.cxx b/Examples/Projections/GeometriesProjectionExample.cxx index 686ea45145..3cd7a42788 100644 --- a/Examples/Projections/GeometriesProjectionExample.cxx +++ b/Examples/Projections/GeometriesProjectionExample.cxx @@ -45,8 +45,8 @@ int main(int argc, char* argv[]) // is a single type for any kind of geometries set (OGR data source, or OGR // layer). - typedef otb::GeometriesSet InputGeometriesType; - typedef otb::GeometriesSet OutputGeometriesType; + using InputGeometriesType = otb::GeometriesSet; + using OutputGeometriesType = otb::GeometriesSet; // First, declare and instantiate the data source // \subdoxygen{otb}{ogr}{DataSource}. Then, encapsulate this data source into @@ -60,9 +60,9 @@ int main(int argc, char* argv[]) // pixels won't be read, only the header information using the // \code{UpdateOutputInformation()} method. - typedef otb::Image<unsigned short int, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ImageReaderType; - ImageReaderType::Pointer imageReader = ImageReaderType::New(); + using ImageType = otb::Image<unsigned short int, 2>; + using ImageReaderType = otb::ImageFileReader<ImageType>; + ImageReaderType::Pointer imageReader = ImageReaderType::New(); imageReader->SetFileName(argv[2]); imageReader->UpdateOutputInformation(); @@ -71,8 +71,8 @@ int main(int argc, char* argv[]) // to use it when you design applications reading or saving vector // data. - typedef otb::GeometriesProjectionFilter GeometriesFilterType; - GeometriesFilterType::Pointer filter = GeometriesFilterType::New(); + using GeometriesFilterType = otb::GeometriesProjectionFilter; + GeometriesFilterType::Pointer filter = GeometriesFilterType::New(); // Information concerning the original projection of the vector data // will be automatically retrieved from the metadata. Nothing else diff --git a/Examples/Projections/OrthoRectificationExample.cxx b/Examples/Projections/OrthoRectificationExample.cxx index e3a2f4d1c5..bb0415e5d6 100644 --- a/Examples/Projections/OrthoRectificationExample.cxx +++ b/Examples/Projections/OrthoRectificationExample.cxx @@ -54,10 +54,10 @@ int main(int argc, char* argv[]) // the number of stream divisions we want to apply when writing the // output image, which can be very large. - typedef otb::Image<int, 2> ImageType; - typedef otb::VectorImage<int, 2> VectorImageType; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - typedef otb::ImageFileWriter<VectorImageType> WriterType; + using ImageType = otb::Image<int, 2>; + using VectorImageType = otb::VectorImage<int, 2>; + using ReaderType = otb::ImageFileReader<VectorImageType>; + using WriterType = otb::ImageFileWriter<VectorImageType>; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -71,8 +71,7 @@ int main(int argc, char* argv[]) // Software Guide : BeginCodeSnippet - typedef otb::GenericRSResampleImageFilter<VectorImageType, VectorImageType> - OrthoRectifFilterType; + using OrthoRectifFilterType = otb::GenericRSResampleImageFilter<VectorImageType, VectorImageType>; OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); @@ -80,8 +79,10 @@ int main(int argc, char* argv[]) // instantiate the map projection, set the {\em zone} and {\em hemisphere} // parameters and pass this projection to the orthorectification filter. - std::string wkt = otb::SpatialReference::FromUTM(atoi(argv[3]),*argv[4]=='N'? otb::SpatialReference::hemisphere::north : otb::SpatialReference::hemisphere::south).ToWkt(); - std::cout<<wkt<<std::endl; + std::string wkt = + otb::SpatialReference::FromUTM(atoi(argv[3]), *argv[4] == 'N' ? otb::SpatialReference::hemisphere::north : otb::SpatialReference::hemisphere::south) + .ToWkt(); + std::cout << wkt << std::endl; orthoRectifFilter->SetOutputProjectionRef(wkt); // We then wire the input image to the orthorectification filter. diff --git a/Examples/Projections/VectorDataExtractROIExample.cxx b/Examples/Projections/VectorDataExtractROIExample.cxx index 3194eea322..cd98c36c77 100644 --- a/Examples/Projections/VectorDataExtractROIExample.cxx +++ b/Examples/Projections/VectorDataExtractROIExample.cxx @@ -56,25 +56,25 @@ int main(int argc, char* argv[]) const char* inImageName = argv[2]; const char* outVectorName = argv[3]; - typedef double Type; - typedef otb::VectorData<> VectorDataType; + using Type = double; + using VectorDataType = otb::VectorData<>; - typedef otb::VectorDataFileReader<VectorDataType> VectorDataFileReaderType; - typedef otb::VectorDataFileWriter<VectorDataType> VectorDataWriterType; + using VectorDataFileReaderType = otb::VectorDataFileReader<VectorDataType>; + using VectorDataWriterType = otb::VectorDataFileWriter<VectorDataType>; - typedef otb::RemoteSensingRegion<Type> TypedRegion; + using TypedRegion = otb::RemoteSensingRegion<Type>; - typedef otb::Image<unsigned char, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ImageReaderType; - ImageReaderType::Pointer imageReader = ImageReaderType::New(); + using ImageType = otb::Image<unsigned char, 2>; + using ImageReaderType = otb::ImageFileReader<ImageType>; + ImageReaderType::Pointer imageReader = ImageReaderType::New(); imageReader->SetFileName(inImageName); imageReader->UpdateOutputInformation(); // After the usual declaration (you can check the source file for the details), // we can declare the \doxygen{otb}{VectorDataExtractROI}: - typedef otb::VectorDataExtractROI<VectorDataType> FilterType; - FilterType::Pointer filter = FilterType::New(); + using FilterType = otb::VectorDataExtractROI<VectorDataType>; + FilterType::Pointer filter = FilterType::New(); // Then, we need to specify the region to extract. This region is a bit special as // it contains also information related to its reference system (cartographic projection diff --git a/Examples/Projections/VectorDataProjectionExample.cxx b/Examples/Projections/VectorDataProjectionExample.cxx index 7a063a172b..282cb306e9 100644 --- a/Examples/Projections/VectorDataProjectionExample.cxx +++ b/Examples/Projections/VectorDataProjectionExample.cxx @@ -51,15 +51,15 @@ int main(int argc, char* argv[]) // Declare the vector data type that you would like to use in your // application. - typedef otb::VectorData<double> InputVectorDataType; - typedef otb::VectorData<double> OutputVectorDataType; + using InputVectorDataType = otb::VectorData<double>; + using OutputVectorDataType = otb::VectorData<double>; // Declare and instantiate the vector data reader: // \doxygen{otb}{VectorDataFileReader}. The call to the // \code{UpdateOutputInformation()} method fill up the header information. - typedef otb::VectorDataFileReader<InputVectorDataType> VectorDataFileReaderType; - VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); + using VectorDataFileReaderType = otb::VectorDataFileReader<InputVectorDataType>; + VectorDataFileReaderType::Pointer reader = VectorDataFileReaderType::New(); reader->SetFileName(argv[1]); reader->UpdateOutputInformation(); @@ -69,9 +69,9 @@ int main(int argc, char* argv[]) // pixels won't be read, only the header information using the // \code{UpdateOutputInformation()} method. - typedef otb::Image<unsigned short int, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ImageReaderType; - ImageReaderType::Pointer imageReader = ImageReaderType::New(); + using ImageType = otb::Image<unsigned short int, 2>; + using ImageReaderType = otb::ImageFileReader<ImageType>; + ImageReaderType::Pointer imageReader = ImageReaderType::New(); imageReader->SetFileName(argv[2]); imageReader->UpdateOutputInformation(); @@ -80,8 +80,8 @@ int main(int argc, char* argv[]) // to use it when you design applications reading or saving vector // data. - typedef otb::VectorDataProjectionFilter<InputVectorDataType, OutputVectorDataType> VectorDataFilterType; - VectorDataFilterType::Pointer vectorDataProjection = VectorDataFilterType::New(); + using VectorDataFilterType = otb::VectorDataProjectionFilter<InputVectorDataType, OutputVectorDataType>; + VectorDataFilterType::Pointer vectorDataProjection = VectorDataFilterType::New(); // Information concerning the original projection of the vector data // will be automatically retrieved from the metadata. Nothing else @@ -99,8 +99,8 @@ int main(int argc, char* argv[]) // Finally, the result is saved into a new vector file. - typedef otb::VectorDataFileWriter<OutputVectorDataType> VectorDataFileWriterType; - VectorDataFileWriterType::Pointer writer = VectorDataFileWriterType::New(); + using VectorDataFileWriterType = otb::VectorDataFileWriter<OutputVectorDataType>; + VectorDataFileWriterType::Pointer writer = VectorDataFileWriterType::New(); writer->SetFileName(argv[3]); writer->SetInput(vectorDataProjection->GetOutput()); writer->Update(); diff --git a/Examples/Radiometry/ARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx b/Examples/Radiometry/ARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx index 6845750ac2..f544a7cee5 100644 --- a/Examples/Radiometry/ARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx +++ b/Examples/Radiometry/ARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx @@ -98,29 +98,29 @@ int main(int argc, char* argv[]) // dimension. The input image is defined as an \doxygen{otb}{VectorImage}, // the output is a \doxygen{otb}{Image}. - const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef float OutputPixelType; - typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + const unsigned int Dimension = 2; + using InputPixelType = double; + using OutputPixelType = float; + using InputImageType = otb::VectorImage<InputPixelType, Dimension>; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; // We instantiate reader and writer types - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; // The ARVI (Atmospherically Resistant Vegetation Index) is // instantiated using the image pixel types as template parameters. // Note that we also can use other functors which operate with the // Red, Blue and Nir channels such as EVI, ARVI and TSARVI. - typedef otb::Functor::ARVI<InputPixelType, OutputPixelType> FunctorType; + using FunctorType = otb::Functor::ARVI<InputPixelType, OutputPixelType>; // The // \doxygen{itk}{UnaryFunctorImageFilter} // type is defined using the image types and the ARVI functor as // template parameters. We then instantiate the filter itself. - typedef itk::UnaryFunctorImageFilter<InputImageType, OutputImageType, FunctorType> ArviImageFilterType; + using ArviImageFilterType = itk::UnaryFunctorImageFilter<InputImageType, OutputImageType, FunctorType>; ArviImageFilterType::Pointer filter = ArviImageFilterType::New(); @@ -164,13 +164,13 @@ int main(int argc, char* argv[]) } // Pretty image creation for the printing - typedef otb::Image<unsigned char, Dimension> OutputPrettyImageType; - typedef otb::VectorImage<unsigned char, Dimension> OutputVectorPrettyImageType; - typedef otb::ImageFileWriter<OutputVectorPrettyImageType> WriterVectorPrettyType; - typedef otb::ImageFileWriter<OutputPrettyImageType> WriterPrettyType; - typedef itk::RescaleIntensityImageFilter<OutputImageType, OutputPrettyImageType> RescalerType; - typedef otb::VectorRescaleIntensityImageFilter<InputImageType, OutputVectorPrettyImageType> VectorRescalerType; - typedef otb::MultiChannelExtractROI<unsigned char, unsigned char> ChannelExtractorType; + using OutputPrettyImageType = otb::Image<unsigned char, Dimension>; + using OutputVectorPrettyImageType = otb::VectorImage<unsigned char, Dimension>; + using WriterVectorPrettyType = otb::ImageFileWriter<OutputVectorPrettyImageType>; + using WriterPrettyType = otb::ImageFileWriter<OutputPrettyImageType>; + using RescalerType = itk::RescaleIntensityImageFilter<OutputImageType, OutputPrettyImageType>; + using VectorRescalerType = otb::VectorRescaleIntensityImageFilter<InputImageType, OutputVectorPrettyImageType>; + using ChannelExtractorType = otb::MultiChannelExtractROI<unsigned char, unsigned char>; VectorRescalerType::Pointer vectRescaler = VectorRescalerType::New(); ChannelExtractorType::Pointer selecter = ChannelExtractorType::New(); @@ -194,7 +194,7 @@ int main(int argc, char* argv[]) vectPrettyWriter->SetFileName(argv[3]); vectPrettyWriter->SetInput(selecter->GetOutput()); - typedef itk::ThresholdImageFilter<OutputImageType> ThresholderType; + using ThresholderType = itk::ThresholdImageFilter<OutputImageType>; ThresholderType::Pointer thresholder = ThresholderType::New(); thresholder->SetInput(filter->GetOutput()); diff --git a/Examples/Radiometry/AVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx b/Examples/Radiometry/AVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx index d42f8cd56e..67598f04d5 100644 --- a/Examples/Radiometry/AVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx +++ b/Examples/Radiometry/AVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx @@ -85,27 +85,27 @@ int main(int argc, char* argv[]) // dimension. The input image is defined as an \doxygen{otb}{VectorImage}, // the output is a \doxygen{otb}{Image}. - const unsigned int Dimension = 2; - typedef double InputPixelType; - typedef float OutputPixelType; - typedef otb::VectorImage<InputPixelType, Dimension> InputImageType; - typedef otb::Image<OutputPixelType, Dimension> OutputImageType; + const unsigned int Dimension = 2; + using InputPixelType = double; + using OutputPixelType = float; + using InputImageType = otb::VectorImage<InputPixelType, Dimension>; + using OutputImageType = otb::Image<OutputPixelType, Dimension>; // We instantiate reader and writer types - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; // The AVI (Angular Vegetation Index) is // instantiated using the image pixel types as template parameters. - typedef otb::Functor::AVI<InputPixelType, OutputPixelType> FunctorType; + using FunctorType = otb::Functor::AVI<InputPixelType, OutputPixelType>; // The // \doxygen{itk}{UnaryFunctorImageFilter} // type is defined using the image types and the AVI functor as // template parameters. We then instantiate the filter itself. - typedef itk::UnaryFunctorImageFilter<InputImageType, OutputImageType, FunctorType> AVIImageFilterTypeType; + using AVIImageFilterTypeType = itk::UnaryFunctorImageFilter<InputImageType, OutputImageType, FunctorType>; AVIImageFilterTypeType::Pointer filter = AVIImageFilterTypeType::New(); @@ -150,13 +150,13 @@ int main(int argc, char* argv[]) } // Pretty image creation for the printing - typedef otb::Image<unsigned char, Dimension> OutputPrettyImageType; - typedef otb::VectorImage<unsigned char, Dimension> OutputVectorPrettyImageType; - typedef otb::ImageFileWriter<OutputVectorPrettyImageType> WriterVectorPrettyType; - typedef otb::ImageFileWriter<OutputPrettyImageType> WriterPrettyType; - typedef itk::RescaleIntensityImageFilter<OutputImageType, OutputPrettyImageType> RescalerType; - typedef otb::VectorRescaleIntensityImageFilter<InputImageType, OutputVectorPrettyImageType> VectorRescalerType; - typedef otb::MultiChannelExtractROI<unsigned char, unsigned char> ChannelExtractorType; + using OutputPrettyImageType = otb::Image<unsigned char, Dimension>; + using OutputVectorPrettyImageType = otb::VectorImage<unsigned char, Dimension>; + using WriterVectorPrettyType = otb::ImageFileWriter<OutputVectorPrettyImageType>; + using WriterPrettyType = otb::ImageFileWriter<OutputPrettyImageType>; + using RescalerType = itk::RescaleIntensityImageFilter<OutputImageType, OutputPrettyImageType>; + using VectorRescalerType = otb::VectorRescaleIntensityImageFilter<InputImageType, OutputVectorPrettyImageType>; + using ChannelExtractorType = otb::MultiChannelExtractROI<unsigned char, unsigned char>; VectorRescalerType::Pointer vectRescaler = VectorRescalerType::New(); ChannelExtractorType::Pointer selecter = ChannelExtractorType::New(); @@ -180,7 +180,7 @@ int main(int argc, char* argv[]) vectPrettyWriter->SetFileName(argv[3]); vectPrettyWriter->SetInput(selecter->GetOutput()); - typedef itk::ThresholdImageFilter<OutputImageType> ThresholderType; + using ThresholderType = itk::ThresholdImageFilter<OutputImageType>; ThresholderType::Pointer thresholder = ThresholderType::New(); thresholder->SetInput(filter->GetOutput()); diff --git a/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx b/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx index 0db1572208..f7167700e6 100644 --- a/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx +++ b/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx @@ -134,14 +134,14 @@ int main(int argc, char* argv[]) // the output image is a \doxygen{otb}{VectorImage}. To simplify, input and // output image types are the same one. - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage<PixelType, Dimension> ImageType; + const unsigned int Dimension = 2; + using PixelType = double; + using ImageType = otb::VectorImage<PixelType, Dimension>; // We instantiate reader and writer types - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - ReaderType::Pointer reader = ReaderType::New(); + using ReaderType = otb::ImageFileReader<ImageType>; + using WriterType = otb::ImageFileWriter<ImageType>; + ReaderType::Pointer reader = ReaderType::New(); // The \code{GenerateOutputInformation()} reader method is called // to know the number of component per pixel of the image. It is @@ -185,12 +185,12 @@ int main(int argc, char* argv[]) // \item $\beta_{k}$ is the absolute calibration bias for the channel k. // \end{itemize} - typedef otb::ImageToRadianceImageFilter<ImageType, ImageType> ImageToRadianceImageFilterType; + using ImageToRadianceImageFilterType = otb::ImageToRadianceImageFilter<ImageType, ImageType>; - ImageToRadianceImageFilterType::Pointer filterImageToRadiance = ImageToRadianceImageFilterType::New(); - typedef ImageToRadianceImageFilterType::VectorType VectorType; - VectorType alpha(nbOfComponent); - VectorType beta(nbOfComponent); + ImageToRadianceImageFilterType::Pointer filterImageToRadiance = ImageToRadianceImageFilterType::New(); + using VectorType = ImageToRadianceImageFilterType::VectorType; + VectorType alpha(nbOfComponent); + VectorType beta(nbOfComponent); alpha.Fill(0); beta.Fill(0); std::ifstream fin; @@ -234,10 +234,10 @@ int main(int argc, char* argv[]) // the month and the day of the acquisition. // \end{itemize} - typedef otb::RadianceToReflectanceImageFilter<ImageType, ImageType> RadianceToReflectanceImageFilterType; - RadianceToReflectanceImageFilterType::Pointer filterRadianceToReflectance = RadianceToReflectanceImageFilterType::New(); + using RadianceToReflectanceImageFilterType = otb::RadianceToReflectanceImageFilter<ImageType, ImageType>; + RadianceToReflectanceImageFilterType::Pointer filterRadianceToReflectance = RadianceToReflectanceImageFilterType::New(); - typedef RadianceToReflectanceImageFilterType::VectorType VectorType; + using VectorType = RadianceToReflectanceImageFilterType::VectorType; VectorType solarIllumination(nbOfComponent); solarIllumination.Fill(0); @@ -279,16 +279,16 @@ int main(int argc, char* argv[]) // \doxygen{otb}{AtmosphericRadiativeTerms} // types are defined and instancied. - typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms RadiometryCorrectionParametersToRadiativeTermsType; + using RadiometryCorrectionParametersToRadiativeTermsType = otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms; - typedef otb::AtmosphericCorrectionParameters AtmosphericCorrectionParametersType; + using AtmosphericCorrectionParametersType = otb::AtmosphericCorrectionParameters; - typedef otb::ImageMetadataCorrectionParameters AcquisitionCorrectionParametersType; + using AcquisitionCorrectionParametersType = otb::ImageMetadataCorrectionParameters; - typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; - typedef AtmosphericCorrectionParametersType::AerosolModelType AerosolModelType; - typedef otb::FilterFunctionValues FilterFunctionValuesType; - typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; + using AtmosphericRadiativeTermsType = otb::AtmosphericRadiativeTerms; + using AerosolModelType = AtmosphericCorrectionParametersType::AerosolModelType; + using FilterFunctionValuesType = otb::FilterFunctionValues; + using ValuesVectorType = FilterFunctionValuesType::ValuesVectorType; AtmosphericCorrectionParametersType::Pointer dataAtmosphericCorrectionParameters = AtmosphericCorrectionParametersType::New(); AcquisitionCorrectionParametersType::Pointer dataAcquisitionCorrectionParameters = AcquisitionCorrectionParametersType::New(); @@ -412,7 +412,7 @@ int main(int argc, char* argv[]) // Atmospheric corrections can now start. // First, an instance of \doxygen{otb}{ReflectanceToSurfaceReflectanceImageFilter} is created. - typedef otb::ReflectanceToSurfaceReflectanceImageFilter<ImageType, ImageType> ReflectanceToSurfaceReflectanceImageFilterType; + using ReflectanceToSurfaceReflectanceImageFilterType = otb::ReflectanceToSurfaceReflectanceImageFilter<ImageType, ImageType>; ReflectanceToSurfaceReflectanceImageFilterType::Pointer filterReflectanceToSurfaceReflectanceImageFilter = ReflectanceToSurfaceReflectanceImageFilterType::New(); @@ -491,8 +491,8 @@ int main(int argc, char* argv[]) // terms internally. If the "acquisition" correction parameters are not // present, the filter will try to get them from the image metadata. - typedef otb::SurfaceAdjacencyEffectCorrectionSchemeFilter<ImageType, ImageType> SurfaceAdjacencyEffectCorrectionSchemeFilterType; - SurfaceAdjacencyEffectCorrectionSchemeFilterType::Pointer filterSurfaceAdjacencyEffectCorrectionSchemeFilter = + using SurfaceAdjacencyEffectCorrectionSchemeFilterType = otb::SurfaceAdjacencyEffectCorrectionSchemeFilter<ImageType, ImageType>; + SurfaceAdjacencyEffectCorrectionSchemeFilterType::Pointer filterSurfaceAdjacencyEffectCorrectionSchemeFilter = SurfaceAdjacencyEffectCorrectionSchemeFilterType::New(); // Four inputs are needed to compute the neighborhood contribution: diff --git a/Examples/Simulation/LAIAndPROSAILToSensorResponse.cxx b/Examples/Simulation/LAIAndPROSAILToSensorResponse.cxx index 71f4cc673f..9f92157432 100644 --- a/Examples/Simulation/LAIAndPROSAILToSensorResponse.cxx +++ b/Examples/Simulation/LAIAndPROSAILToSensorResponse.cxx @@ -66,10 +66,10 @@ template <class TImage> class ITK_EXPORT ImageUniqueValuesCalculator : public itk::Object { public: - typedef ImageUniqueValuesCalculator<TImage> Self; - typedef itk::Object Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; + using Self = ImageUniqueValuesCalculator<TImage>; + using Superclass = itk::Object; + using Pointer = itk::SmartPointer<Self>; + using ConstPointer = itk::SmartPointer<const Self>; itkNewMacro(Self); @@ -77,14 +77,14 @@ public: itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension); - typedef typename TImage::PixelType PixelType; + using PixelType = typename TImage::PixelType; - typedef TImage ImageType; + using ImageType = TImage; - typedef std::vector<PixelType> ArrayType; + using ArrayType = std::vector<PixelType>; - typedef typename ImageType::Pointer ImagePointer; - typedef typename ImageType::ConstPointer ImageConstPointer; + using ImagePointer = typename ImageType::Pointer; + using ImageConstPointer = typename ImageType::ConstPointer; virtual void SetImage(const ImageType* image) { @@ -159,25 +159,25 @@ public: // \code{ProsailSimulatorFunctor} functor is defined here. // - typedef TLAI LAIPixelType; - typedef TLabel LabelPixelType; - typedef TMask MaskPixelType; - typedef TOutput OutputPixelType; - typedef TLabelSpectra LabelSpectraType; - typedef TLabelParameter LabelParameterType; - typedef TAcquistionParameter AcquistionParameterType; - typedef TSatRSR SatRSRType; - typedef typename SatRSRType::Pointer SatRSRPointerType; - typedef typename otb::ProspectModel ProspectType; - typedef typename otb::SailModel SailType; - - typedef double PrecisionType; - typedef std::pair<PrecisionType, PrecisionType> PairType; - typedef typename std::vector<PairType> VectorPairType; - typedef otb::SpectralResponse<PrecisionType, PrecisionType> ResponseType; - typedef ResponseType::Pointer ResponsePointerType; - typedef otb::ReduceSpectralResponse<ResponseType, SatRSRType> ReduceResponseType; - typedef typename ReduceResponseType::Pointer ReduceResponseTypePointerType; + using LAIPixelType = TLAI; + using LabelPixelType = TLabel; + using MaskPixelType = TMask; + using OutputPixelType = TOutput; + using LabelSpectraType = TLabelSpectra; + using LabelParameterType = TLabelParameter; + using AcquistionParameterType = TAcquistionParameter; + using SatRSRType = TSatRSR; + using SatRSRPointerType = typename SatRSRType::Pointer; + using ProspectType = typename otb::ProspectModel; + using SailType = typename otb::SailModel; + + using PrecisionType = double; + using PairType = std::pair<PrecisionType, PrecisionType>; + using VectorPairType = typename std::vector<PairType>; + using ResponseType = otb::SpectralResponse<PrecisionType, PrecisionType>; + using ResponsePointerType = ResponseType::Pointer; + using ReduceResponseType = otb::ReduceSpectralResponse<ResponseType, SatRSRType>; + using ReduceResponseTypePointerType = typename ReduceResponseType::Pointer; // In this example spectra are generated form $400$ to $2400nm$. the number of simulated band is set by \code{SimNbBands} value. // @@ -351,10 +351,10 @@ template <class TInputImage1, class TInputImage2, class TInputImage3, class TOut class ITK_EXPORT TernaryFunctorImageFilterWithNBands : public itk::TernaryFunctorImageFilter<TInputImage1, TInputImage2, TInputImage3, TOutputImage, TFunctor> { public: - typedef TernaryFunctorImageFilterWithNBands Self; - typedef itk::TernaryFunctorImageFilter<TInputImage1, TInputImage2, TInputImage3, TOutputImage, TFunctor> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; + using Self = TernaryFunctorImageFilterWithNBands<TInputImage1, TInputImage2, TInputImage3, TOutputImage, TFunctor>; + using Superclass = itk::TernaryFunctorImageFilter<TInputImage1, TInputImage2, TInputImage3, TOutputImage, TFunctor>; + using Pointer = itk::SmartPointer<Self>; + using ConstPointer = itk::SmartPointer<const Self>; /** Method for creation through the object factory. */ itkNewMacro(Self); @@ -422,48 +422,47 @@ int main(int argc, char* argv[]) // cloud mask, and \code{integer} label image // - typedef double LAIPixelType; - typedef unsigned short LabelType; - typedef unsigned short MaskPixelType; - typedef float OutputPixelType; + using LAIPixelType = double; + using LabelType = unsigned short; + using MaskPixelType = unsigned short; + using OutputPixelType = float; // Image typedef - typedef otb::Image<LAIPixelType, 2> LAIImageType; - typedef otb::Image<LabelType, 2> LabelImageType; - typedef otb::Image<MaskPixelType, 2> MaskImageType; - typedef otb::VectorImage<OutputPixelType, 2> SimulatedImageType; + using LAIImageType = otb::Image<LAIPixelType, 2>; + using LabelImageType = otb::Image<LabelType, 2>; + using MaskImageType = otb::Image<MaskPixelType, 2>; + using SimulatedImageType = otb::VectorImage<OutputPixelType, 2>; // reader typedef - typedef otb::ImageFileReader<LAIImageType> LAIReaderType; - typedef otb::ImageFileReader<LabelImageType> LabelReaderType; - typedef otb::ImageFileReader<MaskImageType> MaskReaderType; + using LAIReaderType = otb::ImageFileReader<LAIImageType>; + using LabelReaderType = otb::ImageFileReader<LabelImageType>; + using MaskReaderType = otb::ImageFileReader<MaskImageType>; // Leaf parameters typedef is defined. - typedef otb::LeafParameters LeafParametersType; - typedef LeafParametersType::Pointer LeafParametersPointerType; - typedef std::map<LabelType, LeafParametersPointerType> LabelParameterMapType; + using LeafParametersType = otb::LeafParameters; + using LeafParametersPointerType = LeafParametersType::Pointer; + using LabelParameterMapType = std::map<LabelType, LeafParametersPointerType>; // Sensor spectral response typedef is defined - typedef double PrecisionType; - typedef std::vector<PrecisionType> SpectraType; - typedef std::map<LabelType, SpectraType> SpectraParameterType; + using PrecisionType = double; + using SpectraType = std::vector<PrecisionType>; + using SpectraParameterType = std::map<LabelType, SpectraType>; // Acquisition response typedef is defined - typedef std::map<std::string, double> AcquistionParsType; + using AcquistionParsType = std::map<std::string, double>; // Satellite typedef is defined - typedef otb::SatelliteRSR<PrecisionType, PrecisionType> SatRSRType; + using SatRSRType = otb::SatelliteRSR<PrecisionType, PrecisionType>; // Filter type is the specific \code{TernaryFunctorImageFilterWithNBands} defined below with specific functor. - typedef otb::Functor::ProsailSimulatorFunctor<LAIPixelType, LabelType, MaskPixelType, SimulatedImageType::PixelType, SpectraParameterType, - LabelParameterMapType, AcquistionParsType, SatRSRType> - SimuFunctorType; - typedef otb::TernaryFunctorImageFilterWithNBands<LAIImageType, LabelImageType, MaskImageType, SimulatedImageType, SimuFunctorType> SimulatorType; + using SimuFunctorType = otb::Functor::ProsailSimulatorFunctor<LAIPixelType, LabelType, MaskPixelType, SimulatedImageType::PixelType, SpectraParameterType, + LabelParameterMapType, AcquistionParsType, SatRSRType>; + using SimulatorType = otb::TernaryFunctorImageFilterWithNBands<LAIImageType, LabelImageType, MaskImageType, SimulatedImageType, SimuFunctorType>; // Read the acquisition parameter file which is like // Angl val @@ -576,9 +575,9 @@ int main(int argc, char* argv[]) { std::string spectraFilename = rootPath; ss >> spectraFilename; - spectraFilename = rootPath + spectraFilename; - typedef otb::SpectralResponse<PrecisionType, PrecisionType> ResponseType; - ResponseType::Pointer resp = ResponseType::New(); + spectraFilename = rootPath + spectraFilename; + using ResponseType = otb::SpectralResponse<PrecisionType, PrecisionType>; + ResponseType::Pointer resp = ResponseType::New(); // Coefficient 100 since Aster database is given in % reflectance resp->Load(spectraFilename, 100.0); @@ -613,7 +612,7 @@ int main(int argc, char* argv[]) LabelImageType::Pointer labelImage = labelReader->GetOutput(); - typedef otb::ImageUniqueValuesCalculator<LabelImageType> UniqueCalculatorType; + using UniqueCalculatorType = otb::ImageUniqueValuesCalculator<LabelImageType>; UniqueCalculatorType::Pointer uniqueCalculator = UniqueCalculatorType::New(); @@ -665,8 +664,8 @@ int main(int argc, char* argv[]) cmiReader->SetFileName(cmifname); cmiReader->UpdateOutputInformation(); - typedef itk::OrImageFilter<MaskImageType, MaskImageType, MaskImageType> OrType; - OrType::Pointer orfilter = OrType::New(); + using OrType = itk::OrImageFilter<MaskImageType, MaskImageType, MaskImageType>; + OrType::Pointer orfilter = OrType::New(); orfilter->SetInput1(miReader->GetOutput()); orfilter->SetInput2(cmiReader->GetOutput()); @@ -724,8 +723,8 @@ int main(int argc, char* argv[]) // Write output image to disk - typedef otb::ImageFileWriter<SimulatedImageType> WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = otb::ImageFileWriter<SimulatedImageType>; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outfname); writer->SetInput(simulator->GetOutput()); diff --git a/Examples/Simulation/LAIFromNDVIImageTransform.cxx b/Examples/Simulation/LAIFromNDVIImageTransform.cxx index 133e5dd644..e2cb6cd5b4 100644 --- a/Examples/Simulation/LAIFromNDVIImageTransform.cxx +++ b/Examples/Simulation/LAIFromNDVIImageTransform.cxx @@ -53,19 +53,19 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - const unsigned int Dimension = 2; - typedef otb::VectorImage<double, Dimension> InputImageType; - typedef otb::Image<double, Dimension> OutputImageType; - typedef otb::Image<unsigned char, Dimension> ImageVisuType; - typedef otb::ImageFileReader<InputImageType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::ImageFileWriter<ImageVisuType> VisuWriterType; - typedef otb::ImageFileWriter<InputImageType> InWriterType; + const unsigned int Dimension = 2; + using InputImageType = otb::VectorImage<double, Dimension>; + using OutputImageType = otb::Image<double, Dimension>; + using ImageVisuType = otb::Image<unsigned char, Dimension>; + using ReaderType = otb::ImageFileReader<InputImageType>; + using WriterType = otb::ImageFileWriter<OutputImageType>; + using VisuWriterType = otb::ImageFileWriter<ImageVisuType>; + using InWriterType = otb::ImageFileWriter<InputImageType>; // Filter type is a generic \doxygen{itk}{UnaryFunctorImageFilter} using Formosat2 specific LAI // \doxygen{otb}{LAIFromNDVIFormosat2Functor}. - typedef otb::Functor::LAIFromNDVIFormosat2Functor<InputImageType::InternalPixelType, OutputImageType::PixelType> FunctorType; - typedef itk::UnaryFunctorImageFilter<InputImageType, OutputImageType, FunctorType> LAIFRomNDVIImageFilterType; + using FunctorType = otb::Functor::LAIFromNDVIFormosat2Functor<InputImageType::InternalPixelType, OutputImageType::PixelType>; + using LAIFRomNDVIImageFilterType = itk::UnaryFunctorImageFilter<InputImageType, OutputImageType, FunctorType>; // Instantiating object @@ -124,7 +124,7 @@ int main(int argc, char* argv[]) visuWriter->SetFileName(OutputName3); - typedef itk::RescaleIntensityImageFilter<OutputImageType, ImageVisuType> RescalerTypeOut; + using RescalerTypeOut = itk::RescaleIntensityImageFilter<OutputImageType, ImageVisuType>; RescalerTypeOut::Pointer rescaler = RescalerTypeOut::New(); rescaler->SetInput(filter->GetOutput()); diff --git a/Examples/Simulation/ProsailModel.cxx b/Examples/Simulation/ProsailModel.cxx index 42e06f7169..ecae20f2d4 100644 --- a/Examples/Simulation/ProsailModel.cxx +++ b/Examples/Simulation/ProsailModel.cxx @@ -50,7 +50,7 @@ int main(int argc, char* argv[]) char* OutputName = argv[15]; // We now define leaf parameters, which characterize vegetation composition. - typedef otb::LeafParameters LeafParametersType; + using LeafParametersType = otb::LeafParameters; // Next the parameters variable is created by invoking the \code{New()}~method and @@ -86,8 +86,8 @@ int main(int argc, char* argv[]) // Leaf parameters are used as prospect input - typedef otb::ProspectModel ProspectType; - ProspectType::Pointer prospect = ProspectType::New(); + using ProspectType = otb::ProspectModel; + ProspectType::Pointer prospect = ProspectType::New(); prospect->SetInput(leafParams); @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) double TTO = static_cast<double>(atof(argv[13])); double PSI = static_cast<double>(atof(argv[14])); - typedef otb::SailModel SailType; + using SailType = otb::SailModel; SailType::Pointer sail = SailType::New(); @@ -151,12 +151,9 @@ int main(int argc, char* argv[]) for (unsigned int i = 0; i < sail->GetViewingReflectance()->Size(); ++i) { - otbLogMacro(Debug, << "wavelength : " - << sail->GetViewingReflectance()->GetResponse()[i].first - << ". Viewing reflectance " - << sail->GetViewingReflectance()->GetResponse()[i].second - << ". Hemispherical reflectance " - << sail->GetHemisphericalReflectance()->GetResponse()[i].second); + otbLogMacro(Debug, << "wavelength : " << sail->GetViewingReflectance()->GetResponse()[i].first << ". Viewing reflectance " + << sail->GetViewingReflectance()->GetResponse()[i].second << ". Hemispherical reflectance " + << sail->GetHemisphericalReflectance()->GetResponse()[i].second); } std::ofstream outputFile(OutputName, std::ios::out); diff --git a/Examples/Tutorials/FilteringPipeline.cxx b/Examples/Tutorials/FilteringPipeline.cxx index cfe2abc76e..43158b4535 100644 --- a/Examples/Tutorials/FilteringPipeline.cxx +++ b/Examples/Tutorials/FilteringPipeline.cxx @@ -47,13 +47,13 @@ int main(int argc, char* argv[]) // We declare the image type, the reader and the writer as // before: - typedef otb::Image<unsigned char, 2> ImageType; + using ImageType = otb::Image<unsigned char, 2>; - typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); + using ReaderType = otb::ImageFileReader<ImageType>; + ReaderType::Pointer reader = ReaderType::New(); - typedef otb::ImageFileWriter<ImageType> WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = otb::ImageFileWriter<ImageType>; + WriterType::Pointer writer = WriterType::New(); reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); @@ -63,8 +63,8 @@ int main(int argc, char* argv[]) // in OTB. Here we are using the same type for the input and the // output images: - typedef itk::GradientMagnitudeImageFilter<ImageType, ImageType> FilterType; - FilterType::Pointer filter = FilterType::New(); + using FilterType = itk::GradientMagnitudeImageFilter<ImageType, ImageType>; + FilterType::Pointer filter = FilterType::New(); // Let's plug the pipeline: diff --git a/Examples/Tutorials/HelloWorldOTB.cxx b/Examples/Tutorials/HelloWorldOTB.cxx index 1979df092d..45a0887f00 100644 --- a/Examples/Tutorials/HelloWorldOTB.cxx +++ b/Examples/Tutorials/HelloWorldOTB.cxx @@ -28,7 +28,7 @@ int main(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { - typedef otb::Image<unsigned short, 2> ImageType; + using ImageType = otb::Image<unsigned short, 2>; ImageType::Pointer image = ImageType::New(); diff --git a/Examples/Tutorials/Multispectral.cxx b/Examples/Tutorials/Multispectral.cxx index 3c5272d45f..47ee5173e7 100644 --- a/Examples/Tutorials/Multispectral.cxx +++ b/Examples/Tutorials/Multispectral.cxx @@ -49,11 +49,11 @@ int main(int argc, char* argv[]) // reader. As we have done in the previous example we get the filename from // the command line. - typedef unsigned short int PixelType; - typedef otb::VectorImage<PixelType, 2> VectorImageType; + using PixelType = unsigned short; + using VectorImageType = otb::VectorImage<PixelType, 2>; - typedef otb::ImageFileReader<VectorImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); + using ReaderType = otb::ImageFileReader<VectorImageType>; + ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); @@ -61,8 +61,8 @@ int main(int argc, char* argv[]) // only one of the spectral band we use the // \doxygen{otb}{MultiToMonoChannelExtractROI}. The declaration is as usual: - typedef otb::MultiToMonoChannelExtractROI<PixelType, PixelType> ExtractChannelType; - ExtractChannelType::Pointer extractChannel = ExtractChannelType::New(); + using ExtractChannelType = otb::MultiToMonoChannelExtractROI<PixelType, PixelType>; + ExtractChannelType::Pointer extractChannel = ExtractChannelType::New(); // We need to pass the parameters to the filter for the extraction. This // filter also allow extracting only a spatial subset of the image. However, // we will extract the whole channel in this case. @@ -89,9 +89,9 @@ int main(int argc, char* argv[]) // \doxygen{otb}{MultiToMonoChannelExtractROI} is a \doxygen{otb}{Image}, we // need to template the writer with this type. - typedef otb::Image<PixelType, 2> ImageType; - typedef otb::ImageFileWriter<ImageType> WriterType; - WriterType::Pointer writer = WriterType::New(); + using ImageType = otb::Image<PixelType, 2>; + using WriterType = otb::ImageFileWriter<ImageType>; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[2]); writer->SetInput(extractChannel->GetOutput()); @@ -122,8 +122,8 @@ int main(int argc, char* argv[]) // by declaring the filter on a normal \doxygen{otb}{Image}. Note that we // don't need to specify any input for this filter. - typedef itk::ShiftScaleImageFilter<ImageType, ImageType> ShiftScaleType; - ShiftScaleType::Pointer shiftScale = ShiftScaleType::New(); + using ShiftScaleType = itk::ShiftScaleImageFilter<ImageType, ImageType>; + ShiftScaleType::Pointer shiftScale = ShiftScaleType::New(); shiftScale->SetScale(0.5); shiftScale->SetShift(10); @@ -134,8 +134,8 @@ int main(int argc, char* argv[]) // The filter is selected using the \code{SetFilter()} method and the input // by the usual \code{SetInput()} method. - typedef otb::PerBandVectorImageFilter<VectorImageType, VectorImageType, ShiftScaleType> VectorFilterType; - VectorFilterType::Pointer vectorFilter = VectorFilterType::New(); + using VectorFilterType = otb::PerBandVectorImageFilter<VectorImageType, VectorImageType, ShiftScaleType>; + VectorFilterType::Pointer vectorFilter = VectorFilterType::New(); vectorFilter->SetFilter(shiftScale); vectorFilter->SetInput(reader->GetOutput()); @@ -143,8 +143,8 @@ int main(int argc, char* argv[]) // Now, we just have to save the image using a writer templated over an // \doxygen{otb}{VectorImage}: - typedef otb::ImageFileWriter<VectorImageType> VectorWriterType; - VectorWriterType::Pointer writerVector = VectorWriterType::New(); + using VectorWriterType = otb::ImageFileWriter<VectorImageType>; + VectorWriterType::Pointer writerVector = VectorWriterType::New(); writerVector->SetFileName(argv[3]); writerVector->SetInput(vectorFilter->GetOutput()); diff --git a/Examples/Tutorials/OrthoFusion.cxx b/Examples/Tutorials/OrthoFusion.cxx index c0ead29574..2f40ce9f87 100644 --- a/Examples/Tutorials/OrthoFusion.cxx +++ b/Examples/Tutorials/OrthoFusion.cxx @@ -65,13 +65,13 @@ int main(int argc, char* argv[]) // We declare the different images, readers and writer: - typedef otb::Image<unsigned int, 2> ImageType; - typedef otb::VectorImage<unsigned int, 2> VectorImageType; - typedef otb::Image<double, 2> DoubleImageType; - typedef otb::VectorImage<double, 2> DoubleVectorImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileReader<VectorImageType> VectorReaderType; - typedef otb::ImageFileWriter<VectorImageType> WriterType; + using ImageType = otb::Image<unsigned int, 2>; + using VectorImageType = otb::VectorImage<unsigned int, 2>; + using DoubleImageType = otb::Image<double, 2>; + using DoubleVectorImageType = otb::VectorImage<double, 2>; + using ReaderType = otb::ImageFileReader<ImageType>; + using VectorReaderType = otb::ImageFileReader<VectorImageType>; + using WriterType = otb::ImageFileWriter<VectorImageType>; ReaderType::Pointer readerPAN = ReaderType::New(); VectorReaderType::Pointer readerXS = VectorReaderType::New(); @@ -88,9 +88,9 @@ int main(int argc, char* argv[]) // \item the hemisphere // \end{itemize} - std::string wkt = otb::SpatialReference::FromUTM(atoi(argv[4]),argv[5][0]=='N' ? - otb::SpatialReference::hemisphere::north : - otb::SpatialReference::hemisphere::south).ToWkt(); + std::string wkt = + otb::SpatialReference::FromUTM(atoi(argv[4]), argv[5][0] == 'N' ? otb::SpatialReference::hemisphere::north : otb::SpatialReference::hemisphere::south) + .ToWkt(); // We will need to pass several parameters to the orthorectification // concerning the desired output region: @@ -114,7 +114,7 @@ int main(int argc, char* argv[]) // We declare the orthorectification filter. And provide the different // parameters: - typedef otb::GenericRSResampleImageFilter<ImageType, DoubleImageType> OrthoRectifFilterType; + using OrthoRectifFilterType = otb::GenericRSResampleImageFilter<ImageType, DoubleImageType>; OrthoRectifFilterType::Pointer orthoRectifPAN = OrthoRectifFilterType::New(); orthoRectifPAN->SetOutputProjectionRef(wkt); @@ -129,7 +129,7 @@ int main(int argc, char* argv[]) // Now we are able to have the orthorectified area from the PAN image. We just // have to follow a similar process for the XS image. - typedef otb::GenericRSResampleImageFilter<VectorImageType, DoubleVectorImageType> VectorOrthoRectifFilterType; + using VectorOrthoRectifFilterType = otb::GenericRSResampleImageFilter<VectorImageType, DoubleVectorImageType>; VectorOrthoRectifFilterType::Pointer orthoRectifXS = VectorOrthoRectifFilterType::New(); @@ -145,8 +145,8 @@ int main(int argc, char* argv[]) // It's time to declare the fusion filter and set its inputs: - typedef otb::SimpleRcsPanSharpeningFusionImageFilter<DoubleImageType, DoubleVectorImageType, VectorImageType> FusionFilterType; - FusionFilterType::Pointer fusion = FusionFilterType::New(); + using FusionFilterType = otb::SimpleRcsPanSharpeningFusionImageFilter<DoubleImageType, DoubleVectorImageType, VectorImageType>; + FusionFilterType::Pointer fusion = FusionFilterType::New(); fusion->SetPanInput(orthoRectifPAN->GetOutput()); fusion->SetXsInput(orthoRectifXS->GetOutput()); diff --git a/Examples/Tutorials/Pipeline.cxx b/Examples/Tutorials/Pipeline.cxx index 1b92caec2f..02a06931dd 100644 --- a/Examples/Tutorials/Pipeline.cxx +++ b/Examples/Tutorials/Pipeline.cxx @@ -42,19 +42,19 @@ int main(int argc, char* argv[]) // is declared as an unsigned char (one byte) and the image is specified as // having two dimensions. - typedef otb::Image<unsigned char, 2> ImageType; + using ImageType = otb::Image<unsigned char, 2>; // To read the image, we need an \doxygen{otb}{ImageFileReader} // which is templated with the image type. - typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); + using ReaderType = otb::ImageFileReader<ImageType>; + ReaderType::Pointer reader = ReaderType::New(); // Then, we need an \doxygen{otb}{ImageFileWriter} // also templated with the image type. - typedef otb::ImageFileWriter<ImageType> WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = otb::ImageFileWriter<ImageType>; + WriterType::Pointer writer = WriterType::New(); // The filenames are passed as arguments to the program. We keep it // simple for now and we don't check their validity. diff --git a/Examples/Tutorials/ScalingPipeline.cxx b/Examples/Tutorials/ScalingPipeline.cxx index 25053b87b9..c7450105c5 100644 --- a/Examples/Tutorials/ScalingPipeline.cxx +++ b/Examples/Tutorials/ScalingPipeline.cxx @@ -49,11 +49,11 @@ int main(int argc, char* argv[]) // We need to declare two different image types, one for the internal // processing and one to output the results: - typedef double PixelType; - typedef otb::Image<PixelType, 2> ImageType; + using PixelType = double; + using ImageType = otb::Image<PixelType, 2>; - typedef unsigned char OutputPixelType; - typedef otb::Image<OutputPixelType, 2> OutputImageType; + using OutputPixelType = unsigned char; + using OutputImageType = otb::Image<OutputPixelType, 2>; // We declare the reader with the image template using the pixel type // double. It is worth noticing that this instantiation does not imply @@ -63,11 +63,11 @@ int main(int argc, char* argv[]) // The writer is templated with the unsigned char image to be able to save // the result on one byte images (like png for example). - typedef otb::ImageFileReader<ImageType> ReaderType; - ReaderType::Pointer reader = ReaderType::New(); + using ReaderType = otb::ImageFileReader<ImageType>; + ReaderType::Pointer reader = ReaderType::New(); - typedef otb::ImageFileWriter<OutputImageType> WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = otb::ImageFileWriter<OutputImageType>; + WriterType::Pointer writer = WriterType::New(); reader->SetFileName(argv[1]); writer->SetFileName(argv[2]); @@ -75,8 +75,8 @@ int main(int argc, char* argv[]) // Now we are declaring the edge detection filter which is going to work with // double input and output. - typedef itk::CannyEdgeDetectionImageFilter<ImageType, ImageType> FilterType; - FilterType::Pointer filter = FilterType::New(); + using FilterType = itk::CannyEdgeDetectionImageFilter<ImageType, ImageType>; + FilterType::Pointer filter = FilterType::New(); // Here comes the interesting part: we declare the // \doxygen{itk}{RescaleIntensityImageFilter}. The input @@ -91,8 +91,8 @@ int main(int argc, char* argv[]) // This filter will actually rescale all the pixels of // the image but also cast the type of these pixels. - typedef itk::RescaleIntensityImageFilter<ImageType, OutputImageType> RescalerType; - RescalerType::Pointer rescaler = RescalerType::New(); + using RescalerType = itk::RescaleIntensityImageFilter<ImageType, OutputImageType>; + RescalerType::Pointer rescaler = RescalerType::New(); rescaler->SetOutputMinimum(0); rescaler->SetOutputMaximum(255); -- GitLab