TECA
teca_connected_components.h
1 #ifndef teca_connected_components_h
2 #define teca_connected_components_h
3 
4 #include "teca_shared_object.h"
5 #include "teca_algorithm.h"
6 #include "teca_metadata.h"
7 
8 #include <string>
9 #include <vector>
10 
11 TECA_SHARED_OBJECT_FORWARD_DECL(teca_connected_components)
12 
13 
46 {
47 public:
48  TECA_ALGORITHM_STATIC_NEW(teca_connected_components)
49  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_connected_components)
50  TECA_ALGORITHM_CLASS_NAME(teca_connected_components)
52 
53  // set the input array containing a binary segmentation
54  // see teca_binary_segmentation
55  TECA_ALGORITHM_PROPERTY(std::string, segmentation_variable)
56 
57  // set the name of the output array to store the component labels in
58  TECA_ALGORITHM_PROPERTY(std::string, component_variable)
59 
60 
61 protected:
63 
64  std::string get_component_variable(const teca_metadata &request);
65  std::string get_segmentation_variable(const teca_metadata &request);
66 
67 private:
68  teca_metadata get_output_metadata(unsigned int port,
69  const std::vector<teca_metadata> &input_md) override;
70 
71  std::vector<teca_metadata> get_upstream_request(
72  unsigned int port, const std::vector<teca_metadata> &input_md,
73  const teca_metadata &request) override;
74 
75  const_p_teca_dataset execute( unsigned int port,
76  const std::vector<const_p_teca_dataset> &input_data,
77  const teca_metadata &request) override;
78 
79 private:
80  std::string component_variable;
81  std::string segmentation_variable;
82 };
83 
84 #endif
teca_metadata
Definition: teca_metadata.h:17
teca_connected_components
an algorithm that computes connected component labeling
Definition: teca_connected_components.h:46
teca_algorithm
Definition: teca_algorithm.h:25