From 9bc5fcbf17a2bdd0d2485c6c4f8bde159eca76cd Mon Sep 17 00:00:00 2001 From: Jonathan Guinet <jonathan.guinet@c-s.fr> Date: Fri, 15 Jun 2012 17:52:58 +0200 Subject: [PATCH] STYLE: correct indentation. --- .../MeanShiftSegmentationFilterExample.cxx | 145 +++++++++--------- 1 file changed, 69 insertions(+), 76 deletions(-) diff --git a/Examples/BasicFilters/MeanShiftSegmentationFilterExample.cxx b/Examples/BasicFilters/MeanShiftSegmentationFilterExample.cxx index 76472b917c..b2d9e7d3e4 100644 --- a/Examples/BasicFilters/MeanShiftSegmentationFilterExample.cxx +++ b/Examples/BasicFilters/MeanShiftSegmentationFilterExample.cxx @@ -61,111 +61,108 @@ int main(int argc, char * argv[]) { if (argc != 11) { - std::cerr << "Usage: " << argv[0] - << " infname labeledfname clusteredfname labeledpretty clusteredpretty " - << "spatialRadius rangeRadius minRegionSize maxiter thres" - << std::endl; + std::cerr << "Usage: " << argv[0] << " infname labeledfname clusteredfname labeledpretty clusteredpretty " + << "spatialRadius rangeRadius minRegionSize maxiter thres" << std::endl; return EXIT_FAILURE; } + const char * infname = argv[1]; + const char * labeledfname = argv[2]; + const char * clusteredfname = argv[3]; + const char * labeledpretty = argv[4]; + const char * clusteredpretty = argv[5]; + const unsigned int spatialRadius = atoi(argv[6]); + const double rangeRadius = atof(argv[7]); + const unsigned int minRegionSize = atoi(argv[8]); + const unsigned int maxiter = atoi(argv[9]); + const double thres = atof(argv[10]); - const char * infname = argv[1]; - const char * labeledfname = argv[2]; - const char * clusteredfname = argv[3]; - const char * labeledpretty = argv[4]; - const char * clusteredpretty = argv[5]; - const unsigned int spatialRadius = atoi(argv[6]); - const double rangeRadius = atof(argv[7]); - const unsigned int minRegionSize = atoi(argv[8]); - const unsigned int maxiter = atoi(argv[9]); - const double thres = atof(argv[10]); - -// Software Guide : BeginLatex -// -// We start by the classical \code{typedef}s needed for reading and -// writing the images. -// -// Software Guide : EndLatex + // Software Guide : BeginLatex + // + // We start by the classical \code{typedef}s needed for reading and + // writing the images. + // + // Software Guide : EndLatex -// Software Guide : BeginCodeSnippet + // Software Guide : BeginCodeSnippet const unsigned int Dimension = 2; - typedef float PixelType; - typedef unsigned int LabelPixelType ; + + typedef float PixelType; + typedef unsigned int LabelPixelType; typedef itk::RGBPixel<unsigned char> ColorPixelType; - typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef otb::Image<LabelPixelType, Dimension> LabelImageType; - typedef otb::Image<ColorPixelType, Dimension> RGBImageType; + typedef otb::VectorImage<PixelType, Dimension> ImageType; + typedef otb::Image<LabelPixelType, Dimension> LabelImageType; + typedef otb::Image<ColorPixelType, Dimension> RGBImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; typedef otb::StreamingImageFileWriter<LabelImageType> LabelWriterType; typedef otb::MeanShiftSegmentationFilter<ImageType, LabelImageType, ImageType> FilterType; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex -// -// We instantiate the filter, the reader, and 2 writers (for the -// labeled and clustered images ): -// -// Software Guide : EndLatex - -// Software Guide : BeginCodeSnippet - FilterType::Pointer filter = FilterType::New(); - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer1 = WriterType::New(); - LabelWriterType::Pointer writer2 = LabelWriterType::New(); + // + // We instantiate the filter, the reader, and 2 writers (for the + // labeled and clustered images ): + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + FilterType::Pointer filter = FilterType::New(); + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer1 = WriterType::New(); + LabelWriterType::Pointer writer2 = LabelWriterType::New(); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex -// -// We set the file names for the reader and the writers: -// -// Software Guide : EndLatex + // + // We set the file names for the reader and the writers: + // + // Software Guide : EndLatex -// Software Guide : BeginCodeSnippet + // Software Guide : BeginCodeSnippet reader->SetFileName(infname); writer1->SetFileName(clusteredfname); writer2->SetFileName(labeledfname); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex -// -// We can now set the parameters for the filter. There are 3 main -// parameters: the spatial radius used for defining the neighborhood, -// the range radius used for defining the interval in the color space -// and the minimum size for the regions to be kept after clustering. -// -// Software Guide : EndLatex - -// Software Guide : BeginCodeSnippet + // + // We can now set the parameters for the filter. There are 3 main + // parameters: the spatial radius used for defining the neighborhood, + // the range radius used for defining the interval in the color space + // and the minimum size for the regions to be kept after clustering. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet filter->SetSpatialBandwidth(spatialRadius); filter->SetRangeBandwidth(rangeRadius); filter->SetMinRegionSize(minRegionSize); - // Software Guide : EndCodeSnippet // Software Guide : BeginLatex -// -// Two another parameters can be set the maximum iteration number, which define maximum number of iteration until convergence. -// Algorithm iterative scheme will stop if convergence hasn't been reached after the maximum number of iterations. -// Threshold parameter defines mean-shift vector convergence value. Algorithm iterative scheme will stop if mean-shift vector is below this threshold or if iteration number reached maximum number of iterations. -// Software Guide : EndLatex + // + // Two another parameters can be set the maximum iteration number, which define maximum number of iteration until convergence. + // Algorithm iterative scheme will stop if convergence hasn't been reached after the maximum number of iterations. + // Threshold parameter defines mean-shift vector convergence value. Algorithm iterative scheme will stop if mean-shift vector is below this threshold or if iteration number reached maximum number of iterations. + // Software Guide : EndLatex -// Software Guide : BeginCodeSnippet + // Software Guide : BeginCodeSnippet filter->SetMaxIterationNumber(maxiter); filter->SetThreshold(thres); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex -// -// We can now plug the pipeline and run it. -// -// Software Guide : EndLatex + // + // We can now plug the pipeline and run it. + // + // Software Guide : EndLatex -// Software Guide : BeginCodeSnippet + // Software Guide : BeginCodeSnippet filter->SetInput(reader->GetOutput()); writer1->SetInput(filter->GetClusteredOutput()); writer2->SetInput(filter->GetLabelOutput()); @@ -197,8 +194,8 @@ int main(int argc, char * argv[]) printableImageFilter->SetChannel(2); printableImageFilter->SetChannel(3); - typedef PrintableFilterType::OutputImageType OutputImageType; - typedef otb::ImageFileWriter<OutputImageType> PrettyWriterType; + typedef PrintableFilterType::OutputImageType OutputImageType; + typedef otb::ImageFileWriter<OutputImageType> PrettyWriterType; PrettyWriterType::Pointer prettyWriter = PrettyWriterType::New(); @@ -207,18 +204,14 @@ int main(int argc, char * argv[]) prettyWriter->SetInput(printableImageFilter->GetOutput()); prettyWriter->Update(); - typedef otb::ImageFileWriter<RGBImageType> LabelRGBWriterType; + typedef otb::ImageFileWriter<RGBImageType> LabelRGBWriterType; 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(); - + typedef itk::Functor::ScalarToRGBPixelFunctor<LabelPixelType> FunctorType; + typedef itk::UnaryFunctorImageFilter<LabelImageType, RGBImageType, FunctorType> ColorLabelFilterType; + ColorLabelFilterType::Pointer labelToRGB = ColorLabelFilterType::New(); labelToRGB->SetInput(filter->GetLabelOutput()); -- GitLab