Raster classifier strategy base class. More...
#include <ClassifierStrategy.h>
Public Member Functions | |
| void | enableMultiThread (const bool &enable) |
| Enable / disable the use of multiple threads. More... | |
| void | enableOutputPalette (const bool enabled) |
| Enable (true) or disable (false) the creation of a paletted output raster. More... | |
| void | enableProgressInterface (const bool &enable) |
| Enable / disable the progress interface. More... | |
| void | enableRasterCache (const bool &enable) |
| Enable / disable the use of raster data cache. More... | |
| virtual bool | execute () _NOEXCEPT_OP(false)=0 |
| Executes the classification strategy. More... | |
| const std::string & | getErrorMessage () const |
| Return the current error message if there is any. More... | |
| void | getMetaData (std::map< std::string, std::string > &metadata) const |
| Returns strategy-dependent metadata. More... | |
| virtual bool | initialize (ClassifierStrategyParameters const *const strategyParams) _NOEXCEPT_OP(false)=0 |
| Initialize the classification strategy. More... | |
| std::unique_ptr< te::rst::Raster > | releaseOutputRaster () |
| Returns a pointer to the output raster or a void pointer if there is none. More... | |
| void | setInputPolygons (const std::vector< te::gm::Polygon * > &polygonsPtrs) |
| Set the input polygons. More... | |
| void | setInputRaster (const te::rst::Raster &raster) |
| Set the input raster. More... | |
| void | setInputRasterBands (const std::vector< unsigned int > &rasterBands) |
| Set the input raste bandsr. More... | |
| void | setUserOutputPalette (std::vector< te::rst::BandProperty::ColorEntry > &userPalette) |
| Set the output user palette. More... | |
| virtual | ~ClassifierStrategy () |
| Virtual destructor. More... | |
Protected Member Functions | |
| ClassifierStrategy () | |
| Default constructor. More... | |
| bool | createOutputRaster (const std::vector< int > &bandsDataTypes, const std::vector< double > &noDataValues) |
| Create the output raster using the EXPANSIBLE driver. More... | |
| virtual void | reset () |
| Reset to an initial state. More... | |
| void | setErrorMessage (const std::string &newErrorMessage) |
| Set the current error message. More... | |
| bool | setOutputRasterPalette (const unsigned int size) |
| Create and set the output raster palette folowing the current internal settings. More... | |
Protected Attributes | |
| bool | m_createRasterPalette |
| Enable (true) or disable (false) the creation of a paletted output raster. More... | |
| bool | m_enableMultiThread |
| Enable or disable the use multipe threads. More... | |
| bool | m_enableRasterCache |
| Enable or disable the use a raster data cache. More... | |
| std::vector< te::gm::Polygon * > const * | m_inputPolygonsPtr |
| Input polygons. More... | |
| std::vector< unsigned int > | m_inputRasterBands |
| Input raster bands. More... | |
| te::rst::Raster const * | m_inputRasterPtr |
| A pointer to the input raster. More... | |
| std::map< std::string, std::string > | m_metaData |
| Strategy-dependent metadata. More... | |
| std::unique_ptr< te::rst::Raster > | m_outputRasterPtr |
| A pointer to the output raster. More... | |
| bool | m_progressInterfaceEnabled |
| Progress interface status. More... | |
| std::vector< te::rst::BandProperty::ColorEntry > | m_userOutputPalette |
| User output raster palette (it must be large enough to accomodate all classifyier generated classes or an empty vector to automatically generate an random palette. More... | |
Private Member Functions | |
| ClassifierStrategy (const ClassifierStrategy &rhs) | |
| Copy constructor. More... | |
| const ClassifierStrategy & | operator= (const ClassifierStrategy &rhs) |
| Assignment operator. More... | |
Private Attributes | |
| std::string | m_errorMessage |
| Current error message. More... | |
Raster classifier strategy base class.
Definition at line 48 of file ClassifierStrategy.h.
|
virtualdefault |
Virtual destructor.
Referenced by ClassifierStrategy().
|
protected |
Default constructor.
Definition at line 31 of file ClassifierStrategy.cpp.
References reset(), and ~ClassifierStrategy().
|
private |
Copy constructor.
| rhs | The right-hand side Raster. |
Definition at line 38 of file ClassifierStrategy.cpp.
References operator=(), and reset().
|
protected |
Create the output raster using the EXPANSIBLE driver.
| bandsDataTypes | Bands data types. |
| noDataValues | A vector of no-data values for each band. |
Definition at line 105 of file ClassifierStrategy.cpp.
References te::rst::Raster::getBand(), te::rst::Raster::getGrid(), te::rst::Band::getProperty(), te::rst::GrayIdxCInt, te::sa::Grid, te::rst::BandProperty::m_colorInterp, m_inputRasterBands, m_inputRasterPtr, te::rst::BandProperty::m_noDataValue, m_outputRasterPtr, te::rst::BandProperty::m_type, te::rst::RasterFactory::make(), and TERP_TRUE_OR_THROW.
Referenced by te::rp::ClassifierDummyStrategy::execute(), te::rp::ClassifierKMeansStrategy::execute(), te::rp::ClassifierEDStrategy::execute(), te::rp::ClassifierEMStrategy::execute(), te::rp::ClassifierMAPStrategy::execute(), te::rp::ClassifierSAMStrategy::execute(), and te::rp::ClassifierISOSegStrategy::execute().
| void te::rp::ClassifierStrategy::enableMultiThread | ( | const bool & | enable | ) |
Enable / disable the use of multiple threads.
| enable | Enable (true) or disable (false) the use of multiple threads. |
Definition at line 80 of file ClassifierStrategy.cpp.
References m_enableMultiThread.
| void te::rp::ClassifierStrategy::enableOutputPalette | ( | const bool | enabled | ) |
Enable (true) or disable (false) the creation of a paletted output raster.
| enabled | Enable (true) or disable (false) the creation of a paletted output raster. |
Definition at line 90 of file ClassifierStrategy.cpp.
References m_createRasterPalette.
| void te::rp::ClassifierStrategy::enableProgressInterface | ( | const bool & | enable | ) |
Enable / disable the progress interface.
| enable | Enable (true) or disable (false) the progress interface. |
Definition at line 70 of file ClassifierStrategy.cpp.
References m_progressInterfaceEnabled.
| void te::rp::ClassifierStrategy::enableRasterCache | ( | const bool & | enable | ) |
Enable / disable the use of raster data cache.
| enable | Enable (true) or disable (false) the use of raster cache. |
Definition at line 75 of file ClassifierStrategy.cpp.
References m_enableRasterCache.
|
pure virtual |
Executes the classification strategy.
Implemented in te::rp::ClassifierISOSegStrategy, te::rp::ClassifierSAMStrategy, te::rp::ClassifierEMStrategy, te::rp::ClassifierMAPStrategy, te::rp::ClassifierEDStrategy, te::rp::ClassifierKMeansStrategy, and te::rp::ClassifierDummyStrategy.
| const std::string & te::rp::ClassifierStrategy::getErrorMessage | ( | ) | const |
Return the current error message if there is any.
Definition at line 100 of file ClassifierStrategy.cpp.
References m_errorMessage.
| void te::rp::ClassifierStrategy::getMetaData | ( | std::map< std::string, std::string > & | metadata | ) | const |
Returns strategy-dependent metadata.
| metadata | Strategy-dependent metadata. |
Definition at line 85 of file ClassifierStrategy.cpp.
References m_metaData.
|
pure virtual |
Initialize the classification strategy.
| strategyParams | A pointer to the user given specific classification strategy parameters ou NULL if no parameters are present. |
Implemented in te::rp::ClassifierISOSegStrategy, te::rp::ClassifierSAMStrategy, te::rp::ClassifierEMStrategy, te::rp::ClassifierMAPStrategy, te::rp::ClassifierEDStrategy, te::rp::ClassifierKMeansStrategy, and te::rp::ClassifierDummyStrategy.
|
private |
Assignment operator.
| rhs | The right-hand-side copy that would be used to copy from. |
Definition at line 44 of file ClassifierStrategy.cpp.
References reset().
Referenced by ClassifierStrategy().
| std::unique_ptr< te::rst::Raster > te::rp::ClassifierStrategy::releaseOutputRaster | ( | ) |
Returns a pointer to the output raster or a void pointer if there is none.
Definition at line 60 of file ClassifierStrategy.cpp.
References m_outputRasterPtr.
|
protectedvirtual |
Reset to an initial state.
Definition at line 185 of file ClassifierStrategy.cpp.
References m_createRasterPalette, m_enableMultiThread, m_enableRasterCache, m_errorMessage, m_inputPolygonsPtr, m_inputRasterBands, m_inputRasterPtr, m_metaData, m_outputRasterPtr, m_progressInterfaceEnabled, and m_userOutputPalette.
Referenced by ClassifierStrategy(), and operator=().
|
protected |
Set the current error message.
| newErrorMessage | New error message; |
Definition at line 180 of file ClassifierStrategy.cpp.
References m_errorMessage.
| void te::rp::ClassifierStrategy::setInputPolygons | ( | const std::vector< te::gm::Polygon * > & | polygonsPtrs | ) |
Set the input polygons.
| polygonsPtrs | Input polygons pointers. |
Definition at line 65 of file ClassifierStrategy.cpp.
References m_inputPolygonsPtr.
| void te::rp::ClassifierStrategy::setInputRaster | ( | const te::rst::Raster & | raster | ) |
Set the input raster.
| raster | Input raster. |
Definition at line 50 of file ClassifierStrategy.cpp.
References m_inputRasterPtr.
| void te::rp::ClassifierStrategy::setInputRasterBands | ( | const std::vector< unsigned int > & | rasterBands | ) |
Set the input raste bandsr.
| rasterBands | Input raster bands. |
Definition at line 55 of file ClassifierStrategy.cpp.
References m_inputRasterBands.
Create and set the output raster palette folowing the current internal settings.
| size | Palette size. |
Definition at line 145 of file ClassifierStrategy.cpp.
References te::rp::CreateFixedStepPalette(), m_createRasterPalette, m_outputRasterPtr, m_userOutputPalette, te::rst::PaletteIdxCInt, and te::rst::RGBPalInt.
Referenced by te::rp::ClassifierDummyStrategy::execute(), te::rp::ClassifierKMeansStrategy::execute(), te::rp::ClassifierEDStrategy::execute(), te::rp::ClassifierEMStrategy::execute(), te::rp::ClassifierMAPStrategy::execute(), te::rp::ClassifierSAMStrategy::execute(), and te::rp::ClassifierISOSegStrategy::execute().
| void te::rp::ClassifierStrategy::setUserOutputPalette | ( | std::vector< te::rst::BandProperty::ColorEntry > & | userPalette | ) |
Set the output user palette.
| userPalette | User output raster palette (it must be large enough to accomodate all classifyier generated classes or an empty vector to automatically generate an random palette. |
Definition at line 95 of file ClassifierStrategy.cpp.
References m_userOutputPalette.
|
protected |
Enable (true) or disable (false) the creation of a paletted output raster.
Definition at line 164 of file ClassifierStrategy.h.
Referenced by enableOutputPalette(), reset(), and setOutputRasterPalette().
|
protected |
Enable or disable the use multipe threads.
Definition at line 159 of file ClassifierStrategy.h.
Referenced by enableMultiThread(), te::rp::ClassifierISOSegStrategy::execute(), and reset().
|
protected |
Enable or disable the use a raster data cache.
Definition at line 154 of file ClassifierStrategy.h.
Referenced by enableRasterCache(), te::rp::ClassifierISOSegStrategy::execute(), and reset().
|
private |
Current error message.
Definition at line 228 of file ClassifierStrategy.h.
Referenced by getErrorMessage(), reset(), and setErrorMessage().
|
protected |
Input polygons.
Definition at line 179 of file ClassifierStrategy.h.
Referenced by te::rp::ClassifierDummyStrategy::execute(), te::rp::ClassifierISOSegStrategy::execute(), reset(), and setInputPolygons().
|
protected |
Input raster bands.
Definition at line 174 of file ClassifierStrategy.h.
Referenced by createOutputRaster(), te::rp::ClassifierKMeansStrategy::execute(), te::rp::ClassifierEDStrategy::execute(), te::rp::ClassifierEMStrategy::execute(), te::rp::ClassifierMAPStrategy::execute(), te::rp::ClassifierSAMStrategy::execute(), te::rp::ClassifierISOSegStrategy::execute(), reset(), and setInputRasterBands().
|
protected |
A pointer to the input raster.
Definition at line 144 of file ClassifierStrategy.h.
Referenced by createOutputRaster(), te::rp::ClassifierKMeansStrategy::execute(), te::rp::ClassifierEDStrategy::execute(), te::rp::ClassifierEMStrategy::execute(), te::rp::ClassifierMAPStrategy::execute(), te::rp::ClassifierSAMStrategy::execute(), te::rp::ClassifierISOSegStrategy::execute(), reset(), and setInputRaster().
|
protected |
Strategy-dependent metadata.
Definition at line 184 of file ClassifierStrategy.h.
Referenced by getMetaData(), and reset().
|
protected |
A pointer to the output raster.
Definition at line 169 of file ClassifierStrategy.h.
Referenced by createOutputRaster(), te::rp::ClassifierDummyStrategy::execute(), te::rp::ClassifierKMeansStrategy::execute(), te::rp::ClassifierEDStrategy::execute(), te::rp::ClassifierEMStrategy::execute(), te::rp::ClassifierMAPStrategy::execute(), te::rp::ClassifierSAMStrategy::execute(), te::rp::ClassifierISOSegStrategy::execute(), releaseOutputRaster(), reset(), and setOutputRasterPalette().
|
protected |
Progress interface status.
Definition at line 149 of file ClassifierStrategy.h.
Referenced by enableProgressInterface(), te::rp::ClassifierEDStrategy::execute(), te::rp::ClassifierMAPStrategy::execute(), te::rp::ClassifierSAMStrategy::execute(), te::rp::ClassifierISOSegStrategy::execute(), and reset().
|
protected |
User output raster palette (it must be large enough to accomodate all classifyier generated classes or an empty vector to automatically generate an random palette.
Definition at line 189 of file ClassifierStrategy.h.
Referenced by reset(), setOutputRasterPalette(), and setUserOutputPalette().