28 #include "../raster.h" 106 const std::vector< int >& bandsDataTypes,
107 const std::vector< double >& noDataValues )
111 TERP_TRUE_OR_THROW( noDataValues.size() == bandsDataTypes.size(),
"Invalid no-data values" );
115 std::vector<te::rst::BandProperty*> bandsProperties;
117 for(
unsigned int bandsDataTypesIdx=0; bandsDataTypesIdx < bandsDataTypes.size();
123 newbprop->
m_type = bandsDataTypes[bandsDataTypesIdx];
125 bandsProperties.push_back(newbprop);
130 std::map< std::string, std::string > m_rInfo;
135 bandsProperties, std::map< std::string, std::string >(),
nullptr,
nullptr));
152 std::vector< te::rst::BandProperty::ColorEntry > palette;
161 if( userOutputPaletteSize < size )
return false;
163 for( std::size_t pIdx = 0 ; pIdx < userOutputPaletteSize ; ++pIdx )
Palette indexes color interpretation.
void enableOutputPalette(const bool enabled)
Enable (true) or disable (false) the creation of a paletted output raster.
const ClassifierStrategy & operator=(const ClassifierStrategy &rhs)
Assignment operator.
Index into a lookup table.
bool m_createRasterPalette
Enable (true) or disable (false) the creation of a paletted output raster.
bool m_enableRasterCache
Enable or disable the use a raster data cache.
A raster band description.
RGB indexed palette interpretation.
virtual void reset()
Reset to an initial state.
bool createOutputRaster(const std::vector< int > &bandsDataTypes, const std::vector< double > &noDataValues)
Create the output raster using the EXPANSIBLE driver.
void setInputRasterBands(const std::vector< unsigned int > &rasterBands)
Set the input raste bandsr.
void setInputPolygons(const std::vector< te::gm::Polygon * > &polygonsPtrs)
Set the input polygons.
int m_type
The data type of the elements in the band ( See te::dt namespace basic data types for reference )...
std::map< std::string, std::string > m_metaData
Strategy-dependent metadata.
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits<double>::max().
void setUserOutputPalette(std::vector< te::rst::BandProperty::ColorEntry > &userPalette)
Set the output user palette.
ClassifierStrategy()
Default constructor.
std::vector< unsigned int > m_inputRasterBands
Input raster bands.
void setErrorMessage(const std::string &newErrorMessage)
Set the current error message.
An abstract class for raster data strucutures.
BandProperty * getProperty()
Returns the band property.
bool m_enableMultiThread
Enable or disable the use multipe threads.
virtual const Band * getBand(std::size_t i) const =0
Returns the raster i-th band.
const std::string & getErrorMessage() const
Return the current error message if there is any.
void enableProgressInterface(const bool &enable)
Enable / disable the progress interface.
Grid * getGrid()
It returns the raster grid.
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
A pointer to the output raster.
void getMetaData(std::map< std::string, std::string > &metadata) const
Returns strategy-dependent metadata.
bool m_progressInterfaceEnabled
Progress interface status.
te::rst::Raster const * m_inputRasterPtr
A pointer to the input raster.
std::unique_ptr< te::rst::Raster > releaseOutputRaster()
Returns a pointer to the output raster or a void pointer if there is none.
Raster classifier strategy base class.
static Raster * make()
It creates and returns an empty raster with default raster driver.
void CreateFixedStepPalette(const unsigned int paletteSize, const bool randomize, std::vector< te::rst::BandProperty::ColorEntry > &palette)
Create a fixed step sequential color palette.
Raster classifier strategy base class.
Raster Processing functions.
std::vector< te::rst::BandProperty::ColorEntry > m_userOutputPalette
User output raster palette (it must be large enough to accomodate all classifyier generated classes o...
void setInputRaster(const te::rst::Raster &raster)
Set the input raster.
A rectified grid is the spatial support for raster data.
std::vector< te::gm::Polygon * > const * m_inputPolygonsPtr
Input polygons.
ColorInterp m_colorInterp
The color interpretation.
void enableMultiThread(const bool &enable)
Enable / disable the use of multiple threads.
bool setOutputRasterPalette(const unsigned int size)
Create and set the output raster palette folowing the current internal settings.
void enableRasterCache(const bool &enable)
Enable / disable the use of raster data cache.
#define TERP_TRUE_OR_THROW(value, message)
Checks if value is true and throws an exception if not.
std::string m_errorMessage
Current error message.
virtual ~ClassifierStrategy()
Virtual destructor.