Commit e82a5ec5 authored by Julien Malik's avatar Julien Malik

STYLE: remove trailing whitespace/tab from Examples

parent e0ad19ed
......@@ -124,7 +124,7 @@ int main( int argc, char* argv[])
reader->UpdateOutputInformation();
// Software Guide : BeginLatex
//
// We need now to extract now each band from the input \doxygen{otb}{VectorImage},
......@@ -146,7 +146,7 @@ int main( int argc, char* argv[])
filter->SetNthInput(j, imageList->GetOutput()->GetNthElement(j));
}
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// Now we can define the mathematical expression to perform on the layers (b1, b2, b3, b4).
......@@ -197,15 +197,15 @@ int main( int argc, char* argv[])
typedef otb::Image<unsigned char, 2> OutputPrettyImageType;
typedef otb::ImageFileWriter<OutputPrettyImageType> PrettyImageFileWriterType;
typedef itk::CastImageFilter<OutputImageType, OutputPrettyImageType> CastImageFilterType;
PrettyImageFileWriterType::Pointer prettyWriter = PrettyImageFileWriterType::New();
CastImageFilterType::Pointer caster = CastImageFilterType::New();
caster->SetInput(filter->GetOutput());
prettyWriter->SetInput(caster->GetOutput());
prettyWriter->SetFileName(argv[3]);
prettyWriter->Update();
return EXIT_SUCCESS;
}
......@@ -103,13 +103,13 @@ int main(int argc, char* argv[])
typedef otb::ImageFileWriter<OutputImageType> WriterType;
// Software Guide : EndCodeSnippet
// 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;
// The \doxygen{otb}{MultivariateAlterationDetectorImageFilter} is templated over
// the type of the input images and the type of the generated change
// image.
......@@ -171,11 +171,11 @@ int main(int argc, char* argv[])
// And then we can trigger the pipeline update, as usual.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
writer->Update();
// Software Guide : EndCodeSnippet
}
catch (itk::ExceptionObject& err)
{
......
......@@ -103,13 +103,13 @@ int main(int argc, char* argv[])
typedef otb::ImageFileWriter<OutputImageType> WriterType;
// Software Guide : EndCodeSnippet
// 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;
// The \doxygen{otb}{MultivariateAlterationDetectorImageFilter} is templated over
// the type of the input images and the type of the generated change
// image.
......@@ -171,11 +171,11 @@ int main(int argc, char* argv[])
// And then we can trigger the pipeline update, as usual.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
writer->Update();
// Software Guide : EndCodeSnippet
}
catch (itk::ExceptionObject& err)
{
......
......@@ -311,21 +311,21 @@ int main(int, char *[])
// Software Guide : BeginCodeSnippet
typedef ClassifierType::MembershipFunctionType MembershipFunctionBaseType;
typedef ClassifierType::MembershipFunctionVectorObjectType::ComponentType ComponentMembershipType;
// Vector Containing the membership function used
ComponentMembershipType membershipFunctions;
for (unsigned int i = 0; i < 2; i++)
{
MembershipFunctionType::Pointer curMemshpFunction = MembershipFunctionType::New();
curMemshpFunction->SetMean(meanEstimators[i]->GetMean());
curMemshpFunction->SetCovariance(covarianceEstimators[i]->GetCovarianceMatrix());
// cast the GaussianMembershipFunction in a
// itk::MembershipFunctionBase
// itk::MembershipFunctionBase
membershipFunctions.push_back(dynamic_cast<const MembershipFunctionBaseType* >(curMemshpFunction.GetPointer()));
}
ClassifierType::MembershipFunctionVectorObjectPointer membershipVectorObject = ClassifierType::MembershipFunctionVectorObjectType::New();
membershipVectorObject->Set(membershipFunctions);
......
......@@ -60,7 +60,7 @@ int main(int argc, char * argv[])
typedef unsigned char IOLabelPixelType; // 8 bits
const unsigned int Dimension = 2;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// Thus, both input and output images are single band labeled images,
......@@ -68,7 +68,7 @@ int main(int argc, char * argv[])
// (unsigned char).
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::Image<IOLabelPixelType, Dimension> IOLabelImageType;
// Software Guide : EndCodeSnippet
......@@ -84,7 +84,7 @@ int main(int argc, char * argv[])
// (\doxygen{itk}{BinaryBallStructuringElement}).
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
// Neighborhood majority voting filter type
typedef otb::NeighborhoodMajorityVotingImageFilter<IOLabelImageType>
......@@ -92,7 +92,7 @@ int main(int argc, char * argv[])
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// Since the \doxygen{otb}{NeighborhoodMajorityVotingImageFilter} is a
......@@ -104,7 +104,7 @@ int main(int argc, char * argv[])
// structuring elements such as ovals.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
// Binary ball Structuring Element type
typedef NeighborhoodMajorityVotingFilterType::KernelType StructuringType;
......@@ -122,11 +122,11 @@ int main(int argc, char * argv[])
typedef otb::ImageFileReader<IOLabelImageType> ReaderType;
typedef otb::ImageFileWriter<IOLabelImageType> WriterType;
// Software Guide : EndCodeSnippet
const char * inputFileName = argv[1];
const char * outputFileName = argv[2];
// Software Guide : BeginLatex
//
......@@ -139,38 +139,38 @@ int main(int argc, char * argv[])
// Neighborhood majority voting filter
NeighborhoodMajorityVotingFilterType::Pointer NeighMajVotingFilter;
NeighMajVotingFilter = NeighborhoodMajorityVotingFilterType::New();
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(inputFileName);
// Software Guide : EndCodeSnippet
std::string KeepOriginalLabelBoolStr = argv[3];
unsigned int radiusX = atoi(argv[4]);
unsigned int radiusY = atoi(argv[5]);
IOLabelPixelType noDataValue = atoi(argv[6]);
IOLabelPixelType undecidedValue = atoi(argv[7]);
// Software Guide : BeginLatex
//
// The ball shaped structuring element seBall is instantiated and its
// two radii along X and Y are initialized.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
StructuringType seBall;
RadiusType rad;
rad[0] = radiusX;
rad[1] = radiusY;
seBall.SetRadius(rad);
seBall.CreateStructuringElement();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// Then, this ball shaped neighborhood is used as the kernel structuring element
......@@ -208,7 +208,7 @@ int main(int argc, char * argv[])
// Software Guide : BeginCodeSnippet
NeighMajVotingFilter->SetLabelForUndecidedPixels(undecidedValue);
if (KeepOriginalLabelBoolStr.compare("true") == 0)
{
NeighMajVotingFilter->SetKeepOriginalLabelBool(true);
......@@ -230,12 +230,12 @@ int main(int argc, char * argv[])
// Software Guide : BeginCodeSnippet
NeighMajVotingFilter->SetInput(reader->GetOutput());
WriterType::Pointer writer = WriterType::New();
writer->SetFileName(outputFileName);
writer->SetInput(NeighMajVotingFilter->GetOutput());
writer->Update();
// Software Guide : EndCodeSnippet
return EXIT_SUCCESS;
}
......@@ -297,7 +297,7 @@ int main()
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::Statistics::DistanceToCentroidMembershipFunction<
typedef itk::Statistics::DistanceToCentroidMembershipFunction<
MeasurementVectorType > MembershipFunctionType;
typedef itk::Statistics::EuclideanDistanceMetric< MeasurementVectorType > DistanceMetricType;
......
......@@ -273,7 +273,7 @@ int main(int argc, char * argv[])
{
MembershipFunctionPointer membershipFunction =
MembershipFunctionType::New();
membershipFunction->SetMeasurementVectorSize(reader->GetOutput()->GetNumberOfComponentsPerPixel());
centroid[0] = atof(argv[i + numberOfArgumentsBeforeMeans]);
......
......@@ -53,12 +53,12 @@ int main(int argc, char* argv[])
char * outfname = argv[2];
char * inpretty = argv[3];
char * outpretty = argv[4];
// Software Guide : BeginLatex
// We then define the types for the input image and the
// output image.
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::VectorImage<unsigned short, 2> InputImageType;
typedef otb::VectorImage<double, 2> OutputImageType;
......@@ -132,7 +132,7 @@ int main(int argc, char* argv[])
// And then we can trigger the pipeline update, as usual.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
writer->Update();
// Software Guide : EndCodeSnippet
......
......@@ -142,22 +142,22 @@ int main(int argc, char* argv[])
// (which may not be square) has to be given.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::PCAImageFilter< ImageType, ImageType,
otb::Transform::INVERSE > InvPCAFilterType;
InvPCAFilterType::Pointer invFilter = InvPCAFilterType::New();
invFilter->SetInput(pcafilter->GetOutput());
invFilter->SetTransformationMatrix(pcafilter->GetTransformationMatrix());
WriterType::Pointer invWriter = WriterType::New();
invWriter->SetFileName(outputInverseFilename );
invWriter->SetInput(invFilter->GetOutput() );
invWriter->Update();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
// Figure~\ref{fig:PCA_FILTER} shows the result of applying forward
// and reverse PCA transformation to a 8 bands Worldview2 image.
......
......@@ -74,7 +74,7 @@ int main(int argc, char * argv[])
// Software Guide : BeginCodeSnippet
typedef otb::ComplexMomentsImageFunction<InputImageType> CMType;
typedef CMType::OutputType OutputType;
CMType::Pointer cmFunction = CMType::New();
// Software Guide : EndCodeSnippet
......
......@@ -128,7 +128,7 @@ int main(int argc, char * argv[])
// Software Guide : BeginCodeSnippet
MomentType Result = hmFunction->EvaluateAtIndex(center);
for (unsigned int j=0; j<7; ++j)
{
std::cout << "The moment of order " << j+1 <<
......
......@@ -76,7 +76,7 @@ int main(int argc, char * argv[])
reader->SetFileName(infname);
reader->GenerateOutputInformation();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We define now the type for the segment detector filter. It is
......@@ -93,7 +93,7 @@ int main(int argc, char * argv[])
LsdFilterType::Pointer lsdFilter = LsdFilterType::New();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// In order to be able to display the results, we will draw the
......@@ -117,7 +117,7 @@ int main(int argc, char * argv[])
ImageType, FunctorType> BlendingFilterType;
BlendingFilterType::Pointer blendingFilter = BlendingFilterType::New();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We can now define the type for the writer, instantiate it and set
......@@ -130,7 +130,7 @@ int main(int argc, char * argv[])
WriterType::Pointer writer = WriterType::New();
writer->SetFileName(outfname);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We plug the pipeline.
......@@ -147,7 +147,7 @@ int main(int argc, char * argv[])
blendingFilter->SetInput1(reader->GetOutput());
blendingFilter->SetInput2(vectorDataRenderer->GetOutput());
blendingFilter->GetFunctor().SetAlpha(0.25);
writer->SetInput(blendingFilter->GetOutput());
// Software Guide : EndCodeSnippet
......
......@@ -102,7 +102,7 @@ int main(int argc, char * argv[])
// Software Guide : BeginCodeSnippet
typedef otb::LineSegmentDetector<ImageType, PrecisionType> LsdFilterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We can finally define the type for the right angle detection
......@@ -115,7 +115,7 @@ int main(int argc, char * argv[])
typedef otb::VectorDataToRightAngleVectorDataFilter<VectorDataType>
RightAngleFilterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We instantiate the line segment detector and the right angle detector.
......@@ -172,10 +172,10 @@ int main(int argc, char * argv[])
typedef itk::BinaryFunctorImageFilter<ImageType, ImageType,
ImageType, FunctorType> BlendingFilterType;
BlendingFilterType::Pointer blendingFilter = BlendingFilterType::New();
vectorDataRenderer->SetInput(1, lsdFilter->GetOutput());
vectorDataRenderer->SetInput(rightAngleFilter->GetOutput());
vectorDataRenderer->SetSize(reader->GetOutput()->GetLargestPossibleRegion().GetSize());
vectorDataRenderer->SetOrigin(reader->GetOutput()->GetOrigin());
vectorDataRenderer->SetSpacing(reader->GetOutput()->GetSpacing());
......
......@@ -57,7 +57,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef unsigned char PixelType;
typedef otb::Image<PixelType, 2> ImageType;
typedef otb::VectorData<> VectorDataType;
......@@ -107,7 +107,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
projection->SetOutputProjectionRef(projectionRefWkt);
// Software Guide : EndCodeSnippet
......@@ -142,7 +142,7 @@ int main(int argc, char * argv[])
region.SetSize(sizeInUnit);
region.SetOrigin(origin);
region.SetRegionProjection(projectionRefWkt);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -166,14 +166,14 @@ int main(int argc, char * argv[])
// \doxygen{otb}{VectorDataToMapFilter}.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
vectorDataRendering->SetInput(extractROI->GetOutput());
vectorDataRendering->SetSize(size);
vectorDataRendering->SetOrigin(origin);
vectorDataRendering->SetSpacing(spacing);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -182,11 +182,11 @@ int main(int argc, char * argv[])
// appropriate rendering style.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
vectorDataRendering->SetRenderingStyleType(VectorDataToMapFilterType::Binary);
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// The rendering filter will return a binary image with label 0 when
......@@ -197,25 +197,25 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::RGBAPixel<unsigned char> RGBAPixelType;
typedef otb::Image<RGBAPixelType, 2> RGBAImageType;
typedef itk::ChangeLabelImageFilter<ImageType,
RGBAImageType> ChangeLabelImageFilterType;
ChangeLabelImageFilterType::Pointer
changeLabelFilter = ChangeLabelImageFilterType::New();
RGBAPixelType green, blue;
green.SetAlpha(255);
green.SetGreen(255);
blue.SetAlpha(255);
blue.SetBlue(255);
changeLabelFilter->SetChange(0, blue);
changeLabelFilter->SetChange(255, green);
changeLabelFilter->SetInput(vectorDataRendering->GetOutput());
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -226,7 +226,7 @@ int main(int argc, char * argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::ImageFileWriter<RGBAImageType> WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetInput(changeLabelFilter->GetOutput());
......
......@@ -76,14 +76,14 @@ int main(int argc, char * argv[])
typedef otb::ImageFileReader<ImageType> ReaderType;
typedef otb::ImageFileWriter<ImageType> WriterType;
// Software Guide : EndCodeSnippet
typedef otb::VectorRescaleIntensityImageFilter<ImageType, ImageType> RescalerType;
typedef otb::StreamingStatisticsVectorImageFilter<ImageType> StreamingStatisticsVectorImageFilterType;
typedef otb::VectorImageToMatrixImageFilter<ImageType> VectorImageToMatrixImageFilterType;
typedef vnl_vector<double> VectorType;
typedef vnl_matrix<double> MatrixType;
// Software Guide : BeginLatex
//
// We instantiate now the image reader and we set the image file name.
......@@ -94,9 +94,9 @@ int main(int argc, char * argv[])
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(infname);
// Software Guide : EndCodeSnippet
reader->UpdateOutputInformation();
// Software Guide : BeginLatex
//
......@@ -105,17 +105,17 @@ int main(int argc, char * argv[])
// \doxygen{otb}{VectorRescaleIntensityImageFilter}.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
RescalerType::Pointer rescaler = RescalerType::New();
rescaler->SetInput(reader->GetOutput());
ImageType::PixelType minPixel, maxPixel;
minPixel.SetSize(reader->GetOutput()->GetNumberOfComponentsPerPixel());
maxPixel.SetSize(reader->GetOutput()->GetNumberOfComponentsPerPixel());
minPixel.Fill(0.);
maxPixel.Fill(1.);
rescaler->SetOutputMinimum(minPixel);
rescaler->SetOutputMaximum(maxPixel);
// Software Guide : EndCodeSnippet
......@@ -132,33 +132,33 @@ int main(int argc, char * argv[])
// Software Guide : BeginCodeSnippet
typedef otb::VCAImageFilter<ImageType> VCAFilterType;
VCAFilterType::Pointer vca = VCAFilterType::New();
vca->SetNumberOfEndmembers(estimateNumberOfEndmembers);
vca->SetInput(rescaler->GetOutput());
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We transform the output estimate endmembers to a matrix representation
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
VectorImageToMatrixImageFilterType::Pointer
endMember2Matrix = VectorImageToMatrixImageFilterType::New();
endMember2Matrix->SetInput(vca->GetOutput());
endMember2Matrix->Update();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We can now procedd to the unmixing algorithm.Parameters
// needed are the input image and the endmembers matrix.
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::UnConstrainedLeastSquareImageFilter<ImageType, ImageType, double> UCLSUnmixingFilterType;
UCLSUnmixingFilterType::Pointer
......@@ -168,7 +168,7 @@ int main(int argc, char * argv[])
// Software Guide : EndCodeSnippet
unmixer->SetNumberOfThreads(1); // FIXME : currently buggy
// Software Guide : BeginLatex
//
// We now instantiate the writer and set the file name for the
......@@ -182,7 +182,7 @@ int main(int argc, char * argv[])
writer->SetFileName(outfname);
writer->Update();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
// Figure~\ref{fig:UNMIXING_FILTER} shows the result of applying unmixing
// to an AVIRIS image (220 bands). This dataset is freely available
......
......@@ -65,7 +65,7 @@ int main(int argc, char* argv[])
std::cerr << "Inconsistent GCPs description!" << std::endl;
return EXIT_FAILURE;
}
// Software Guide : BeginLatex
//
// We will start by defining the types for the image and the image file
......@@ -78,7 +78,7 @@ int main(int argc, char* argv[])
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]);
otb::DEMHandler::Instance()->OpenDEMDirectory(argv[6]);
// Software Guide : EndCodeSnippet
......@@ -136,7 +136,7 @@ int main(int argc, char* argv[])
rpcEstimator->GetOutput()->UpdateOutputInformation();
std::cout << "Residual ground error: " << rpcEstimator->GetRMSGroundError() << std::endl;
// Software Guide : BeginLatex
//
// The last step of the chain, is to export the image to a Google
......@@ -202,7 +202,7 @@ int main(int argc, char* argv[])
mapWriter->SetShapeIndexPath(argv[4]);
mapWriter->SetCGIPath(argv[5]);
mapWriter->SetSRID(4326);
mapWriter->Update();
// Software Guide : EndCodeSnippet
......
......@@ -113,14 +113,14 @@ int main(int argc, char *argv[])
itk::AddImageFilter<ImageType, ImageType, ImageType>::Pointer adder
= itk::AddImageFilter<ImageType, ImageType, ImageType>::New();
// Allocate the noise image
ImageType::Pointer noise = ImageType::New();
ImageType::RegionType noiseRegion;
noiseRegion.SetSize(size);
noise->SetRegions(noiseRegion);
noise->Allocate();
// Fill the noise image
itk::ImageRegionIterator<ImageType> itNoise(noise, noiseRegion);
itNoise.GoToBegin();
......@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
double rnd = 0.;
double dMin = -.7;
double dMax = .8;
while(!itNoise.IsAtEnd())
{
sample_seed = ( sample_seed * 16807 ) % 2147483647L;
......
......@@ -66,7 +66,7 @@ int main(int argc, char* argv[])
typedef otb::Image<InputImageType::InternalPixelType, 2> ImageType;
typedef otb::VectorData<double, 2> VectorDataType;
typedef otb::ImageFileReader<InputImageType> InputReaderType;
typedef otb::VectorDataFileReader<VectorDataType> VectorDataReaderType;
......@@ -91,7 +91,7 @@ int main(int argc, char* argv[])
InputReaderType::Pointer inputReader = InputReaderType::New();
inputReader->SetFileName(inputImageFileName);
InputImageType::Pointer image = inputReader->GetOutput();
image->UpdateOutputInformation();
......
......@@ -76,7 +76,7 @@ int main(int argc, char* argv[])
std::cerr << " segmentationGT segmentationMS outputAttributeImage" << std::endl;
return EXIT_FAILURE;
}
// Software Guide : BeginLatex
// The filters \doxygen{otb}{HooverMatrixFilter} and \doxygen{otb}{HooverInstanceFilter}
// are designed to handle \doxygen{itk}{LabelMap} images, made with \doxygen{otb}{AttributesMapLabelObject}.
......@@ -89,53 +89,53 @@ int main(int argc, char* argv[])
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;
// Software Guide : EndCodeSnippet