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

Correction du CMakeLists.txt des tests de BasicFilters et ajout fichiers .cxx

parent aa9cb307
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,8 @@ ADD_TEST(bfTuImageToPointSetFilterTest ${BASICFILTERS_TESTS}
# A enrichir
SET(BasicFilters_SRCS
otbLeeFilter.cxx
otbFrostFilterTest.cxx
otbFrostFilterNew.cxx
otbFrostFilter.cxx
otbImageToPointSetFilterTest.cxx
)
......
......@@ -28,6 +28,8 @@
void RegisterTests()
{
REGISTER_TEST(otbLeeFilter);
REGISTER_TEST(otbFrostFilterNew);
REGISTER_TEST(otbFrostFilterTest);
REGISTER_TEST(otbFrostFilter);
REGISTER_TEST(otbImageToPointSetFilterTest);
}
......@@ -19,8 +19,6 @@
#pragma warning ( disable : 4786 )
#endif
//#define MAIN
#include "otbImageFileReader.h"
#include "otbFrostImageFilter.h"
......@@ -31,106 +29,6 @@
#include "itkMeanImageFilter.h"
int otbFrostFilterNew( int argc, char ** argv )
{
try
{
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::FrostImageFilter< InputImageType,OutputImageType > FilterType;
FilterType::Pointer frost = FilterType::New();
}
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;
}
return EXIT_SUCCESS;
}
int otbFrostFilterTest( int argc, char ** argv )
{
typedef itk::Image<float,2> FloatImage2DType;
itk::RandomImageSource<FloatImage2DType>::Pointer random;
random = itk::RandomImageSource<FloatImage2DType>::New();
random->SetMin(0.0);
random->SetMax(1000.0);
unsigned long randomSize[2];
randomSize[0] = randomSize[1] = 8;
random->SetSize(randomSize);
float spacing[2] = {0.7, 2.1};
random->SetSpacing( spacing );
float origin[2] = {15, 400};
random->SetOrigin( origin );
// Create a mean image
otb::FrostImageFilter<FloatImage2DType, FloatImage2DType>::Pointer frost;
frost = otb::FrostImageFilter<FloatImage2DType,FloatImage2DType>::New();
frost->SetInput(random->GetOutput());
// define the neighborhood size used for the mean filter (5x5)
FloatImage2DType::SizeType neighRadius;
neighRadius[0] = 1;
neighRadius[1] = 1;
frost->SetRadius(neighRadius);
// run the algorithm
frost->Update();
itk::ImageRegionIterator<FloatImage2DType> it;
it = itk::ImageRegionIterator<FloatImage2DType>(random->GetOutput(),
random->GetOutput()->GetBufferedRegion());
std::cout << "Input image" << std::endl;
unsigned int i;
for (i=1; !it.IsAtEnd(); ++i, ++it)
{
std::cout << "\t" << it.Get();
if ((i % 8) == 0)
{
std::cout << std::endl;
}
}
std::cout << "Output image" << std::endl;
it = itk::ImageRegionIterator<FloatImage2DType>(frost->GetOutput(),
frost->GetOutput()->GetBufferedRegion());
for (i=1; !it.IsAtEnd(); ++i, ++it)
{
std::cout << "\t" << it.Get();
if ((i % 8) == 0)
{
std::cout << std::endl;
}
}
// Test the itkGetConstReferenceMacro
const FloatImage2DType::SizeType & radius = frost->GetRadius();
std::cout << "frost->GetRadius():" << radius << std::endl;
return EXIT_SUCCESS;
}
int otbFrostFilter( int argc, char ** argv )
{
try
......
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include "otbImageFileReader.h"
#include "otbFrostImageFilter.h"
#include "itkExceptionObject.h"
#include "itkImageFileWriter.h"
#include "itkImage.h"
#include "itkRandomImageSource.h"
#include "itkMeanImageFilter.h"
int otbFrostFilterNew( int argc, char ** argv )
{
try
{
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::FrostImageFilter< InputImageType,OutputImageType > FilterType;
FilterType::Pointer frost = FilterType::New();
}
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;
}
return EXIT_SUCCESS;
}
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include "otbImageFileReader.h"
#include "otbFrostImageFilter.h"
#include "itkExceptionObject.h"
#include "itkImageFileWriter.h"
#include "itkImage.h"
#include "itkRandomImageSource.h"
#include "itkMeanImageFilter.h"
int otbFrostFilterTest( int argc, char ** argv )
{
typedef itk::Image<float,2> FloatImage2DType;
itk::RandomImageSource<FloatImage2DType>::Pointer random;
random = itk::RandomImageSource<FloatImage2DType>::New();
random->SetMin(0.0);
random->SetMax(1000.0);
unsigned long randomSize[2];
randomSize[0] = randomSize[1] = 8;
random->SetSize(randomSize);
float spacing[2] = {0.7, 2.1};
random->SetSpacing( spacing );
float origin[2] = {15, 400};
random->SetOrigin( origin );
// Create a mean image
otb::FrostImageFilter<FloatImage2DType, FloatImage2DType>::Pointer frost;
frost = otb::FrostImageFilter<FloatImage2DType,FloatImage2DType>::New();
frost->SetInput(random->GetOutput());
// define the neighborhood size used for the mean filter (5x5)
FloatImage2DType::SizeType neighRadius;
neighRadius[0] = 1;
neighRadius[1] = 1;
frost->SetRadius(neighRadius);
// run the algorithm
frost->Update();
itk::ImageRegionIterator<FloatImage2DType> it;
it = itk::ImageRegionIterator<FloatImage2DType>(random->GetOutput(),
random->GetOutput()->GetBufferedRegion());
std::cout << "Input image" << std::endl;
unsigned int i;
for (i=1; !it.IsAtEnd(); ++i, ++it)
{
std::cout << "\t" << it.Get();
if ((i % 8) == 0)
{
std::cout << std::endl;
}
}
std::cout << "Output image" << std::endl;
it = itk::ImageRegionIterator<FloatImage2DType>(frost->GetOutput(),
frost->GetOutput()->GetBufferedRegion());
for (i=1; !it.IsAtEnd(); ++i, ++it)
{
std::cout << "\t" << it.Get();
if ((i % 8) == 0)
{
std::cout << std::endl;
}
}
// Test the itkGetConstReferenceMacro
const FloatImage2DType::SizeType & radius = frost->GetRadius();
std::cout << "frost->GetRadius():" << radius << std::endl;
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment