21 #ifndef otbPersistentSamplingFilterBase_h
22 #define otbPersistentSamplingFilterBase_h
41 template <
class TInputImage,
class TMaskImage = otb::Image<
unsigned char, 2>>
69 void SetMask(
const TMaskImage* mask);
72 const TMaskImage* GetMask();
75 void SetOGRLayerCreationOptions(
const std::vector<std::string>& options);
78 const std::vector<std::string>& GetOGRLayerCreationOptions();
82 itkSetMacro(FieldName, std::string);
83 itkGetMacro(FieldName, std::string);
87 itkGetMacro(FieldIndex,
int);
90 itkSetMacro(LayerIndex,
int);
91 itkGetMacro(LayerIndex,
int);
95 itkSetMacro(OutLayerName, std::string);
96 itkGetMacro(OutLayerName, std::string);
110 void GenerateOutputInformation()
override;
114 void GenerateInputRequestedRegion()
override;
117 void GenerateData(
void)
override;
120 void AllocateOutputs(
void)
override;
123 virtual void ThreadedGenerateVectorData(
const ogr::Layer& layerForThread, itk::ThreadIdType threadid);
126 void ExploreGeometry(
const ogr::Feature& feature, OGRGeometry* geom, RegionType& region, itk::ThreadIdType& threadid);
129 virtual void ProcessLine(
const ogr::Feature& feature, OGRLineString* line, RegionType& region, itk::ThreadIdType& threadid);
132 virtual void ProcessPolygon(
const ogr::Feature& feature, OGRPolygon* polygon, RegionType& region, itk::ThreadIdType& threadid);
135 virtual void ProcessSample(
const ogr::Feature& feature,
typename TInputImage::IndexType& imgIndex,
typename TInputImage::PointType& imgPoint,
136 itk::ThreadIdType& threadid);
139 virtual void PrepareFeature(
const ogr::Feature& feature, itk::ThreadIdType& threadid);
142 bool IsSampleInsidePolygon(OGRPolygon* poly, OGRPoint* tmpPoint);
145 bool IsSampleOnLine(OGRLineString* line,
typename TInputImage::PointType& position,
typename TInputImage::SpacingType& absSpacing, OGRPolygon& tmpPolygon);
153 virtual void DispatchInputVectors(
void);
156 virtual void GatherOutputVectors(
void);
159 virtual void FillOneOutput(
unsigned int outIdx,
ogr::DataSource* outDS,
bool update);
173 void ClearAdditionalFields();
176 void CreateAdditionalField(std::string name, OGRFieldType type,
int width = 0,
int precision = 0);
179 const std::vector<SimpleFieldDefn>& GetAdditionalFields();
182 static ITK_THREAD_RETURN_TYPE VectorThreaderCallback(
void* arg);
191 ogr::Layer GetInMemoryInput(
unsigned int threadId);
194 ogr::Layer GetInMemoryOutput(
unsigned int threadId,
unsigned int index = 0);
198 void operator=(
const Self&) =
delete;
226 #ifndef OTB_MANUAL_INSTANTIATION