27 #include "../raster/Band.h"
28 #include "../raster/BandProperty.h"
29 #include "../raster/Grid.h"
30 #include "../raster/Raster.h"
31 #include "../raster/RasterFactory.h"
38 : m_mixtureModelStrategyParamsPtr(0)
44 : m_mixtureModelStrategyParamsPtr(0)
58 if(m_mixtureModelStrategyParamsPtr)
60 delete m_mixtureModelStrategyParamsPtr;
61 m_mixtureModelStrategyParamsPtr = 0;
69 return m_mixtureModelStrategyParamsPtr;
75 m_inputRasterBands.clear();
76 m_inputSensorBands.clear();
78 m_strategyName.clear();
80 if(m_mixtureModelStrategyParamsPtr)
82 delete m_mixtureModelStrategyParamsPtr;
83 m_mixtureModelStrategyParamsPtr = 0;
128 m_outputRasterPtr.reset();
129 m_normalizeOutput =
false;
130 m_createErrorRaster =
false;
162 if(!m_instanceInitialized)
169 std::vector<te::rst::BandProperty*> bandsProperties;
170 std::map<std::string, std::vector<double> >::iterator it;
171 for (it = m_inputParameters.m_components.begin(); it != m_inputParameters.m_components.end(); it++)
174 m_inputParameters.m_inputRasterBands[0])->getProperty()));
178 newbprop->
m_description =
"Mixture model band for class " + it->first;
180 bandsProperties.push_back(newbprop);
185 for (it = m_inputParameters.m_components.begin(); it != m_inputParameters.m_components.end(); it++)
188 m_inputParameters.m_inputRasterBands[0])->getProperty()));
192 newbprop->
m_description =
"Error raster for class " + it->first;
194 bandsProperties.push_back(newbprop);
203 "Output raster creation error");
205 if (m_inputParameters.m_inputSensorBands.size() == 0)
206 for (
unsigned b = 0; b < m_inputParameters.m_inputRasterBands.size(); b++)
207 m_inputParameters.m_inputSensorBands.push_back(
"default_sensor");
213 "Unable to initialize the mixture model strategy");
214 TERP_TRUE_OR_RETURN_FALSE(strategyPtr->execute(*m_inputParameters.m_inputRasterPtr, m_inputParameters.m_inputRasterBands,
215 m_inputParameters.m_inputSensorBands, m_inputParameters.m_components,
217 "Unable to execute the mixture model strategy");
227 m_instanceInitialized =
false;
229 m_inputParameters.reset();
248 "Invalid raster bands number");
253 TERP_LOGWARN(
"No information about sensors were provided, using defaults.");
258 "Invalid raster bands number");
265 "Invalid raster bands" );
268 std::map<std::string, std::vector<double> >::const_iterator it;
272 "Endmember's number of channels is bigger from input raster bands number");
276 "Number of components must be equal to the number of selected bands");
279 m_instanceInitialized =
true;
281 m_inputParameters = *inputParamsPtr;
288 return m_instanceInitialized;
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
virtual AbstractParameters * clone() const =0
Create a clone copy of this instance.
Raster decomposition using mixture model.
Index into a lookup table.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
A raster band description.
#define TERP_LOGWARN(message)
Logs a warning message.
Raster Processing algorithm output parameters base interface.
bool m_instanceInitialized
Is this instance already initialized?
int m_type
The data type of the elements in the band.
double m_noDataValue
Value to indicate elements where there is no data, default is std::numeric_limits::max().
Raster mixture model strategy factory base class.
Raster Processing functions.
#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...
const Algorithm & operator=(const Algorithm &)
te::common::AccessPolicy getAccessPolicy() const
Returns the raster access policy.
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
bool m_normalizeOutput
A flag to indicate that output raster will be normalized, by default [0, 255].
bool NormalizeRaster(te::rst::Raster &inraster, double nmin, double nmax)
Normalizes one raster in a given interval.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
Raster strategy parameters base class.
std::auto_ptr< te::rst::Raster > m_outputRasterPtr
A pointer to the generated output raster, one band per component plus one error band per component (w...
static te::rp::MixtureModelStrategy * make(const std::string &factoryKey)
It creates an object with the appropriated factory.
Abstract parameters base interface.
MixtureModel output parameters.
te::common::AbstractParameters * clone() const
Create a clone copy of this instance.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
bool isInitialized() const
Returns true if the algorithm instance is initialized and ready for execution.
static Raster * make()
It creates and returns an empty raster with default raster driver.
const MixtureModel::OutputParameters & operator=(const MixtureModel::OutputParameters ¶ms)
Raster mixture model strategy base class.
std::string m_description
A description.
bool m_createErrorRaster
A flag to indicate that output raster will include the error bands.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
A rectified grid is the spatial support for raster data.
ColorInterp m_colorInterp
The color interpretation.
void reset()
Clear all internal allocated objects and reset the algorithm to its initial state.
OutputParameters()
Default constructor.