From 166c0b951998c1fad1e3f4085f2a2257a762d632 Mon Sep 17 00:00:00 2001
From: Cyrille Valladeau <cyrille.valladeau@c-s.fr>
Date: Wed, 14 May 2008 15:44:47 +0000
Subject: [PATCH] Ajout des test sur MRFEnergyGaussian.

---
 Testing/Code/Markov/CMakeLists.txt            | 11 ++++
 Testing/Code/Markov/otbMRFEnergyGaussian.cxx  | 64 +++++++++++++++++++
 .../Code/Markov/otbMRFEnergyGaussianNew.cxx   | 36 +++++++++++
 Testing/Code/Markov/otbMarkovTests1.cxx       |  2 +
 4 files changed, 113 insertions(+)
 create mode 100644 Testing/Code/Markov/otbMRFEnergyGaussian.cxx
 create mode 100644 Testing/Code/Markov/otbMRFEnergyGaussianNew.cxx

diff --git a/Testing/Code/Markov/CMakeLists.txt b/Testing/Code/Markov/CMakeLists.txt
index 9d179c6a5d..80460c9b48 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 0000000000..e654e584bc
--- /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 0000000000..85c858bb36
--- /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 dec53b3d93..92a27c5ac1 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);
-- 
GitLab