Skip to content
Snippets Groups Projects
Commit 81b1fa03 authored by Thomas Feuvrier's avatar Thomas Feuvrier
Browse files

nomsg

parent cac782d8
No related branches found
No related tags found
No related merge requests found
/*=========================================================================
Programme : OTB (ORFEO ToolBox)
Auteurs : CS - P.Imbo
Language : C++
Date : 26 janvier 2005
Version :
Role : Test la classe qui filtre un image a partir de l'algorithme de FROST
$Id$
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#define MAIN
#include "itkExceptionObject.h"
#include "itkImage.h"
#include "itkImageFileWriter.h"
#include <iostream>
// A supprimer
//#ifndef __otbCAIImageIO_h
//#define __otbCAIImageIO_h
//#endif
//#include "otbCAIImageIO.h"
#include "otbImageFileReader.h"
#include "otbFrostImageFilter.h"
int otbFrostFilter( int argc, char ** argv )
{
try
{
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
unsigned int RadiusX((unsigned int)::atoi(argv[3]));
unsigned int RadiusY((unsigned int)::atoi(argv[4]));
double Deramp ((double)::atof(argv[5]));
typedef unsigned char InputPixelType;
typedef unsigned char OutputPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InputPixelType, Dimension > InputImageType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
typedef otb::ImageFileReader< InputImageType > ReaderType;
typedef itk::ImageFileWriter< OutputImageType > WriterType;
typedef otb::FrostImageFilter< InputImageType,OutputImageType > FilterType;
FilterType::SizeType Radius;
Radius[0]= RadiusX;
Radius[1]= RadiusY;
FilterType::Pointer filtreFrost = FilterType::New();
filtreFrost->SetRadius( Radius );
filtreFrost->SetDeramp( Deramp );
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( inputFilename );
writer->SetFileName( outputFilename );
filtreFrost->SetInput( reader->GetOutput() );
writer->SetInput( filtreFrost->GetOutput() );
writer->Update();
}
catch( itk::ExceptionObject & err )
{
std::cout << "Exception itk::ExceptionObject levee !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
catch( ... )
{
std::cout << "Exception levee inconnue !" << std::endl;
return EXIT_FAILURE;
}
// Software Guide : EndCodeSnippet
//#endif
return EXIT_SUCCESS;
}
/*=========================================================================
Programme : OTB (ORFEO ToolBox)
Auteurs : CS - P.Imbo
Language : C++
Date : 23 janvier 2005
Version :
Role : Test la classe qui filtre un image a partir de l'algorithme de J.S. LEE
$Id$
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#define MAIN
#include "itkExceptionObject.h"
#include "itkImage.h"
#include "itkImageFileWriter.h"
#include <iostream>
// A supprimer
#include "otbCAIImageIO.h"
//#ifndef __otbCAIImageIO_h
//#define __otbCAIImageIO_h
//#endif
#include "otbImageFileReader.h"
#include "otbLeeImageFilter.h"
int otbLeeFilter( int argc, char ** argv )
{
try
{
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
unsigned int RadiusX((unsigned int)::atoi(argv[3]));
unsigned int RadiusY((unsigned int)::atoi(argv[4]));
double NbVues ((double)::atof(argv[5]));
typedef unsigned char InputPixelType;
typedef unsigned char OutputPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InputPixelType, Dimension > InputImageType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
typedef otb::ImageFileReader< InputImageType > ReaderType;
typedef itk::ImageFileWriter< OutputImageType > WriterType;
typedef otb::LeeImageFilter< InputImageType,OutputImageType > FilterType;
FilterType::SizeType Radius;
Radius[0]= RadiusX;
Radius[1]= RadiusY;
FilterType::Pointer filtreLee = FilterType::New();
filtreLee->SetRadius( Radius );
filtreLee->SetNbVues(NbVues);
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( inputFilename );
writer->SetFileName( outputFilename );
filtreLee->SetInput( reader->GetOutput() );
writer->SetInput( filtreLee->GetOutput() );
writer->Update();
}
catch( itk::ExceptionObject & err )
{
std::cout << "Exception itk::ExceptionObject levee !" << std::endl;
std::cout << err << std::endl;
return EXIT_FAILURE;
}
catch( ... )
{
std::cout << "Exception levee inconnue !" << std::endl;
return EXIT_FAILURE;
}
// Software Guide : EndCodeSnippet
//#endif
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment