Skip to content
Snippets Groups Projects
Commit 4e90ac80 authored by Caroline Ruffel's avatar Caroline Ruffel
Browse files

nomsg

parent 883dd8df
Branches
Tags
No related merge requests found
/*=========================================================================
Programme : OTB (ORFEO ToolBox)
Auteurs : CS - C.Ruffel
Language : C++
Date : 20 mars 2006
Version :
Role : Test du filtre de detection de contours (image direction)
$Id$
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#define MAIN
#include "itkExceptionObject.h"
#include "itkImage.h"
#include "itkImageFileWriter.h"
#include <iostream>
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbTouziEdgeDetector.h"
int otbTouziEdgeDetectorDirection( int argc, char* argv[] )
{
try
{
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
unsigned int RadiusX((unsigned int)::atoi(argv[3]));
typedef unsigned char InputPixelType;
typedef double OutputPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InputPixelType, Dimension > InputImageType;
typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
typedef otb::ImageFileReader< InputImageType > ReaderType;
typedef otb::ImageFileWriter< OutputImageType > WriterType;
typedef otb::TouziEdgeDetector< InputImageType,OutputImageType > FilterType;
FilterType::SizeType Radius;
Radius[0] = RadiusX;
Radius[1] = RadiusX;
FilterType::Pointer filtreTouzi = FilterType::New();
filtreTouzi->SetRadius( Radius );
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( inputFilename );
writer->SetFileName( outputFilename );
filtreTouzi->SetInput( reader->GetOutput() );
writer->SetInput( filtreTouzi->GetOutputDirection() );
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