1 #ifndef teca_binary_segmentation_h
2 #define teca_binary_segmentation_h
4 #include "teca_shared_object.h"
5 #include "teca_algorithm.h"
6 #include "teca_metadata.h"
34 TECA_ALGORITHM_PROPERTY(std::string, segmentation_variable)
37 TECA_ALGORITHM_PROPERTY(
teca_metadata, segmentation_variable_attributes)
40 TECA_ALGORITHM_PROPERTY(std::string, threshold_variable)
43 TECA_ALGORITHM_PROPERTY(
double, low_threshold_value)
44 TECA_ALGORITHM_PROPERTY(
double, high_threshold_value)
49 enum {BY_VALUE=0, BY_PERCENTILE=1};
50 TECA_ALGORITHM_PROPERTY(
int, threshold_mode);
52 void set_threshold_by_percentile() { set_threshold_mode(BY_PERCENTILE); }
53 void set_threshold_by_value() { set_threshold_mode(BY_VALUE); }
58 int get_segmentation_variable(std::string &segmentation_var);
59 int get_threshold_variable(std::string &threshold_var);
63 const std::vector<teca_metadata> &input_md)
override;
65 std::vector<teca_metadata> get_upstream_request(
66 unsigned int port,
const std::vector<teca_metadata> &input_md,
69 const_p_teca_dataset execute(
unsigned int port,
70 const std::vector<const_p_teca_dataset> &input_data,
74 std::string segmentation_variable;
76 std::string threshold_variable;
77 double low_threshold_value;
78 double high_threshold_value;