te::rp::MajorityFilter Class Reference

This file contains a class that represents the method to remove pixels from classified image. More...

#include <MajorityFilter.h>

Inheritance diagram for te::rp::MajorityFilter:
te::rp::Algorithm

Classes

class  InputParameters
 Majority Filter input parameters. More...
 
class  OutputParameters
 Majority Filter output parameters. More...
 

Public Member Functions

bool execute (AlgorithmOutputParameters &outputParams) _NOEXCEPT_OP(false)
 Executes the algorithm using the supplied parameters. More...
 
const std::string & getErrorMessage () const
 Return the current error message if there is any. More...
 
bool initialize (const AlgorithmInputParameters &inputParams) _NOEXCEPT_OP(false)
 Initialize the algorithm instance making it ready for execution. More...
 
bool isInitialized () const
 Returns true if the algorithm instance is initialized and ready for execution. More...
 
 MajorityFilter ()
 
void reset () _NOEXCEPT_OP(false)
 Clear all internal allocated objects and reset the algorithm to its initial state. More...
 
 ~MajorityFilter ()
 

Protected Member Functions

void find4Neighbors (te::rst::Band &dstBand, unsigned int col, unsigned int row, int *contClass)
 Find the neighbors (right, down, left and up) of the pixel located in a given column and row. This function is used in the full filter. More...
 
void find8Neighbors (te::rst::Band &dstBand, unsigned int col, unsigned int row, int *contClass)
 Find the eight neighbors of the pixel located in a given column and row. This function is used in the full filter. More...
 
void findNeighbors (te::rst::Band &dstBand, unsigned int lcol, unsigned int lrow, unsigned int col, unsigned int row, int &index, int &totalPixel, int *contClass, std::vector< int > &veccol, std::vector< int > &vecrow)
 Find the neighbors (right, down, left and up) of the pixel located in a given column and row. This function is used in the simple filter. More...
 
bool FullFilter (const te::rst::Raster &srcRaster, const unsigned int srcBandIdx, const unsigned int dstBandIdx, const bool useProgress)
 Apply the full majority filter over the source raster band. More...
 
void setErrorMessage (const std::string &newErrorMessage)
 Set the current error message. More...
 
bool SimpleFilter (const te::rst::Raster &srcRaster, const unsigned int srcBandIdx, const unsigned int dstBandIdx, const bool useProgress)
 Apply the simple majority filter over the source raster band. More...
 

Protected Attributes

MajorityFilter::InputParameters m_inputParameters
 Input parameters. More...
 
bool m_isInitialized
 Is this instance already initialized? More...
 
te::rst::Rasterm_outputRaster
 Output raster. More...
 

Private Attributes

std::string m_errorMessage
 Current error message. More...
 

Detailed Description

This file contains a class that represents the method to remove pixels from classified image.

Definition at line 43 of file MajorityFilter.h.

Constructor & Destructor Documentation

◆ MajorityFilter()

te::rp::MajorityFilter::MajorityFilter ( )

◆ ~MajorityFilter()

te::rp::MajorityFilter::~MajorityFilter ( )

Member Function Documentation

◆ execute()

bool te::rp::MajorityFilter::execute ( AlgorithmOutputParameters outputParams)
virtual

Executes the algorithm using the supplied parameters.

Parameters
outputParamsOutput parameters.
Returns
true if OK, false on errors.
Note
A return error string can be obtained via Algorithm::getErrorMessage()

Implements te::rp::Algorithm.

◆ find4Neighbors()

void te::rp::MajorityFilter::find4Neighbors ( te::rst::Band dstBand,
unsigned int  col,
unsigned int  row,
int *  contClass 
)
protected

Find the neighbors (right, down, left and up) of the pixel located in a given column and row. This function is used in the full filter.

Parameters
dstBandOutput raster band.
colColumn of the current pixel
rowRow of the current pixel
contClassUsed to store the frequency of the classes

◆ find8Neighbors()

void te::rp::MajorityFilter::find8Neighbors ( te::rst::Band dstBand,
unsigned int  col,
unsigned int  row,
int *  contClass 
)
protected

Find the eight neighbors of the pixel located in a given column and row. This function is used in the full filter.

Parameters
dstBandOutput raster band.
colColumn of the current pixel
rowRow of the current pixel
contClassUsed to store the frequency of the classes

◆ findNeighbors()

void te::rp::MajorityFilter::findNeighbors ( te::rst::Band dstBand,
unsigned int  lcol,
unsigned int  lrow,
unsigned int  col,
unsigned int  row,
int &  index,
int &  totalPixel,
int *  contClass,
std::vector< int > &  veccol,
std::vector< int > &  vecrow 
)
protected

Find the neighbors (right, down, left and up) of the pixel located in a given column and row. This function is used in the simple filter.

Parameters
dstBandOutput raster band.
lcolColumn of the current pixel
lrowRow of the current pixel
colColumn of the neighbor pixel
rowRow of the neighbor pixel
indexIndex from vector of columns and rows
totalPixelTotal pixels found with same class as the current pixel
contClassUsed to store the frequency of the classes
veccolVector to store the columns of the pixels to change the class
vecrowVector to store the rows of the pixels to change the class

◆ FullFilter()

bool te::rp::MajorityFilter::FullFilter ( const te::rst::Raster srcRaster,
const unsigned int  srcBandIdx,
const unsigned int  dstBandIdx,
const bool  useProgress 
)
protected

Apply the full majority filter over the source raster band.

Parameters
srcRasterSource raster.
srcBandIdxSource raster band index.
dstBandIdxDestination raster band index.
useProgressif true, the progress interface must be used.

◆ getErrorMessage()

const std::string& te::rp::Algorithm::getErrorMessage ( ) const
inherited

Return the current error message if there is any.

Returns
Return the current error message if there is any.

◆ initialize()

bool te::rp::MajorityFilter::initialize ( const AlgorithmInputParameters inputParams)
virtual

Initialize the algorithm instance making it ready for execution.

Parameters
inputParamsInput parameters.
Returns
true if OK, false on errors.
Note
A return error string can be obtained via Algorithm::getErrorMessage()

Implements te::rp::Algorithm.

◆ isInitialized()

bool te::rp::MajorityFilter::isInitialized ( ) const
virtual

Returns true if the algorithm instance is initialized and ready for execution.

Returns
true if the algorithm instance is initialized and ready for execution.

Implements te::rp::Algorithm.

◆ reset()

void te::rp::MajorityFilter::reset ( )
virtual

Clear all internal allocated objects and reset the algorithm to its initial state.

Reimplemented from te::rp::Algorithm.

◆ setErrorMessage()

void te::rp::Algorithm::setErrorMessage ( const std::string &  newErrorMessage)
protectedinherited

Set the current error message.

Parameters
newErrorMessageNew error message;

◆ SimpleFilter()

bool te::rp::MajorityFilter::SimpleFilter ( const te::rst::Raster srcRaster,
const unsigned int  srcBandIdx,
const unsigned int  dstBandIdx,
const bool  useProgress 
)
protected

Apply the simple majority filter over the source raster band.

Parameters
srcRasterSource raster.
srcBandIdxSource raster band index.
dstBandIdxDestination raster band index.
useProgressif true, the progress interface must be used.

Member Data Documentation

◆ m_errorMessage

std::string te::rp::Algorithm::m_errorMessage
privateinherited

Current error message.

Definition at line 104 of file Algorithm.h.

◆ m_inputParameters

MajorityFilter::InputParameters te::rp::MajorityFilter::m_inputParameters
protected

Input parameters.

Definition at line 151 of file MajorityFilter.h.

◆ m_isInitialized

bool te::rp::MajorityFilter::m_isInitialized
protected

Is this instance already initialized?

Definition at line 149 of file MajorityFilter.h.

◆ m_outputRaster

te::rst::Raster* te::rp::MajorityFilter::m_outputRaster
protected

Output raster.

Definition at line 153 of file MajorityFilter.h.


The documentation for this class was generated from the following file: