Commit 80dd6c28 authored by Victor Poughon's avatar Victor Poughon

STYLE: prefer using to typedef in examples

parent 65bfe823
Pipeline #1482 passed with stages
in 77 minutes and 35 seconds
......@@ -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.
......
......@@ -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();
......
......@@ -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:
......
......@@ -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);
......
......@@ -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();
......
......@@ -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());
......
......@@ -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();
......
......@@ -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.
......
......@@ -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());
......
......@@ -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);
......
......@@ -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]);
......
......@@ -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);
......
......@@ -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[])