27 #include "../geometry/Envelope.h"
28 #include "../geometry/Polygon.h"
29 #include "../raster/Raster.h"
30 #include "../raster/RasterFactory.h"
31 #include "../raster/Band.h"
32 #include "../raster/BandProperty.h"
33 #include "../raster/Grid.h"
42 : m_classifierStrategyParamsPtr(0)
48 : m_classifierStrategyParamsPtr(0)
62 if(m_classifierStrategyParamsPtr)
64 delete m_classifierStrategyParamsPtr;
65 m_classifierStrategyParamsPtr = 0;
73 return m_classifierStrategyParamsPtr;
79 m_inputRasterBands.clear();
80 m_inputPolygons.clear();
81 m_strategyName.clear();
83 if(m_classifierStrategyParamsPtr)
85 delete m_classifierStrategyParamsPtr;
86 m_classifierStrategyParamsPtr = 0;
130 m_outputRasterPtr.reset();
160 if(!m_instanceInitialized)
167 std::vector<te::rst::BandProperty*> bandsProperties;
169 m_inputParameters.m_inputRasterBands[0])->getProperty())));
172 bandsProperties[0]->m_noDataValue = 0;
179 "Output raster creation error");
185 "Unable to initialize the classification strategy");
186 TERP_TRUE_OR_RETURN_FALSE(strategyPtr->execute(*m_inputParameters.m_inputRasterPtr, m_inputParameters.m_inputRasterBands,
187 m_inputParameters.m_inputPolygons, *outputParamsPtr->
m_outputRasterPtr, 0,
true),
188 "Unable to execute the classification strategy");
195 m_instanceInitialized =
false;
197 m_inputParameters.reset();
216 "Invalid raster bands number");
221 "Invalid raster bands" );
227 "Raster and Polygons does not fit");
231 m_instanceInitialized =
true;
233 m_inputParameters = *inputParamsPtr;
240 return m_instanceInitialized;
std::vector< te::gm::Polygon * > m_inputPolygons
The polygons to be classified when using object-based image analysis (OBIA).
bool m_instanceInitialized
Is this instance already initialized?
virtual AbstractParameters * clone() const =0
Create a clone copy of this instance.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Raster strategy parameters base class.
Raster Processing algorithm base interface class.
static Raster * make()
It creates and returns an empty raster with default raster driver.
te::rst::Raster const * m_inputRasterPtr
Input raster.
StrategyParameters const * getClassifierStrategyParams() const
Returns a pointer to the internal specific classifier strategy parameters, or null if no parameters a...
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
static te::rp::ClassifierStrategy * make(const std::string &factoryKey)
It creates an object with the appropriated factory.
std::vector< unsigned int > m_inputRasterBands
Bands to be processed from the input raster.
#define TERP_TRUE_OR_RETURN_FALSE(value, message)
Checks if value is true. For false values a warning message will be logged and a return of context wi...
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
const Classifier::OutputParameters & operator=(const Classifier::OutputParameters ¶ms)
Abstract parameters base interface.
te::gm::Envelope * getExtent()
Returns the geographic extension of the raster data.
A rectified grid is the spatial support for raster data.
Classifier output parameters.
Raster classifier strategy base class.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
std::auto_ptr< te::rst::Raster > m_outputRasterPtr
A pointer to the generated output raster (label image).
OutputParameters()
Default constructor.
te::common::AbstractParameters * clone() const
Create a clone copy of this instance.
const Algorithm & operator=(const Algorithm &)
Configuration flags for the Raster Processing module of TerraLib.
A raster band description.
te::common::AbstractParameters * clone() const
Create a clone copy of this instance.
std::string m_strategyName
The classifier strategy name see each te::rp::ClassifierStrategyFactory inherited classes documentati...
StrategyParameters * m_classifierStrategyParamsPtr
Internal specific classifier strategy parameters.
Raster Processing algorithm output parameters base interface.
void reset()
Clear all internal allocated objects and reset the algorithm to its initial state.
InputParameters()
Default constructor.
const Classifier::InputParameters & operator=(const Classifier::InputParameters ¶ms)
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
Classifier input parameters.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
Index into a lookup table.
bool isInitialized() const
Returns true if the algorithm instance is initialized and ready for execution.
void setClassifierStrategyParams(const StrategyParameters &p)
Set specific classifier strategy parameters.
Raster classifier strategy factory base class.
te::common::AccessPolicy getAccessPolicy() const
Returns the raster access policy.
Raster Processing algorithm input parameters base interface.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...