TECA
The Toolkit for Extreme Climate Analysis
teca_component_area_filter Class Reference

An algorithm that applies a mask based on connected component area. More...

#include <teca_component_area_filter.h>

Inheritance diagram for teca_component_area_filter:
[legend]
Collaboration diagram for teca_component_area_filter:
[legend]

Public Member Functions

std::shared_ptr< teca_component_area_filtershared_from_this ()
 
std::shared_ptr< teca_component_area_filter const > shared_from_this () const
 
 teca_component_area_filter (const teca_component_area_filter &src)=delete
 
 teca_component_area_filter (teca_component_area_filter &&src)=delete
 
teca_component_area_filteroperator= (const teca_component_area_filter &src)=delete
 
teca_component_area_filteroperator= (teca_component_area_filter &&src)=delete
 
const char * get_class_name () const override
 
component_variable
void set_component_variable (const std::string &v)
 
const std::string & get_component_variable () const
 
number_of_components_key

set the name of the dataset metadata key holding the number of components left after the filter is applied

void set_number_of_components_key (const std::string &v)
 
const std::string & get_number_of_components_key () const
 
component_ids_key

set the name of the dataset metadata key holding connected component label ids

void set_component_ids_key (const std::string &v)
 
const std::string & get_component_ids_key () const
 
component_area_key

set the name of the dataset metadata key holding connected component areas

void set_component_area_key (const std::string &v)
 
const std::string & get_component_area_key () const
 
mask_value

set this to be the default label id for the filtered out component areas. This will typically correspond to the label used for cells outside of the segmentation (i.e. in the background). One can use this property to override the mask value. The default mask value is '-1' which results in aquiring the mask value from input metadata key background_id. Use -2 to specify no background label.

void set_mask_value (const long long &v)
 
const long long & get_mask_value () const
 
low_area_threshold

set the range identifying values to area filter. The defaults are (-infinity, infinity].

void set_low_area_threshold (const double &v)
 
const double & get_low_area_threshold () const
 
high_area_threshold
void set_high_area_threshold (const double &v)
 
const double & get_high_area_threshold () const
 
variable_postfix

a string to be appended to the name of the output variable. setting this to an empty string will result in the masked array replacing the input array in the output. default is an empty string ""

void set_variable_postfix (const std::string &v)
 
const std::string & get_variable_postfix () const
 
contiguous_component_ids

set this only if you know for certain that label ids are contiguous and start at 0. this enables use of a faster implementation.

void set_contiguous_component_ids (const int &v)
 
const int & get_contiguous_component_ids () const
 
- Public Member Functions inherited from teca_algorithm
 teca_algorithm (const teca_algorithm &src)=delete
 
 teca_algorithm (teca_algorithm &&src)=delete
 
teca_algorithmoperator= (const teca_algorithm &src)=delete
 
teca_algorithmoperator= (teca_algorithm &&src)=delete
 
void set_communicator (MPI_Comm comm)
 
MPI_Comm get_communicator ()
 get the active communicator More...
 
virtual teca_algorithm_output_port get_output_port (unsigned int port=0)
 
void set_input_connection (const teca_algorithm_output_port &port)
 set an input to this algorithm More...
 
virtual void set_input_connection (unsigned int id, const teca_algorithm_output_port &port)
 set an input to this algorithm More...
 
virtual void remove_input_connection (unsigned int id)
 remove input connections More...
 
void clear_input_connections ()
 remove all input connections More...
 
const_p_teca_dataset get_output_data (unsigned int port=0)
 
void pop_cache (unsigned int port=0, int top=0)
 
void set_cache_size (unsigned int n)
 set the cache size. the default is 1. (threadsafe) More...
 
virtual int update ()
 execute the pipeline from this instance up. More...
 
virtual int update (unsigned int port)
 execute the pipeline from this instance up. More...
 
virtual teca_metadata update_metadata (unsigned int port=0)
 get meta data considering this instance up. More...
 
void set_executive (p_teca_algorithm_executive exe)
 set the executive More...
 
p_teca_algorithm_executive get_executive ()
 get the executive More...
 
virtual void to_stream (std::ostream &s) const
 
virtual void from_stream (std::istream &s)
 deserialize from the stream. More...
 
void set_verbose (const int &v)
 
const int & get_verbose () const
 

Static Public Member Functions

static p_teca_component_area_filter New ()
 

Additional Inherited Members

- Protected Member Functions inherited from teca_algorithm
void set_number_of_input_connections (unsigned int n)
 
void set_number_of_output_ports (unsigned int n)
 
virtual void set_modified ()
 
void set_modified (unsigned int port)
 an overload to set_modified by port More...
 
virtual teca_metadata get_cache_key (unsigned int port, const teca_metadata &request) const
 
virtual teca_metadata get_output_metadata (teca_algorithm_output_port &current)
 
virtual const_p_teca_dataset request_data (teca_algorithm_output_port &port, const teca_metadata &request)
 
virtual int validate_cache (teca_algorithm_output_port &current)
 
virtual void clear_modified (teca_algorithm_output_port current)
 
const_p_teca_dataset get_output_data (unsigned int port, const teca_metadata &request)
 
int cache_output_data (unsigned int port, const teca_metadata &request, const_p_teca_dataset &data)
 
void clear_cache (unsigned int port)
 clear the cache on the given output port More...
 
unsigned int get_number_of_input_connections ()
 get the number of input connections More...
 
teca_algorithm_output_portget_input_connection (unsigned int i)
 
void clear_modified (unsigned int port)
 clear the modified flag on the i'th output More...
 
int get_modified (unsigned int port) const
 return the output port's modified flag value More...
 
- Protected Attributes inherited from teca_algorithm
int verbose
 

Detailed Description

An algorithm that applies a mask based on connected component area.

The filter masks the regions identified by an integer label that are outside the range bracketed by the 'low_area_threshold' and 'high_area_threshold' properties. These default to -inf and +inf, hence by default no regions are masked. The mask value may be set by the 'mask_value' property which defaults to '0'.

The filter expects an integer field containing connected component labels. This field is named by the 'component_variable' property. Additionally a list of label ids and coresponding areas is expected in the dataset metadata. The properties 'component_ids_key' and 'component_area_key' identify the latter metadata. These default to the names used by the 'teca_2d_component_area' algotihm, 'component_ids' and 'component_area'.

Applying the 'teca_connected_component' algorithm followed by the 'teca_2d_component_area' algorithm is the easiest way to get valid inputs for the 'component_area_filter'.

The filtered coomponent ids are put in the output dataset along with the updated lists of valid component ids and component area metadata keys. By default the filtered data replaces the input data in the output. However, the input data can be retained by setting the 'variable_postfix' property, a string that will be appended to the names of the filtered component array and metadata keys.

Member Function Documentation

◆ get_class_name()

const char* teca_component_area_filter::get_class_name ( ) const
inlineoverridevirtual

returns the name of the class

Implements teca_algorithm.

◆ get_component_area_key()

const std::string& teca_component_area_filter::get_component_area_key ( ) const
inline

Get the value of the component_area_key algorithm property

◆ get_component_ids_key()

const std::string& teca_component_area_filter::get_component_ids_key ( ) const
inline

Get the value of the component_ids_key algorithm property

◆ get_component_variable()

const std::string& teca_component_area_filter::get_component_variable ( ) const
inline

Get the value of the component_variable algorithm property

◆ get_contiguous_component_ids()

const int& teca_component_area_filter::get_contiguous_component_ids ( ) const
inline

Get the value of the contiguous_component_ids algorithm property

◆ get_high_area_threshold()

const double& teca_component_area_filter::get_high_area_threshold ( ) const
inline

Get the value of the high_area_threshold algorithm property

◆ get_low_area_threshold()

const double& teca_component_area_filter::get_low_area_threshold ( ) const
inline

Get the value of the low_area_threshold algorithm property

◆ get_mask_value()

const long long& teca_component_area_filter::get_mask_value ( ) const
inline

Get the value of the mask_value algorithm property

◆ get_number_of_components_key()

const std::string& teca_component_area_filter::get_number_of_components_key ( ) const
inline

Get the value of the number_of_components_key algorithm property

◆ get_variable_postfix()

const std::string& teca_component_area_filter::get_variable_postfix ( ) const
inline

Get the value of the variable_postfix algorithm property

◆ New()

static p_teca_component_area_filter teca_component_area_filter::New ( )
inlinestatic

Returns an instance of teca_component_area_filter

◆ set_component_area_key()

void teca_component_area_filter::set_component_area_key ( const std::string &  v)
inline

Set the value of the component_area_key algorithm property

◆ set_component_ids_key()

void teca_component_area_filter::set_component_ids_key ( const std::string &  v)
inline

Set the value of the component_ids_key algorithm property

◆ set_component_variable()

void teca_component_area_filter::set_component_variable ( const std::string &  v)
inline

Set the value of the component_variable algorithm property

◆ set_contiguous_component_ids()

void teca_component_area_filter::set_contiguous_component_ids ( const int &  v)
inline

Set the value of the contiguous_component_ids algorithm property

◆ set_high_area_threshold()

void teca_component_area_filter::set_high_area_threshold ( const double &  v)
inline

Set the value of the high_area_threshold algorithm property

◆ set_low_area_threshold()

void teca_component_area_filter::set_low_area_threshold ( const double &  v)
inline

Set the value of the low_area_threshold algorithm property

◆ set_mask_value()

void teca_component_area_filter::set_mask_value ( const long long &  v)
inline

Set the value of the mask_value algorithm property

◆ set_number_of_components_key()

void teca_component_area_filter::set_number_of_components_key ( const std::string &  v)
inline

Set the value of the number_of_components_key algorithm property

◆ set_variable_postfix()

void teca_component_area_filter::set_variable_postfix ( const std::string &  v)
inline

Set the value of the variable_postfix algorithm property

◆ shared_from_this() [1/2]

std::shared_ptr< teca_component_area_filter > teca_component_area_filter::shared_from_this ( )
inline

Enables the static constructor

◆ shared_from_this() [2/2]

std::shared_ptr< teca_component_area_filter const> teca_component_area_filter::shared_from_this ( ) const
inline

Enables the static constructor


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