From fc5debec3255e1d69e7010b6df8688a44898a5f5 Mon Sep 17 00:00:00 2001
From: Jordi Inglada <jordi.inglada@orfeo-toolbox.org>
Date: Thu, 18 May 2006 13:58:43 +0000
Subject: [PATCH] Passage des tests de learning en otbImage

---
 Testing/Code/Learning/SVMPointSetExample.cxx  |  2 -
 .../Code/Learning/otbSVMClassifierImage.cxx   | 69 ++-----------------
 .../Learning/otbSVMClassifierPointSet.cxx     |  1 -
 .../Learning/otbSVMImageModelEstimatorNew.cxx |  8 +--
 .../otbSVMImageModelEstimatorTrain.cxx        |  7 +-
 .../otbSVMMembershipFunctionLoadModel.cxx     |  1 -
 .../Learning/otbSVMMembershipFunctionNew.cxx  |  1 -
 .../Learning/otbSVMModelAllocateProblem.cxx   |  4 +-
 Testing/Code/Learning/otbSVMModelLoad.cxx     |  4 +-
 Testing/Code/Learning/otbSVMModelLoadSave.cxx |  4 +-
 Testing/Code/Learning/otbSVMModelNew.cxx      |  4 +-
 11 files changed, 21 insertions(+), 84 deletions(-)

diff --git a/Testing/Code/Learning/SVMPointSetExample.cxx b/Testing/Code/Learning/SVMPointSetExample.cxx
index 33a759d046..ea484cb01e 100755
--- a/Testing/Code/Learning/SVMPointSetExample.cxx
+++ b/Testing/Code/Learning/SVMPointSetExample.cxx
@@ -184,8 +184,6 @@ int main( int argc, char* argv[] )
     classifier->Update() ;
 
     /* Build the class map */
-    std::cout << "Output image creation" << std::endl;  
-
     
     std::cout << "classifier get output" << std::endl;  
     ClassifierType::OutputType* membershipSample =
diff --git a/Testing/Code/Learning/otbSVMClassifierImage.cxx b/Testing/Code/Learning/otbSVMClassifierImage.cxx
index 00b3ddc682..52b20999af 100644
--- a/Testing/Code/Learning/otbSVMClassifierImage.cxx
+++ b/Testing/Code/Learning/otbSVMClassifierImage.cxx
@@ -26,7 +26,8 @@
 #include "itkListSample.h"
 
 
-#include "itkVectorImage.h"
+#include "otbImage.h"
+#include "otbVectorImage.h"
 #include "itkImageToListAdaptor.h"
 #include "otbSVMClassifier.h"
 #include "otbImageFileReader.h"
@@ -67,7 +68,7 @@ int otbSVMClassifierImage(int argc, char* argv[] )
 
     
 
-    typedef itk::Image< itk::FixedArray<InputPixelType,3>,  Dimension >	InputImageType;
+    typedef otb::Image< itk::FixedArray<InputPixelType,3>,  Dimension >	InputImageType;
 
 
     typedef otb::ImageFileReader< InputImageType  >         ReaderType;
@@ -82,66 +83,6 @@ int otbSVMClassifierImage(int argc, char* argv[] )
 
     std::cout << "Image read" << std::endl;  
 
-/*
-    typedef itk::PointSet< InputVectorType,  Dimension >
-                                                       MeasurePointSetType;
-
-
-    MeasurePointSetType::Pointer mPSet = MeasurePointSetType::New();
-
-    typedef MeasurePointSetType::PointType    MeasurePointType;
-
-    typedef MeasurePointSetType::PointsContainer      MeasurePointsContainer;
-
-    MeasurePointsContainer::Pointer mCont = MeasurePointsContainer::New();
-
-
-    typedef itk::ImageRegionIterator< InputImageType>  InputIteratorType;
-    InputIteratorType  inIt( reader->GetOutput(),
-			     reader->GetOutput()->GetBufferedRegion() );
-    
-    inIt.GoToBegin();
-
-    std::cout << "Building the pointset" << std::endl;  
-
-    unsigned long pointId=0;
-    while(!inIt.IsAtEnd() )
-      {
-
-
-      MeasurePointType mP;
-
-      mP[0] = inIt.GetIndex()[0];
-      mP[1] = inIt.GetIndex()[1];
-
-
-      InputVectorType measure; 
-      measure.push_back(inIt.Get()[0]);
-      measure.push_back(inIt.Get()[1]);
-      measure.push_back(inIt.Get()[2]);
-
-
-
-      mCont->InsertElement( pointId , mP );
-      mPSet->SetPointData( pointId, measure );   
-
-
-
-      ++inIt;
-      ++pointId;
-      }
-
-    std::cout << "Set the points" << std::endl;  
-
-    mPSet->SetPoints( mCont );
-
-    std::cout << "PointSet built" << std::endl;  
-
-    typedef itk::Statistics::PointSetToListAdaptor< MeasurePointSetType >
-      SampleType;
-    SampleType::Pointer sample = SampleType::New();
-    sample->SetPointSet( mPSet );
-*/
 
     typedef itk::Statistics::ImageToListAdaptor< InputImageType > SampleType;
     SampleType::Pointer sample = SampleType::New();
@@ -171,7 +112,7 @@ int otbSVMClassifierImage(int argc, char* argv[] )
     std::cout << "Output image creation" << std::endl;
 
     typedef ClassifierType::ClassLabelType	                 OutputPixelType;
-    typedef itk::Image< OutputPixelType, Dimension >        OutputImageType;
+    typedef otb::Image< OutputPixelType, Dimension >        OutputImageType;
 
     
     OutputImageType::Pointer outputImage = OutputImageType::New();
@@ -223,7 +164,7 @@ int otbSVMClassifierImage(int argc, char* argv[] )
     }
 
 
-    typedef itk::Image< unsigned char, Dimension >        FileImageType;
+    typedef otb::Image< unsigned char, Dimension >        FileImageType;
 
     
     typedef itk::RescaleIntensityImageFilter< OutputImageType,
diff --git a/Testing/Code/Learning/otbSVMClassifierPointSet.cxx b/Testing/Code/Learning/otbSVMClassifierPointSet.cxx
index 6a14874282..12f0a1c5bc 100644
--- a/Testing/Code/Learning/otbSVMClassifierPointSet.cxx
+++ b/Testing/Code/Learning/otbSVMClassifierPointSet.cxx
@@ -113,7 +113,6 @@ int otbSVMClassifierPointSet(int argc, char* argv[] )
     classifier->Update() ;
 
     /* Build the class map */
-    std::cout << "Output image creation" << std::endl;  
 
     
     std::cout << "classifier get output" << std::endl;  
diff --git a/Testing/Code/Learning/otbSVMImageModelEstimatorNew.cxx b/Testing/Code/Learning/otbSVMImageModelEstimatorNew.cxx
index de924c8cc7..6fd2d54fd8 100644
--- a/Testing/Code/Learning/otbSVMImageModelEstimatorNew.cxx
+++ b/Testing/Code/Learning/otbSVMImageModelEstimatorNew.cxx
@@ -17,8 +17,8 @@
 
 
 #include "itkExceptionObject.h"
-#include "itkImage.h"
-#include "itkVectorImage.h"
+#include "otbImage.h"
+#include "otbVectorImage.h"
 #include <iostream>
 
 #include "otbSVMImageModelEstimator.h"
@@ -31,9 +31,9 @@ int otbSVMImageModelEstimatorNew( int argc, char* argv[] )
         typedef double                               InputPixelType;
         const   unsigned int        	                    Dimension = 2;
 
-        typedef itk::VectorImage< InputPixelType,  Dimension >        InputImageType;
+        typedef otb::VectorImage< InputPixelType,  Dimension >        InputImageType;
 
-	typedef itk::Image< InputPixelType,  Dimension >     TrainingImageType;
+	typedef otb::Image< InputPixelType,  Dimension >     TrainingImageType;
 
 	typedef std::vector<double>   VectorType;
 
diff --git a/Testing/Code/Learning/otbSVMImageModelEstimatorTrain.cxx b/Testing/Code/Learning/otbSVMImageModelEstimatorTrain.cxx
index f7f14435ab..70fe4a0f6a 100644
--- a/Testing/Code/Learning/otbSVMImageModelEstimatorTrain.cxx
+++ b/Testing/Code/Learning/otbSVMImageModelEstimatorTrain.cxx
@@ -17,7 +17,8 @@
 
 
 #include "itkExceptionObject.h"
-#include "itkImage.h"
+#include "otbImage.h"
+#include "otbVectorImage.h"
 #include <iostream>
 
 #include "otbSVMImageModelEstimator.h"
@@ -37,9 +38,9 @@ int otbSVMImageModelEstimatorTrain( int argc, char* argv[] )
     typedef double      InputPixelType;
     const   unsigned int       Dimension = 2;
     
-    typedef itk::VectorImage< InputPixelType,  Dimension >        InputImageType;
+    typedef otb::VectorImage< InputPixelType,  Dimension >        InputImageType;
     
-    typedef itk::Image< InputPixelType,  Dimension >     TrainingImageType;
+    typedef otb::Image< InputPixelType,  Dimension >     TrainingImageType;
     
     typedef std::vector<double>   VectorType;
     
diff --git a/Testing/Code/Learning/otbSVMMembershipFunctionLoadModel.cxx b/Testing/Code/Learning/otbSVMMembershipFunctionLoadModel.cxx
index c1b3395da2..72d9039986 100644
--- a/Testing/Code/Learning/otbSVMMembershipFunctionLoadModel.cxx
+++ b/Testing/Code/Learning/otbSVMMembershipFunctionLoadModel.cxx
@@ -17,7 +17,6 @@
 
 
 #include "itkExceptionObject.h"
-#include "itkImage.h"
 #include <iostream>
 
 #include "otbSVMMembershipFunction.h"
diff --git a/Testing/Code/Learning/otbSVMMembershipFunctionNew.cxx b/Testing/Code/Learning/otbSVMMembershipFunctionNew.cxx
index e2354e176d..dbcda6f26b 100644
--- a/Testing/Code/Learning/otbSVMMembershipFunctionNew.cxx
+++ b/Testing/Code/Learning/otbSVMMembershipFunctionNew.cxx
@@ -17,7 +17,6 @@
 
 
 #include "itkExceptionObject.h"
-#include "itkImage.h"
 #include <iostream>
 
 #include "otbSVMMembershipFunction.h"
diff --git a/Testing/Code/Learning/otbSVMModelAllocateProblem.cxx b/Testing/Code/Learning/otbSVMModelAllocateProblem.cxx
index 6478595fec..6f37d3e2b2 100644
--- a/Testing/Code/Learning/otbSVMModelAllocateProblem.cxx
+++ b/Testing/Code/Learning/otbSVMModelAllocateProblem.cxx
@@ -17,7 +17,7 @@
 
 
 #include "itkExceptionObject.h"
-#include "itkImage.h"
+#include "otbImage.h"
 #include <iostream>
 
 #include "otbSVMModel.h"
@@ -31,7 +31,7 @@ int otbSVMModelAllocateProblem( int argc, char* argv[] )
 	typedef unsigned char                                   LabelPixelType;
         const   unsigned int        	                        Dimension = 2;
 
-        typedef itk::Image< InputPixelType,  Dimension >        InputImageType;
+        typedef otb::Image< InputPixelType,  Dimension >        InputImageType;
 
         typedef otb::SVMModel< InputPixelType, LabelPixelType >   ModelType;
 	
diff --git a/Testing/Code/Learning/otbSVMModelLoad.cxx b/Testing/Code/Learning/otbSVMModelLoad.cxx
index f5497c2d6e..6f22e73509 100644
--- a/Testing/Code/Learning/otbSVMModelLoad.cxx
+++ b/Testing/Code/Learning/otbSVMModelLoad.cxx
@@ -17,7 +17,7 @@
 
 
 #include "itkExceptionObject.h"
-#include "itkImage.h"
+#include "otbImage.h"
 #include <iostream>
 
 #include "otbSVMModel.h"
@@ -31,7 +31,7 @@ int otbSVMModelLoad( int argc, char* argv[] )
 	typedef unsigned char                                   LabelPixelType;
         const   unsigned int        	                        Dimension = 2;
 
-        typedef itk::Image< InputPixelType,  Dimension >        InputImageType;
+        typedef otb::Image< InputPixelType,  Dimension >        InputImageType;
 
         typedef otb::SVMModel< InputPixelType, LabelPixelType >   ModelType;
 	
diff --git a/Testing/Code/Learning/otbSVMModelLoadSave.cxx b/Testing/Code/Learning/otbSVMModelLoadSave.cxx
index 8dda8525db..9f6b21b865 100644
--- a/Testing/Code/Learning/otbSVMModelLoadSave.cxx
+++ b/Testing/Code/Learning/otbSVMModelLoadSave.cxx
@@ -17,7 +17,7 @@
 
 
 #include "itkExceptionObject.h"
-#include "itkImage.h"
+#include "otbImage.h"
 #include <iostream>
 
 #include "otbSVMModel.h"
@@ -31,7 +31,7 @@ int otbSVMModelLoadSave( int argc, char* argv[] )
 	typedef unsigned char                                   LabelPixelType;
         const   unsigned int        	                        Dimension = 2;
 
-        typedef itk::Image< InputPixelType,  Dimension >        InputImageType;
+        typedef otb::Image< InputPixelType,  Dimension >        InputImageType;
 
         typedef otb::SVMModel< InputPixelType, LabelPixelType >   ModelType;
 	
diff --git a/Testing/Code/Learning/otbSVMModelNew.cxx b/Testing/Code/Learning/otbSVMModelNew.cxx
index f7c695d108..736a6d2eeb 100644
--- a/Testing/Code/Learning/otbSVMModelNew.cxx
+++ b/Testing/Code/Learning/otbSVMModelNew.cxx
@@ -17,7 +17,7 @@
 
 
 #include "itkExceptionObject.h"
-#include "itkImage.h"
+#include "otbImage.h"
 #include <iostream>
 
 #include "otbSVMModel.h"
@@ -31,7 +31,7 @@ int otbSVMModelNew( int argc, char* argv[] )
 	typedef unsigned char                                   LabelPixelType;
         const   unsigned int        	                        Dimension = 2;
 
-        typedef itk::Image< InputPixelType,  Dimension >        InputImageType;
+        typedef otb::Image< InputPixelType,  Dimension >        InputImageType;
 
         typedef otb::SVMModel< InputPixelType, LabelPixelType >   ModelType;
 	
-- 
GitLab