Hi,
As I understand the code, the filter is the base class for persistent
sampling operation. The interface it provides is made to be compliant
with a maximum of processing the dev has in its mind when writing it.
But as you are deriving of it you can overload most function if you want
to make something else.
About the "FieldName", it seems pretty relevant to me as if the vector
input does not have it how do you decide what to sample in your image?
For the second point I think it is much effective for the extractor not
to use the full architecture provided by the base class.The
ThreadedGenerateData is pretty simple. Other filters are using it though
like OGRDataToClassStatisticsFilter or OGRDataToSamplePositionFilter.
I hope it helps!
Antoine
On 10/01/2019 15:17, Joe Derksen wrote:
Hello OTB team,
I have been using the ImageSampleExtractorFilter, and its superclass
PersistentSamplingFilterBase, and I have a few questions concerning these
classes.
1. What is the point of the "FieldName" attribute ?
otbPersistentSamplingFilterBase.h lines 81-84
|
/** Set/Get macro for the field name containing class names * in the
input
vectors.*/itkSetMacro(FieldName,std::string);itkGetMacro(FieldName,std::string);
|
It is only called once, and basically raises an error if the field isn't
present in the output shapefile..
otbPersistentSamplingFilterBase.hxx lines 118-123
|
intfieldIndex
=featIt->ogr().GetFieldIndex(this->m_FieldName.c_str());if(fieldIndex
<0){ itkGenericExceptionMacro("Field named "<<this->m_FieldName<<" not
found!");}this->m_FieldIndex =fieldIndex;
|
The m_FieldIndex attribute is not called anywhere else except for in these
lines.. It seems totally useless !
I do not understand why the filter requires the user to give the name of
one of the fields in the output shapefile for the sample extraction step
anyway. The filter and the application should work even if the output
shapefile contains no fields at all. This is also quite inconvenient for
anyone inheriting this class, as they are also required to give a field
name.
2. The PersistentSamplingFilterBase provides a "ProcessSample" method that
should be overriden by a child class, and that should define the function to
apply to each sample in the shapefile.
However, the ImageSampleExtractorFilter does everything in the
ThreadedGenerateData. Why not use the ProcessSample method ?
Thank you,
Dawa
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html
You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google
Groups "otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
--
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html
You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
---
You received this message because you are subscribed to the Google Groups "otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.