Commit 24ea0818 authored by Cédric Traizet's avatar Cédric Traizet

BUG: do not use the first field avalaible as label if no field is provided

parent e99c09bc
Pipeline #2030 passed with stages
in 57 minutes and 25 seconds
......@@ -65,7 +65,6 @@ public:
typedef typename Superclass::SampleType SampleType;
typedef typename Superclass::ListSampleType ListSampleType;
typedef typename Superclass::TargetListSampleType TargetListSampleType;
typedef typename Superclass::ClassifierCategory ClassifierCategory;
typedef double ValueType;
typedef itk::VariableLengthVector <ValueType> MeasurementType;
......@@ -128,7 +127,10 @@ protected:
{
m_SelectedCFieldIdx = selectedCFieldIdx;
// Handle only one class field name, if several are provided only the first one is used.
m_SelectedCFieldName = selectedCFieldIdx.empty() ? cFieldNames.front() : cFieldNames[selectedCFieldIdx.front()];
if (selectedCFieldIdx.empty())
m_SelectedCFieldName.clear();
else
m_SelectedCFieldName = cFieldNames[selectedCFieldIdx.front()];
}
};
......
......@@ -312,7 +312,7 @@ TrainVectorBase<TInputValue, TOutputValue>
input->PushBack( mv );
if(cFieldIndex>=0 && ogr::Field(feature,cFieldIndex).HasBeenSet() && !(this->GetClassifierCategory() == ClassifierCategory::Unsupervised))
if(cFieldIndex>=0 && ogr::Field(feature,cFieldIndex).HasBeenSet())
{
switch (feature[cFieldIndex].GetType())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment