Commit 7e71c7e2 authored by Emmanuel Christophe's avatar Emmanuel Christophe

STYLE: formatting indentation (Example)

parent 919468e8
......@@ -59,11 +59,11 @@
int main(int argc, char * argv[])
{
if(argc<9)
if (argc<9)
{
std::cout << argv[0] <<" <output_filename> <Longitude Output Orign point>";
std::cout << " <Latitude Output Origin point> <X Output Size> <Y Output size>";
std::cout << " <X Spacing> <Y Spacing> <DEM folder path>" << std::endl;
std::cout << " <Latitude Output Origin point> <X Output Size> <Y Output size>";
std::cout << " <X Spacing> <Y Spacing> <DEM folder path>" << std::endl;
return EXIT_FAILURE;
}
......@@ -119,7 +119,7 @@ int main(int argc, char * argv[])
// Software Guide : BeginCodeSnippet
typedef otb::Functor::ScalarToRainbowRGBPixelFunctor<PixelType> ColorMapFunctorType;
typedef itk::UnaryFunctorImageFilter<ImageType,
RGBImageType, ColorMapFunctorType> ColorMapFilterType;
RGBImageType, ColorMapFunctorType> ColorMapFilterType;
ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New();
colormapper->GetFunctor().SetMaximum(4000);
colormapper->GetFunctor().SetMinimum(0);
......@@ -135,23 +135,23 @@ int main(int argc, char * argv[])
{
writer->Update();
}
catch( itk::ExceptionObject & excep )
catch ( itk::ExceptionObject & excep )
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
}
catch( ... )
catch ( ... )
{
std::cout << "Unknown exception !" << std::endl;
return EXIT_FAILURE;
}
// Software Guide : BeginLatex
// Software Guide : BeginLatex
//
// Figure~\ref{fig:RAINBOW_FILTER} shows effect of applying the filter to
// a gray level image.
//
// \begin{figure}
// \begin{figure}
// \center
// \includegraphics[width=0.44\textwidth]{pretty_DEMToImageGenerator.eps}
// \includegraphics[width=0.44\textwidth]{DEMToRainbowImageGenerator.eps}
......@@ -159,7 +159,7 @@ int main(int argc, char * argv[])
// data (left) and the same area in color representation.}
// \label{fig:RAINBOW_FILTER}
// \end{figure}
// Software Guide : EndLatex
// Software Guide : EndLatex
return EXIT_SUCCESS;
}
......@@ -55,7 +55,7 @@
int main(int argc, char * argv[])
{
if( argc != 4 )
if ( argc != 4 )
{
std::cerr << "Usage: " << argv[0] << " <inputImageFile> ";
std::cerr << " <outputRGBImageFile> <outputScaledImageFile>" << std::endl;
......
......@@ -54,12 +54,12 @@
int main( int argc, char * argv[] )
{
if( argc != 5 )
{
if ( argc != 5 )
{
std::cerr << "Usage: " << argv[0] << " inputImageFile ";
std::cerr << " outputImageFile radius NbLooks" << std::endl;
return EXIT_FAILURE;
}
}
// Software Guide : BeginLatex
//
......
......@@ -66,11 +66,11 @@
// Software Guide : EndCodeSnippet
int main(int argc, char * argv[])
{
if(argc != 12)
{
std::cerr<<"Usage: "<<argv[0]<<" infname filteredfname clusteredfname labeledclusteredfname clusterboundariesfname filteredPretty clusteredPretty spatialRadius rangeRadius minregionsize scale"<<std::endl;
return EXIT_FAILURE;
}
if (argc != 12)
{
std::cerr<<"Usage: "<<argv[0]<<" infname filteredfname clusteredfname labeledclusteredfname clusterboundariesfname filteredPretty clusteredPretty spatialRadius rangeRadius minregionsize scale"<<std::endl;
return EXIT_FAILURE;
}
const char * infname = argv[1];
const char * filteredfname = argv[2];
......@@ -172,7 +172,7 @@ int main(int argc, char * argv[])
// Software Guide : BeginCodeSnippet
filter->SetScale(scale);
// Software Guide : EndCodeSnippet
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
// We can now plug the pipeline and run it.
......@@ -218,7 +218,7 @@ int main(int argc, char * argv[])
typedef PrintableFilterType::OutputImageType OutputImageType;
typedef otb::StreamingImageFileWriter< OutputImageType >
PrettyWriterType;
PrettyWriterType;
PrettyWriterType::Pointer prettyWriter = PrettyWriterType::New();
printableImageFilter->SetInput( filter->GetOutput() );
......
......@@ -71,7 +71,7 @@
int main( int argc, char * argv[] )
{
if( argc != 6 )
if ( argc != 6 )
{
std::cerr << "Usage: " << argv[0] << " <inputImageFile> ";
std::cerr << " <outputImageFile> <RedBand> <GreenBand> <BlueBand>" << std::endl;
......@@ -110,7 +110,7 @@ int main( int argc, char * argv[] )
printableImageFilter->SetChannel(redChannelNumber);
printableImageFilter->SetChannel(greenChannelNumber);
printableImageFilter->SetChannel(blueChannelNumber);
// Software Guide : EndCodeSnippet
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
//
......@@ -119,7 +119,7 @@ int main( int argc, char * argv[] )
//
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
// Software Guide : BeginCodeSnippet
typedef PrintableFilterType::OutputImageType OutputImageType;
typedef otb::StreamingImageFileWriter< OutputImageType > WriterType;
// Software Guide : EndCodeSnippet
......
......@@ -47,7 +47,7 @@
int main( int argc, char * argv[] )
{
if( argc != 4 )
if ( argc != 4 )
{
std::cerr << "Usage: " << argv[0] << " <inputImageFile> ";
std::cerr << " <outputRescaledImageFile> <outputCastedImageFile>" << std::endl;
......
......@@ -25,13 +25,13 @@
void RegisterTests()
{
REGISTER_TEST(LeeImageFilterTest);
REGISTER_TEST(DEMToRainbowExampleTest);
REGISTER_TEST(ScalingFilterExampleTest);
REGISTER_TEST(PrintableImageFilterExample1Test);
REGISTER_TEST(PrintableImageFilterExample2Test);
REGISTER_TEST(IndexedToRGBExampleTest);
REGISTER_TEST(MeanShiftVectorImageFilterExampleTest);
REGISTER_TEST(LeeImageFilterTest);
REGISTER_TEST(DEMToRainbowExampleTest);
REGISTER_TEST(ScalingFilterExampleTest);
REGISTER_TEST(PrintableImageFilterExample1Test);
REGISTER_TEST(PrintableImageFilterExample2Test);
REGISTER_TEST(IndexedToRGBExampleTest);
REGISTER_TEST(MeanShiftVectorImageFilterExampleTest);
}
#undef main
......
......@@ -85,13 +85,13 @@ public:
TOutput result = 0.0;
for(unsigned long pos = 0; pos< itA.Size(); ++pos)
{
for (unsigned long pos = 0; pos< itA.Size(); ++pos)
{
result += static_cast<TOutput>(itA.GetPixel(pos)-itB.GetPixel(pos));
}
}
return static_cast<TOutput>( result/itA.Size() );
}
};
......@@ -118,22 +118,22 @@ public:
// Software Guide : BeginCodeSnippet
template <class TInputImage1, class TInputImage2, class TOutputImage>
class ITK_EXPORT MyChangeDetectorImageFilter :
public otb::BinaryFunctorNeighborhoodImageFilter<
TInputImage1,TInputImage2,TOutputImage,
MyChangeDetector<
typename itk::ConstNeighborhoodIterator<TInputImage1>,
typename itk::ConstNeighborhoodIterator<TInputImage2>,
typename TOutputImage::PixelType> >
public otb::BinaryFunctorNeighborhoodImageFilter<
TInputImage1,TInputImage2,TOutputImage,
MyChangeDetector<
typename itk::ConstNeighborhoodIterator<TInputImage1>,
typename itk::ConstNeighborhoodIterator<TInputImage2>,
typename TOutputImage::PixelType> >
{
public:
/** Standard class typedefs. */
typedef MyChangeDetectorImageFilter Self;
typedef typename otb::BinaryFunctorNeighborhoodImageFilter<
TInputImage1,TInputImage2,TOutputImage,
MyChangeDetector<
typename itk::ConstNeighborhoodIterator<TInputImage1>,
typename itk::ConstNeighborhoodIterator<TInputImage2>,
typename TOutputImage::PixelType>
TInputImage1,TInputImage2,TOutputImage,
MyChangeDetector<
typename itk::ConstNeighborhoodIterator<TInputImage1>,
typename itk::ConstNeighborhoodIterator<TInputImage2>,
typename TOutputImage::PixelType>
> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
......@@ -167,12 +167,12 @@ private:
int main(int argc, char* argv[] )
{
if( argc < 5 )
{
if ( argc < 5 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile1 inputImageFile2 radius outputImageFile " << std::endl;
return -1;
}
}
// Define the dimension of the images
const unsigned int Dimension = 2;
......@@ -208,7 +208,7 @@ int main(int argc, char* argv[] )
typedef otb::ImageFileReader< InputImageType2 > ReaderType2;
typedef otb::ImageFileWriter< OutputImageType > WriterType;
typedef itk::RescaleIntensityImageFilter< ChangeImageType,
OutputImageType > RescalerType;
OutputImageType > RescalerType;
// Software Guide : EndCodeSnippet
......@@ -220,9 +220,9 @@ int main(int argc, char* argv[] )
// Software Guide : BeginCodeSnippet
typedef MyChangeDetectorImageFilter<
InputImageType1,
InputImageType2,
ChangeImageType > FilterType;
InputImageType1,
InputImageType2,
ChangeImageType > FilterType;
// Software Guide : EndCodeSnippet
......@@ -266,15 +266,15 @@ int main(int argc, char* argv[] )
try
{
{
writer->Update();
}
catch( itk::ExceptionObject & err )
{
}
catch ( itk::ExceptionObject & err )
{
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
return -1;
}
}
// Software Guide : BeginLatex
//
......
......@@ -57,12 +57,12 @@
int main(int argc, char* argv[] )
{
if( argc < 5 )
{
if ( argc < 5 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile1 inputImageFile2 outputImageFile radius" << std::endl;
return -1;
}
}
// Define the dimension of the images
const unsigned int Dimension = 2;
......@@ -110,7 +110,7 @@ int main(int argc, char* argv[] )
// Software Guide : BeginCodeSnippet
typedef itk::ShiftScaleImageFilter< ChangeImageType,
OutputImageType > RescalerType;
OutputImageType > RescalerType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -123,9 +123,9 @@ int main(int argc, char* argv[] )
// Software Guide : BeginCodeSnippet
typedef otb::CorrelationChangeDetector<
InputImageType1,
InputImageType2,
ChangeImageType > FilterType;
InputImageType1,
InputImageType2,
ChangeImageType > FilterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -202,15 +202,15 @@ int main(int argc, char* argv[] )
try
{
{
writer->Update();
}
catch( itk::ExceptionObject & err )
{
}
catch ( itk::ExceptionObject & err )
{
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
return -1;
}
}
// Software Guide : BeginLatex
// Figure \ref{fig:RESCORRCHDET} shows the result of the change
......
......@@ -72,12 +72,12 @@
int main(int argc, char* argv[] )
{
if( argc < 5 )
{
if ( argc < 5 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile1 inputImageFile2 outputImageFile radius" << std::endl;
return -1;
}
}
// Define the dimension of the images
const unsigned int Dimension = 2;
......@@ -124,9 +124,9 @@ int main(int argc, char* argv[] )
// Software Guide : BeginCodeSnippet
typedef itk::AbsImageFilter< ChangeImageType,
ChangeImageType > AbsType;
ChangeImageType > AbsType;
typedef itk::RescaleIntensityImageFilter< ChangeImageType,
OutputImageType > RescalerType;
OutputImageType > RescalerType;
// Software Guide : EndCodeSnippet
......@@ -140,9 +140,9 @@ int main(int argc, char* argv[] )
// Software Guide : BeginCodeSnippet
typedef otb::MeanDifferenceImageFilter<
InputImageType1,
InputImageType2,
ChangeImageType > FilterType;
InputImageType1,
InputImageType2,
ChangeImageType > FilterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -222,15 +222,15 @@ int main(int argc, char* argv[] )
try
{
{
writer->Update();
}
catch( itk::ExceptionObject & err )
{
}
catch ( itk::ExceptionObject & err )
{
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
return -1;
}
}
// Software Guide : BeginLatex
// Figure \ref{fig:RESDIFFCHDET} shows the result of the change
// detection by difference of local means.
......
......@@ -26,12 +26,12 @@
int main(int argc, char* argv[] )
{
if( argc < 5 )
{
if ( argc < 5 )
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " inputImageFile1 inputImageFile2 radius outputImageFile " << std::endl;
return -1;
}
}
// Define the dimension of the images
const unsigned int Dimension = 2;
......@@ -49,15 +49,15 @@ int main(int argc, char* argv[] )
typedef otb::StreamingImageFileWriter< OutputImageType > WriterType;
typedef itk::ShiftScaleImageFilter< ChangeImageType,
OutputImageType > RescalerType;
OutputImageType > RescalerType;
// Declare the type for the filter
typedef otb::JoinHistogramMIImageFilter<
InputImageType1,
InputImageType2,
ChangeImageType > FilterType;
InputImageType1,
InputImageType2,
ChangeImageType > FilterType;
ReaderType1::Pointer reader1 = ReaderType1::New();
......@@ -78,8 +78,8 @@ int main(int argc, char* argv[] )
rescaler->SetShift( itk::NumericTraits< InternalPixelType >::min());
float scale = itk::NumericTraits< OutputPixelType >::max()/ 100.0;
/*float(itk::NumericTraits< OutputPixelType >::max()+
itk::NumericTraits< InternalPixelType >::min());*/
/*float(itk::NumericTraits< OutputPixelType >::max()+
itk::NumericTraits< InternalPixelType >::min());*/
rescaler->SetScale( scale );
......@@ -101,15 +101,15 @@ int main(int argc, char* argv[] )
try
{
{
writer->Update();
}
catch( itk::ExceptionObject & err )
{
}
catch ( itk::ExceptionObject & err )
{
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
return -1;
}
}
return EXIT_SUCCESS;
......
......@@ -31,112 +31,113 @@
int main ( int argc, char * argv[] )
{
try {
typedef otb::CommandLineArgumentParser ParserType;
ParserType::Pointer parser = ParserType::New();
parser->AddOption( "--InputImage1", "Give Before image", "-1", 1, true );
parser->AddOption( "--InputImage2", "Give After image", "-2", 1, true );
parser->AddOption( "--Roi", "Give ROI image", "-r", 1, true );
parser->AddOption( "--winSize", "Sliding window size (def. 35)", "-w", 1, false );
parser->AddOutputImage();
typedef otb::CommandLineArgumentParseResult ParserResultType;
ParserResultType::Pointer parseResult = ParserResultType::New();
try
{
parser->ParseCommandLine(argc,argv,parseResult);
}
catch( itk::ExceptionObject & err )
{
std::string descriptionException = err.GetDescription();
if ( descriptionException.find("ParseCommandLine(): Help Parser")
!= std::string::npos )
return EXIT_SUCCESS;
if(descriptionException.find("ParseCommandLine(): Version Parser")
!= std::string::npos )
return EXIT_SUCCESS;
return EXIT_FAILURE;
}
/*
* declaration des types
*/
const unsigned int Dimension = 2;
typedef double InputPixelType;
typedef unsigned char TrainingPixelType;
typedef otb::Image< InputPixelType, Dimension > ImageType;
typedef otb::ImageFileReader< ImageType > ReaderType;
typedef otb::Image< TrainingPixelType, Dimension > TrainingImageType;
typedef otb::ImageFileReader< TrainingImageType > TrainingReaderType;
/*
* Accs aux paramtres
*/
const char * inputImageFileName1 = parseResult->GetParameterString("--InputImage1").c_str();
const char * inputImageFileName2 = parseResult->GetParameterString("--InputImage2").c_str();
const char * inputTrainingImageFileName = parseResult->GetParameterString("--Roi").c_str();
const char * outputImageFileName = parseResult->GetOutputImage().c_str();
int winSize = 35;
if ( parseResult->IsOptionPresent("--winSize") )
winSize = parseResult->GetParameterInt("--winSize");
/*
* JustDoIt
*/
ImageType::Pointer img1 = ImageType::New();
ReaderType::Pointer reader1 = ReaderType::New();
reader1->SetFileName( inputImageFileName1 );
//reader1->Update();
img1 = reader1->GetOutput();
ImageType::Pointer img2 = ImageType::New();
ReaderType::Pointer reader2 = ReaderType::New();