otbWrapperListViewParameter Cannot find labels of vector file
Mantis Issue 1387, reported by sdinot, assigned to gpasero, created: 2017-04-19
I have troubles using python wrappers within a libsvm classification on both the 5.10 binary on Ubuntu 16.04 and a source built of 5.10 on Manjaro Linux. Wrappers that use otbWrapperListViewParameter.cxx to find a field in a vector file fail, stating it cannot find the field with : itk::ERROR: ListViewParameter( ):Cannot find
Specifically, I had troubles with "TrainImagesClassifier" and "ComputeConfusionMatrix". I noticed in the Cookbook that these fields are indicated as lists, so I thought maybe this has changed recently, but changing the module to SetParameterStringList and the input type to list didn't work either: Exception thrown in otbApplication Application_SetParameterStringList: <path_to_src>/otbWrapperListViewParameter.cxx:191: itk::ERROR: ListViewParameter(
): Value not found in the list of choices: .Tried also different vector files, with the same response.
Moreover, using the command line tools with the same arguments works though!
1492679161 - gpaseroTry to add the following line just before setting "ref.vector.field" :
ComputeConfusionMatrix.UpdateParameters()
1492681968 - m-haasAs simple as that! I missed that change apparently. Thanks a lot!
1492693623 - gpaseroIn fact it is more a hack than the intended way of doing things. The behaviour of "ref.vector.field" has changed, it is now a choice list showing available fields, hence the necessity to call UpdateParameters() after setting the OGR file.
Question to other devs : do we have a way to hide this extra step ? I know that C++ and Python API should remain close to each other.
1493106677 - rashadkmwe can however rename/override the methods in swig.
I would find out if there is an performance overhead when calling this method with each call to Set*
1493124633 - gpaseroYes, technically that would be the solution. But on the other hand, we break the symmetry between C++ and Python API.
Maybe in the long term, we should treat this UpdateParameters()