21 #ifndef otbPersistentSamplingFilterBase_h
22 #define otbPersistentSamplingFilterBase_h
42 template <
class TInputImage,
class TMaskImage = otb::Image<
unsigned char, 2>>
70 void SetMask(
const TMaskImage* mask);
73 const TMaskImage* GetMask();
76 void SetOGRLayerCreationOptions(
const std::vector<std::string>& options);
79 const std::vector<std::string>& GetOGRLayerCreationOptions();
83 itkSetMacro(FieldName, std::string);
84 itkGetMacro(FieldName, std::string);
88 itkGetMacro(FieldIndex,
int);
91 itkSetMacro(LayerIndex,
int);
92 itkGetMacro(LayerIndex,
int);
96 itkSetMacro(OutLayerName, std::string);
97 itkGetMacro(OutLayerName, std::string);
111 void GenerateOutputInformation()
override;
115 void GenerateInputRequestedRegion()
override;
118 void GenerateData(
void)
override;
121 void AllocateOutputs(
void)
override;
124 virtual void ThreadedGenerateVectorData(
const ogr::Layer& layerForThread, itk::ThreadIdType threadid);
127 void ExploreGeometry(
const ogr::Feature& feature, OGRGeometry* geom, RegionType& region, itk::ThreadIdType& threadid);
130 virtual void ProcessLine(
const ogr::Feature& feature, OGRLineString* line, RegionType& region, itk::ThreadIdType& threadid);
133 virtual void ProcessPolygon(
const ogr::Feature& feature, OGRPolygon* polygon, RegionType& region, itk::ThreadIdType& threadid);
136 virtual void ProcessSample(
const ogr::Feature& feature,
typename TInputImage::IndexType& imgIndex,
typename TInputImage::PointType& imgPoint,
137 itk::ThreadIdType& threadid);
140 virtual void PrepareFeature(
const ogr::Feature& feature, itk::ThreadIdType& threadid);
143 bool IsSampleInsidePolygon(OGRPolygon* poly, OGRPoint* tmpPoint);
146 bool IsSampleOnLine(OGRLineString* line,
typename TInputImage::PointType& position,
typename TInputImage::SpacingType& absSpacing, OGRPolygon& tmpPolygon);
154 virtual void DispatchInputVectors(
void);
157 virtual void GatherOutputVectors(
void);
160 virtual void FillOneOutput(
unsigned int outIdx,
ogr::DataSource* outDS,
bool update);
174 void ClearAdditionalFields();
177 void CreateAdditionalField(std::string name, OGRFieldType type,
int width = 0,
int precision = 0);
180 const std::vector<SimpleFieldDefn>& GetAdditionalFields();
183 static itk::ITK_THREAD_RETURN_TYPE VectorThreaderCallback(
void *arg);
192 ogr::Layer GetInMemoryInput(
unsigned int threadId);
195 ogr::Layer GetInMemoryOutput(
unsigned int threadId,
unsigned int index = 0);
227 #ifndef OTB_MANUAL_INSTANTIATION
This filter is the base class for all filter persisting data through multiple update....
Base class for persistent filter doing sampling tasks.
PersistentSamplingFilterBase(const Self &)=delete
itk::SmartPointer< Self > Pointer
ogr::DataSource::Pointer OGRDataPointer
void operator=(const Self &)=delete
std::vector< SimpleFieldDefn > m_AdditionalFields
std::vector< std::string > m_OGRLayerCreationOptions
std::string m_OutLayerName
PersistentSamplingFilterBase Self
std::vector< OGRDataPointer > m_InMemoryInputs
std::vector< std::vector< OGRDataPointer > > m_InMemoryOutputs
~PersistentSamplingFilterBase() override
TInputImage::RegionType RegionType
TInputImage InputImageType
PersistentImageFilter< TInputImage, TInputImage > Superclass
itk::SmartPointer< const Self > ConstPointer
Collection of geometric objects.
itk::SmartPointer< Self > Pointer
Geometric object with descriptive fields.
Implementation class for Feature iterator. This iterator is a single pass iterator....
Layer of geometric objects.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.