diff --git a/Testing/Code/Markov/CMakeLists.txt b/Testing/Code/Markov/CMakeLists.txt index 9d179c6a5dcf6040da94ac6880a296adb08e3fa2..80460c9b48d742fad500e5fc23ea80696c1fe3b0 100755 --- a/Testing/Code/Markov/CMakeLists.txt +++ b/Testing/Code/Markov/CMakeLists.txt @@ -72,6 +72,15 @@ ADD_TEST(maTvMRFEnergyPotts ${MARKOV_TESTS1} ${TEMP}/maTvMRFEnergyPotts.txt ) +# ------- otb::MRFEnergyGaussian ------------------------------ +ADD_TEST(maTuMRFEnergyGaussianNew ${MARKOV_TESTS1} + otbMRFEnergyGaussianNew ) + +ADD_TEST(maTvMRFEnergyGaussian ${MARKOV_TESTS1} + otbMRFEnergyGaussian + ) + + # ------- otbMRFOptimizerICM ------------------------------ ADD_TEST(maTuMRFOptimizerICMNew ${MARKOV_TESTS1} @@ -148,6 +157,8 @@ otbMarkovRandomFieldFilterNew.cxx otbMarkovRandomFieldFilter.cxx otbMRFEnergyPottsNew.cxx otbMRFEnergyPotts.cxx +otbMRFEnergyGaussianNew.cxx +otbMRFEnergyGaussian.cxx otbMRFEnergyEdgeFidelityNew.cxx otbMRFEnergyEdgeFidelity.cxx otbMRFEnergyGaussianClassificationNew.cxx diff --git a/Testing/Code/Markov/otbMRFEnergyGaussian.cxx b/Testing/Code/Markov/otbMRFEnergyGaussian.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e654e584bce607b887b41aaaef24b5e16a71d39a --- /dev/null +++ b/Testing/Code/Markov/otbMRFEnergyGaussian.cxx @@ -0,0 +1,64 @@ +/*========================================================================= + + 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 "otbMRFEnergyGaussian.h" +#include "otbImage.h" +#include <fstream> + +int otbMRFEnergyGaussian(int argc, char * argv[]) +{ + typedef double PixelType; + typedef int PixelType2; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::Image<PixelType2, 2> LabelType; + + typedef otb::MRFEnergyGaussian< ImageType, LabelType> MRFEnergyGaussianType; + typedef MRFEnergyGaussianType::InputImagePixelType InputImagePixelType; + typedef MRFEnergyGaussianType::LabelledImagePixelType LabelledImagePixelType; + + MRFEnergyGaussianType::Pointer object = MRFEnergyGaussianType::New(); + + InputImagePixelType inPix = 10; + LabelledImagePixelType inLab = 5; + + if( object->GetSingleValue(inPix, inLab) != 25 ) + { + return EXIT_FAILURE; + } + + inPix = 5; + inLab = 10; + if( object->GetSingleValue(inPix, inLab) != 25 ) + { + return EXIT_FAILURE; + } + + inPix = 0; + inLab = 0; + if( object->GetSingleValue(inPix, inLab) != 0 ) + { + return EXIT_FAILURE; + } + + + return EXIT_SUCCESS; +} + diff --git a/Testing/Code/Markov/otbMRFEnergyGaussianNew.cxx b/Testing/Code/Markov/otbMRFEnergyGaussianNew.cxx new file mode 100644 index 0000000000000000000000000000000000000000..85c858bb368a9fd95f523b44fc5416eadb6ef19b --- /dev/null +++ b/Testing/Code/Markov/otbMRFEnergyGaussianNew.cxx @@ -0,0 +1,36 @@ +/*========================================================================= + + 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 "otbMRFEnergyGaussian.h" +#include "otbImage.h" + + +int otbMRFEnergyGaussianNew(int argc, char * argv[]) +{ + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::MRFEnergyGaussian< ImageType, ImageType> MRFEnergyGaussianType; + + MRFEnergyGaussianType::Pointer object = MRFEnergyGaussianType::New(); + + return EXIT_SUCCESS; +} + diff --git a/Testing/Code/Markov/otbMarkovTests1.cxx b/Testing/Code/Markov/otbMarkovTests1.cxx index dec53b3d9351446111bbfe2e0f1e1fbac3529432..92a27c5ac1c58f8384236d6b7f9cf3a051122384 100755 --- a/Testing/Code/Markov/otbMarkovTests1.cxx +++ b/Testing/Code/Markov/otbMarkovTests1.cxx @@ -33,6 +33,8 @@ REGISTER_TEST(otbMRFEnergyEdgeFidelityNew); REGISTER_TEST(otbMRFEnergyEdgeFidelity); REGISTER_TEST(otbMRFEnergyPottsNew); REGISTER_TEST(otbMRFEnergyPotts); +REGISTER_TEST(otbMRFEnergyGaussianNew); +REGISTER_TEST(otbMRFEnergyGaussian); REGISTER_TEST(otbMRFEnergyGaussianClassificationNew); REGISTER_TEST(otbMRFEnergyGaussianClassification); REGISTER_TEST(otbMRFOptimizerICMNew);