.. _program_listing_file_larflow_FlowContourMatch_ContourFlowMatch.h: Program Listing for File ContourFlowMatch.h =========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``larflow/FlowContourMatch/ContourFlowMatch.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef __CONTOUR_FLOW_MATCH_t_H__ #define __CONTOUR_FLOW_MATCH_t_H__ #include #include namespace larflow { class ContourFlowMatch_t { public: ContourFlowMatch_t( int srcid=-1, int tarid=-1 ); virtual ~ContourFlowMatch_t() { matchingflow_map.clear(); } ContourFlowMatch_t( const ContourFlowMatch_t& s ); // copy constructor int src_ctr_id; // source contour id int tar_ctr_id; // target contour id float score; // score for this connection bool operator < ( const ContourFlowMatch_t& rhs ) const { if ( this->score < rhs.score ) return true; return false; }; struct FlowPixel_t { int src_wire; //< src col in full image int tar_wire; //< tar col in full image moving to nearest contour int tar_orig; //< tar col in full image using full int tick; //< tick in full image int row; //< row in full image float pred_miss; //< distance to nearest contour float dist2cropcenter; //< for source pixels with many predicts from overlapping crop, we trust those closest to center. FlowPixel_t() : src_wire(-1), tar_wire(-1), tar_orig(-1), tick(-1), row(-1), pred_miss(0.0), dist2cropcenter(0.0) {}; }; std::map > matchingflow_map; std::vector& getFlowPixelList( int src_index ) { auto it = matchingflow_map.find( src_index ); if ( it==matchingflow_map.end() ) { matchingflow_map.insert( std::pair >( src_index, std::vector() ) ); it = matchingflow_map.find( src_index ); } return it->second; }; }; typedef std::pair SrcTarPair_t; //< pair of source and target contour indices class ContourFlowMatchDict_t : public std::map { public: ContourFlowMatchDict_t() : index_map_initialized(false), src_ctr_pixel_v_initialized(false) {}; virtual ~ContourFlowMatchDict_t() {}; // map from image (row,col) position to contour index std::vector src_ctr_index_map; std::vector tar_ctr_index_map; bool index_map_initialized; // list of pixel indexes per source contour std::vector< std::vector > src_ctr_pixel_v; bool src_ctr_pixel_v_initialized; }; }; #endif