From 0778b4b5569fbb34c13d1124160b5779f0316044 Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@orfeo-toolbox.org>
Date: Fri, 24 Jun 2011 16:56:43 +0200
Subject: [PATCH] ENH: Adding virtual methods to handle optimized fit and tie
 points in SensorModelBase

---
 Code/Projections/otbSensorModelBase.h   |  9 +++++++
 Code/Projections/otbSensorModelBase.txx | 33 +++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/Code/Projections/otbSensorModelBase.h b/Code/Projections/otbSensorModelBase.h
index b7c5074f77..6cbf9d472a 100644
--- a/Code/Projections/otbSensorModelBase.h
+++ b/Code/Projections/otbSensorModelBase.h
@@ -95,6 +95,15 @@ public:
     return m_Model->IsValidSensorModel();
   }
 
+  /** Add a tie point to optimize sensor model */
+  virtual void AddTiePoint(const InputPointType & inputPoint, const OutputPointType & outputPoint);
+
+  /** Clear tie points */
+  void ClearTiePoints();
+
+  /** Optimize sensor model */
+  double Optimize();
+
 protected:
   SensorModelBase();
   virtual ~SensorModelBase();
diff --git a/Code/Projections/otbSensorModelBase.txx b/Code/Projections/otbSensorModelBase.txx
index df81a73e47..02153a39b4 100644
--- a/Code/Projections/otbSensorModelBase.txx
+++ b/Code/Projections/otbSensorModelBase.txx
@@ -86,6 +86,39 @@ SensorModelBase<TScalarType, NInputDimensions, NOutputDimensions>
   m_Model->SetGeoidFile(geoidFile);
 }
 
+
+template <class TScalarType,
+    unsigned int NInputDimensions,
+    unsigned int NOutputDimensions>
+void 
+SensorModelBase<TScalarType, NInputDimensions, NOutputDimensions>
+::AddTiePoint(const InputPointType & inputPoint, const OutputPointType & outputPoint)
+{
+  itkExceptionMacro(<<"Method should be re-implemented in sub-classes (forward and inverse models)");
+}
+
+/** Clear tie points */
+template <class TScalarType,
+    unsigned int NInputDimensions,
+    unsigned int NOutputDimensions>
+void 
+SensorModelBase<TScalarType, NInputDimensions, NOutputDimensions>
+::ClearTiePoints()
+{
+  m_Model->ClearTiePoints();
+}
+
+/** Optimize sensor model */
+template <class TScalarType,
+    unsigned int NInputDimensions,
+    unsigned int NOutputDimensions>
+double 
+SensorModelBase<TScalarType, NInputDimensions, NOutputDimensions>
+::Optimize()
+{
+  return m_Model->Optimize();
+}
+
 /**
  * PrintSelf method
  */
-- 
GitLab