From 93e4f186ae3d82d968fa992df1049c9e1ee58d4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Traizet?= <cedric.traizet@c-s.fr>
Date: Tue, 23 Apr 2019 15:50:31 +0200
Subject: [PATCH] ENH: read the predictor label

---
 .../AppClassification/app/otbTrainVectorRegression.cxx      | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Modules/Applications/AppClassification/app/otbTrainVectorRegression.cxx b/Modules/Applications/AppClassification/app/otbTrainVectorRegression.cxx
index 1bff521a03..c94cd63262 100644
--- a/Modules/Applications/AppClassification/app/otbTrainVectorRegression.cxx
+++ b/Modules/Applications/AppClassification/app/otbTrainVectorRegression.cxx
@@ -75,6 +75,12 @@ protected:
   
   void DoExecute() override
   {
+    m_FeaturesInfo.SetClassFieldNames( GetChoiceNames( "cfield" ), GetSelectedItems( "cfield" ) );
+
+    if( m_FeaturesInfo.m_SelectedCFieldIdx.empty() && GetClassifierCategory() == Supervised )
+      {
+      otbAppLogFATAL( << "No field has been selected for data labelling!" );
+      }
 
     Superclass::DoExecute();
   }
-- 
GitLab