Skip to content
Snippets Groups Projects
Commit c1b121a1 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

TEST: add instanciation and non regression tests for PointSetDensityEpanechnikovFunction

parent c3a90d0f
No related branches found
No related tags found
No related merge requests found
...@@ -1289,6 +1289,20 @@ ADD_TEST(bfTvPointSetDensityGaussianFunctionTest ${BASICFILTERS_TESTS11} ...@@ -1289,6 +1289,20 @@ ADD_TEST(bfTvPointSetDensityGaussianFunctionTest ${BASICFILTERS_TESTS11}
${TEMP}/bfTvPointSetDensityGaussianFunctionOutputAscii.txt ${TEMP}/bfTvPointSetDensityGaussianFunctionOutputAscii.txt
) )
# ------- otbPointSetDensityEpanechnikovFunction ----------------------------
ADD_TEST(bfTuPointSetDensityEpanechnikovFunctionNew ${BASICFILTERS_TESTS11}
otbPointSetDensityEpanechnikovFunctionNew
)
ADD_TEST(bfTvPointSetDensityEpanechnikovFunctionTest ${BASICFILTERS_TESTS11}
--compare-ascii ${NOTOL}
${BASELINE_FILES}/bfTvPointSetDensityEpanechnikovFunctionOutputAscii.txt
${TEMP}/bfTvPointSetDensityEpanechnikovFunctionOutputAscii.txt
otbPointSetDensityEpanechnikovFunctionTest
${TEMP}/bfTvPointSetDensityEpanechnikovFunctionOutputAscii.txt
)
#------------ otbPointSetToDensityImageFilter --------------------- #------------ otbPointSetToDensityImageFilter ---------------------
ADD_TEST(bfTuPointSetToDensityImageFilterNew ${BASICFILTERS_TESTS11} ADD_TEST(bfTuPointSetToDensityImageFilterNew ${BASICFILTERS_TESTS11}
...@@ -1802,6 +1816,8 @@ otbPointSetDensityFunctionNew.cxx ...@@ -1802,6 +1816,8 @@ otbPointSetDensityFunctionNew.cxx
otbPointSetDensityFunctionTest.cxx otbPointSetDensityFunctionTest.cxx
otbPointSetDensityGaussianFunctionNew.cxx otbPointSetDensityGaussianFunctionNew.cxx
otbPointSetDensityGaussianFunctionTest.cxx otbPointSetDensityGaussianFunctionTest.cxx
otbPointSetDensityEpanechnikovFunctionNew.cxx
otbPointSetDensityEpanechnikovFunctionTest.cxx
otbPointSetToDensityImageFilterNew.cxx otbPointSetToDensityImageFilterNew.cxx
otbPointSetToDensityImageFilterTest.cxx otbPointSetToDensityImageFilterTest.cxx
otbKeyPointDensityImageFilterNew.cxx otbKeyPointDensityImageFilterNew.cxx
......
...@@ -32,6 +32,8 @@ void RegisterTests() ...@@ -32,6 +32,8 @@ void RegisterTests()
REGISTER_TEST(otbPointSetDensityFunctionTest); REGISTER_TEST(otbPointSetDensityFunctionTest);
REGISTER_TEST(otbPointSetDensityGaussianFunctionNew); REGISTER_TEST(otbPointSetDensityGaussianFunctionNew);
REGISTER_TEST(otbPointSetDensityGaussianFunctionTest); REGISTER_TEST(otbPointSetDensityGaussianFunctionTest);
REGISTER_TEST(otbPointSetDensityEpanechnikovFunctionNew);
REGISTER_TEST(otbPointSetDensityEpanechnikovFunctionTest);
REGISTER_TEST(otbPointSetToDensityImageFilterNew); REGISTER_TEST(otbPointSetToDensityImageFilterNew);
REGISTER_TEST(otbPointSetToDensityImageFilterTest); REGISTER_TEST(otbPointSetToDensityImageFilterTest);
REGISTER_TEST(otbKeyPointDensityImageFilterNew); REGISTER_TEST(otbKeyPointDensityImageFilterNew);
......
/*=========================================================================
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.
=========================================================================*/
#include <stdio.h>
#include "otbPointSetDensityEpanechnikovFunction.h"
#include "itkPointSet.h"
#include "itkVariableLengthVector.h"
int otbPointSetDensityEpanechnikovFunctionNew(int, char*[])
{
const unsigned int Dimension = 2;
typedef float PixelType;
typedef itk::VariableLengthVector<PixelType> RealVectorType;
typedef itk::PointSet<RealVectorType, Dimension> PointSetType;
typedef otb::PointSetDensityEpanechnikovFunction <PointSetType, PixelType> FunctionType;
/**Instantiation of a Smart Pointer*/
FunctionType::Pointer filter = FunctionType::New();
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.
=========================================================================*/
#include "otbImageFileReader.h"
#include "otbPointSetDensityEpanechnikovFunction.h"
#include "itkPointSet.h"
#include "itkVariableLengthVector.h"
#include "otbSiftFastImageFilter.h"
#include <iostream>
int otbPointSetDensityEpanechnikovFunctionTest(int argc, char* argv[])
{
const char * outfname = argv[1];
const unsigned int Dimension = 2;
typedef float PixelType;
typedef itk::VariableLengthVector<PixelType> RealVectorType;
typedef itk::PointSet<RealVectorType, Dimension> PointSetType;
typedef otb::PointSetDensityEpanechnikovFunction <PointSetType, PixelType> FunctionType;
/**Instantiation of a Smart Pointer*/
PointSetType::Pointer pointSet = PointSetType::New();
FunctionType::Pointer filter = FunctionType::New();
std::ofstream outfile(outfname);
/** Construction of the pointSet */
PointSetType::PointIdentifier count = 0;
PointSetType::PointType pDst, pSrc;
pDst[0] = 12.78;
pDst[1] = 18.76;
pointSet->SetPoint(count++, pDst);
pDst[0] = 15.78;
pDst[1] = 23.76;
pointSet->SetPoint(count++, pDst);
pDst[0] = 9.78;
pDst[1] = 5.76;
pointSet->SetPoint(count++, pDst);
filter->SetPointSet(pointSet);
filter->SetRadius(2);
/**Point we search around*/
pDst[0] = 14.9;
pDst[1] = 24;
outfile << "Density computed for the point : " << pDst << " is " << filter->Evaluate(pDst) << std::endl;
pDst[0] = 9;
pDst[1] = 5;
outfile << "Density computed for the point : " << pDst << " is " << filter->Evaluate(pDst) << std::endl;
outfile.close();
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