Commit 19bb3a59 authored by Emmanuel Christophe's avatar Emmanuel Christophe

TEST: add test for RandomPointSetSource

parent 299f3d15
......@@ -126,6 +126,9 @@ ADD_TEST(bfTvMeanFunctorImageTest ${BASICFILTERS_TESTS1}
ADD_TEST(bfTvTransformPointSetFilter ${BASICFILTERS_TESTS1}
otbTransformPointSetFilterTest)
ADD_TEST(bfTvRandomPointSetSource ${BASICFILTERS_TESTS1}
otbRandomPointSetSourceTest)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbBasicFiltersTests2 ~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -1612,6 +1615,7 @@ otbBinaryImageMinimalBoundingRegionCalculatorNew.cxx
otbBinaryImageMinimalBoundingRegionCalculator.cxx
otbMeanFunctorImageTest.cxx
otbTransformPointSetFilterTest.cxx
otbRandomPointSetSourceTest.cxx
)
# A enrichir
......
......@@ -39,5 +39,5 @@ void RegisterTests()
REGISTER_TEST(otbBinaryImageMinimalBoundingRegionCalculator);
REGISTER_TEST(otbMeanFunctorImageTest);
REGISTER_TEST(otbTransformPointSetFilterTest);
REGISTER_TEST(otbRandomPointSetSourceTest);
}
/*=========================================================================
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 "otbRandomPointSetSource.h"
#include "itkPointSet.h"
int otbRandomPointSetSourceTest(int, char*[])
{
typedef double PixelType;
typedef itk::PointSet<PixelType, 2> PointSetType;
typedef otb::RandomPointSetSource<PointSetType> PointSetSourceType;
typedef PointSetType::PointsContainer PointsContainerType;
PointSetSourceType::Pointer pointSet = PointSetSourceType::New();
pointSet->SetNumberOfPoints(10);
PointSetType::PointType minPoint, maxPoint;
minPoint[0] = 10;
minPoint[1] = 20;
pointSet->SetMinPoint(minPoint);
maxPoint[0] = 100;
maxPoint[1] = 50;
pointSet->SetMaxPoint(maxPoint);
//To get deterministic results
pointSet->SetSeed(100);
pointSet->Update();
// Get the the point container
PointSetSourceType::PointsContainerPointer
points = pointSet->GetOutput()->GetPoints();
PointsContainerType::ConstIterator it = points->Begin();
while (it != points->End())
{
PointSetType::PointType p = it.Value();
std::cout.width(5); std::cout << p[0] << ", ";
std::cout.width(5); std::cout << p[1] << std::endl;
++it;
}
// All objects should be automatically destroyed at this point
return EXIT_SUCCESS;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment