Commit d401c28d authored by Emmanuel Christophe's avatar Emmanuel Christophe

DOC: code formatting for software guide

parent 3559c7a7
......@@ -125,7 +125,6 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::ScalarToRGBColormapImageFilter<ImageType,RGBImageType> ColorMapFilterType;
ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New();
colormapper->UseInputImageExtremaForScalingOff();
......@@ -138,7 +137,6 @@ int main(int argc, char * argv[])
colormap->SetMaximumInputValue(4000);
colormapper->SetColormap(colormap);
}
// Software Guide : EndCodeSnippet
else
......
......@@ -112,7 +112,6 @@ int main(int argc, char * argv[])
typedef otb::MeanShiftVectorImageFilter<ImageType,ImageType> FilterType;
typedef FilterType::LabeledOutputType LabeledImageType;
typedef otb::StreamingImageFileWriter<LabeledImageType> LabeledWriterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -130,7 +129,6 @@ int main(int argc, char * argv[])
WriterType::Pointer writer2 = WriterType::New();
LabeledWriterType::Pointer writer3 = LabeledWriterType::New();
LabeledWriterType::Pointer writer4 = LabeledWriterType::New();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -145,7 +143,6 @@ int main(int argc, char * argv[])
writer2->SetFileName(clusteredfname);
writer3->SetFileName(labeledclusteredfname);
writer4->SetFileName(clusterboundariesfname);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -180,7 +177,6 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
filter->SetInput(reader->GetOutput());
writer1->SetInput(filter->GetOutput());
writer2->SetInput(filter->GetClusteredOutput());
......
......@@ -150,7 +150,6 @@ private:
void operator=(const Self&); //purposely not implemented
};
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -223,7 +222,6 @@ int main(int argc, char* argv[] )
InputImageType1,
InputImageType2,
ChangeImageType > FilterType;
// Software Guide : EndCodeSnippet
ReaderType1::Pointer reader1 = ReaderType1::New();
......@@ -255,7 +253,6 @@ int main(int argc, char* argv[] )
rescaler->SetInput( filter->GetOutput() );
writer->SetInput( rescaler->GetOutput() );
// Software Guide : EndCodeSnippet
typedef otb::CommandProgressUpdate<FilterType> CommandType;
......
......@@ -189,8 +189,6 @@ int main(int argc, char* argv[] )
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
filter->SetInput1( reader1->GetOutput() );
filter->SetInput2( reader2->GetOutput() );
......
......@@ -62,10 +62,8 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::VectorImage<PixelType,Dimension> ImageType;
typedef otb::Image<LabeledPixelType,Dimension> LabeledImageType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -78,7 +76,6 @@ int main(int argc, char * argv[])
typedef otb::KMeansImageClassificationFilter<ImageType,LabeledImageType>
ClassificationFilterType;
typedef ClassificationFilterType::KMeansParametersType KMeansParametersType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -89,10 +86,8 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::ImageFileReader<ImageType> ReaderType;
typedef otb::StreamingImageFileWriter<LabeledImageType> WriterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -105,14 +100,11 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
ClassificationFilterType::Pointer filter = ClassificationFilterType::New();
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(infname);
reader->GenerateOutputInformation();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -123,7 +115,6 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
const unsigned int sampleSize = ClassificationFilterType::MaxSampleDimension;
const unsigned int parameterSize = nbClasses * sampleSize;
KMeansParametersType parameters;
......@@ -144,7 +135,6 @@ int main(int argc, char * argv[])
}
std::cout<<"Parameters: "<<parameters<<std::endl;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -154,7 +144,6 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
filter->SetCentroids(parameters);
filter->SetInput(reader->GetOutput());
......
......@@ -55,7 +55,6 @@ int main(int argc, char * argv[])
const unsigned int Dimension = 2;
typedef double PixelType;
typedef unsigned short LabeledPixelType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -66,10 +65,8 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::VectorImage<PixelType,Dimension> ImageType;
typedef otb::Image<LabeledPixelType,Dimension> LabeledImageType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -79,12 +76,9 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::SOMMap<ImageType::PixelType> SOMMapType;
typedef otb::SOMImageClassificationFilter<ImageType,
LabeledImageType,SOMMapType> ClassificationFilterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -96,12 +90,9 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::ImageFileReader<ImageType> ReaderType;
typedef otb::ImageFileReader<SOMMapType> SOMReaderType;
typedef otb::StreamingImageFileWriter<LabeledImageType> WriterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -111,8 +102,6 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
ClassificationFilterType::Pointer filter = ClassificationFilterType::New();
ReaderType::Pointer reader = ReaderType::New();
......@@ -123,7 +112,6 @@ int main(int argc, char * argv[])
somreader->Update();
filter->SetMap(somreader->GetOutput());
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -133,7 +121,6 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
filter->SetInput(reader->GetOutput());
WriterType::Pointer writer = WriterType::New();
......
......@@ -56,7 +56,6 @@ int main(int argc, char * argv[])
const unsigned int Dimension = 2;
typedef double PixelType;
typedef unsigned short LabeledPixelType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -67,10 +66,8 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::VectorImage<PixelType,Dimension> ImageType;
typedef otb::Image<LabeledPixelType,Dimension> LabeledImageType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -80,11 +77,9 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::SVMImageClassificationFilter<ImageType,LabeledImageType>
ClassificationFilterType;
typedef ClassificationFilterType::ModelType ModelType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -95,11 +90,8 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::ImageFileReader<ImageType> ReaderType;
typedef otb::StreamingImageFileWriter<LabeledImageType> WriterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -109,9 +101,6 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
ClassificationFilterType::Pointer filter = ClassificationFilterType::New();
ReaderType::Pointer reader = ReaderType::New();
......@@ -121,7 +110,6 @@ int main(int argc, char * argv[])
model->LoadModel(modelfname);
filter->SetModel(model);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -131,7 +119,6 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
filter->SetInput(reader->GetOutput());
WriterType::Pointer writer = WriterType::New();
......
......@@ -236,7 +236,6 @@ int main( int argc, char * argv [] )
std::cout << "cluster[" << i << "] ";
std::cout << " estimated mean : " << estimatedMeans[i] << std::endl;
}
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......
......@@ -88,7 +88,6 @@ int main( int argc, char * argv [] )
// Software Guide : BeginCodeSnippet
// Create a List from the scalar image
typedef itk::Statistics::ScalarImageToListAdaptor< ImageType > AdaptorType;
......@@ -141,7 +140,6 @@ int main( int argc, char * argv [] )
std::cout << "cluster[" << i << "] " << std::endl;
std::cout << " estimated mean : " << estimatedMeans[i] << std::endl;
}
// Software Guide : EndCodeSnippet
......
......@@ -112,7 +112,6 @@ int main(int, char *[])
// Software Guide : BeginCodeSnippet
ImageType::PixelType pixelValue = image->GetPixel( pixelIndex );
// Software Guide : EndCodeSnippet
......
......@@ -49,7 +49,6 @@
// Software Guide : BeginCodeSnippet
#include "otbImage.h"
#include "otbImportImageFilter.h"
// Software Guide : EndCodeSnippet
#include "otbImageFileWriter.h"
......@@ -76,7 +75,6 @@ int main(int argc, char * argv[])
typedef unsigned char PixelType;
const unsigned int Dimension = 2;
typedef otb::Image< PixelType, Dimension > ImageType;
// Software Guide : EndCodeSnippet
......@@ -214,7 +212,6 @@ int main(int argc, char * argv[])
*it++ = ( d2 < radius2 ) ? 255 : 0;
}
}
// Software Guide : EndCodeSnippet
......
......@@ -50,7 +50,6 @@
#include "otbImage.h"
#include "otbVectorImage.h"
#include "otbImportVectorImageFilter.h"
// Software Guide : EndCodeSnippet
#include "otbImageFileWriter.h"
......@@ -93,7 +92,6 @@ int main(int argc, char * argv[])
// Software Guide : BeginCodeSnippet
typedef otb::ImportVectorImageFilter< ImageType > ImportFilterType;
// Software Guide : EndCodeSnippet
......@@ -189,8 +187,6 @@ int main(int argc, char * argv[])
const unsigned int numberOfPixels = size[0] * size[1] * numberOfBands;
PixelType * localBuffer = new PixelType[ numberOfPixels ];
// Software Guide : EndCodeSnippet
const double radius = 80.0;
......@@ -224,7 +220,6 @@ int main(int argc, char * argv[])
length++;
}
}
// Software Guide : EndCodeSnippet
......
......@@ -58,13 +58,11 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
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;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -77,10 +75,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::ImageList< InputImageType > ImageListType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -93,11 +88,9 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(inputFilename);
reader->Update();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -107,9 +100,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
ImageListType::Pointer imageList = ImageListType::New();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -120,9 +111,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
imageList->PushBack(reader->GetOutput());
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -136,13 +125,11 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
// Getting the image from the list and writing it to file
WriterType::Pointer writer = WriterType::New();
writer->SetFileName(outputFilename);
writer->SetInput(imageList->Back());
writer->Update();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......
......@@ -158,7 +158,6 @@ int main( int , char * argv[] )
std::cout << "Blue = "
<< itk::NumericTraits<PixelType::ValueType>::PrintType(blue)
<< std::endl;
// Software Guide : EndCodeSnippet
// Lets repeat that both \code{SetPixel()} and \code{GetPixel()} are
......
......@@ -100,10 +100,8 @@ int main(int, char *[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
image->SetNumberOfComponentsPerPixel(4);
image->Allocate();
// Software Guide : EndCodeSnippet
......
......@@ -159,7 +159,6 @@ int main(int, char *[])
{
mesh->SetCellData( cellId, static_cast<PixelType>( cellId * cellId ) );
}
// Software Guide : EndCodeSnippet
......
......@@ -95,7 +95,6 @@ int main(int, char *[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
const bool found = pointSet->GetPointData( dataId, & value );
if ( found )
{
......
......@@ -91,7 +91,6 @@ int main(int argc, char * argv [] )
// Software Guide : BeginCodeSnippet
ImageType::ConstPointer image = reader->GetOutput();
......@@ -125,9 +124,6 @@ int main(int argc, char * argv [] )
image->TransformPhysicalPointToContinuousIndex( point, cindex );
path->AddVertex( cindex );
// Software Guide : EndCodeSnippet
return EXIT_SUCCESS;
......
......@@ -48,7 +48,6 @@
// Software Guide : BeginCodeSnippet
#include "otbKeyPointSetsMatchingFilter.h"
#include "otbImageToSIFTKeyPointSetFilter.h"
......@@ -62,8 +61,6 @@
#ifdef _MSC_VER
#pragma warning(pop)
#endif
// Software Guide : EndCodeSnippet
#include "otbImage.h"
......@@ -107,13 +104,11 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef double RealType;
typedef unsigned char OutputPixelType;
typedef otb::Image<RealType,Dimension> ImageType;
typedef otb::Image<OutputPixelType,Dimension> OutputImageType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -123,10 +118,8 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::VariableLengthVector<RealType> RealVectorType;
typedef itk::PointSet<RealVectorType,Dimension> PointSetType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -135,10 +128,8 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::ImageToSIFTKeyPointSetFilter<ImageType,PointSetType>
ImageToSIFTKeyPointSetFilterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -149,7 +140,6 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::Statistics::EuclideanDistance<RealVectorType> DistanceType;
typedef otb::KeyPointSetsMatchingFilter<PointSetType, DistanceType>
EuclideanDistanceMatchingFilterType;
......@@ -161,7 +151,6 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef PointSetType::PointType PointType;
typedef std::pair<PointType,PointType> MatchType;
typedef std::vector<MatchType> MatchVectorType;
......@@ -172,7 +161,6 @@ int main (int argc, char* argv[])
typedef PointsContainerType::Iterator PointsIteratorType;
typedef PointSetType::PointDataContainer PointDataContainerType;
typedef PointDataContainerType::Iterator PointDataIteratorType;
// Software Guide : EndCodeSnippet
......@@ -183,9 +171,7 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::ImageFileReader<ImageType> ReaderType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -196,7 +182,6 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
ReaderType::Pointer fixedReader = ReaderType::New();
ReaderType::Pointer movingReader = ReaderType::New();
......@@ -204,7 +189,6 @@ int main (int argc, char* argv[])
movingReader->SetFileName(movingfname);
fixedReader->UpdateOutputInformation();
movingReader->UpdateOutputInformation();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -214,14 +198,12 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
ImageToSIFTKeyPointSetFilterType::Pointer filter1 =
ImageToSIFTKeyPointSetFilterType::New();
ImageToSIFTKeyPointSetFilterType::Pointer filter2 =
ImageToSIFTKeyPointSetFilterType::New();
EuclideanDistanceMatchingFilterType::Pointer euclideanMatcher =
EuclideanDistanceMatchingFilterType::New();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -230,7 +212,6 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
filter1->SetInput( fixedReader->GetOutput() );
filter2->SetInput( movingReader->GetOutput() );
......@@ -255,7 +236,6 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
euclideanMatcher->SetInput1(filter1->GetOutput());
euclideanMatcher->SetInput2(filter2->GetOutput());
......@@ -263,7 +243,6 @@ int main (int argc, char* argv[])
euclideanMatcher->SetUseBackMatching(useBackMatching);
euclideanMatcher->Update();
// Software Guide : EndCodeSnippet
......@@ -275,10 +254,8 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
LandmarkListType::Pointer landmarkList;
landmarkList = euclideanMatcher->GetOutput();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -336,7 +313,6 @@ int main (int argc, char* argv[])
// Software Guide : BeginCodeSnippet
ResampleFilterType::Pointer resampler = ResampleFilterType::New();
resampler->SetInput( movingReader->GetOutput() );
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -374,7 +350,6 @@ int main (int argc, char* argv[])
resampler->SetOutputOrigin( fixedImage->GetOrigin() );
resampler->SetOutputSpacing( fixedImage->GetSpacing() );
resampler->SetDefaultPixelValue( 100 );
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......
......@@ -48,7 +48,6 @@
// Software Guide : BeginCodeSnippet
#include "otbKeyPointSetsMatchingFilter.h"
#include "otbSiftFastImageFilter.h"
// Disabling deprecation warning if on visual
......@@ -63,7 +62,6 @@
#endif
#include "itkWarpImageFilter.h"
// Software Guide : EndCodeSnippet
#include "otbImage.h"
......@@ -94,13 +92,11 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef double RealType;
typedef unsigned char OutputPixelType;
typedef otb::Image<RealType,Dimension> ImageType;
typedef otb::Image<OutputPixelType,Dimension> OutputImageType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -110,10 +106,8 @@ int main (int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::VariableLengthVector<RealType> RealVectorType;
typedef itk::PointSet<RealVectorType,Dimension> PointSetType;