00001
00002
00003
00004
00005
00006 #ifndef EDGE_STRING_OP_H
00007 #define EDGE_STRING_OP_H
00008
00009 #include <boost/numeric/ublas/vector.hpp>
00010 #include "property_image.h"
00011 #include "edge_string.h"
00012
00013 namespace mimas {
00014
00015
00016 class edge_string_op
00017 {
00018
00019
00020
00021 static bool fast_mode;
00022
00023 static int shortSpur( const string_el &spur, const string_el &last, int thres, int count);
00024 static edge_string_ptr_list findEdgeStrings( property_image& input, int, double );
00025 static void pruneSpurs( string_el_ptr_list& junc_list, string_el_ptr_list& term_list );
00026 static void pruneTees(string_el_ptr_list& junc_list, string_el_ptr_list& term_list );
00027 static void pruneJuncs(string_el_ptr_list& junc_list, string_el_ptr_list& term_list );
00028 static void removeJuncs( string_el_ptr_list& junc_list,
00029 string_el_ptr_list& term_list );
00030 static void bridgeSmallGaps( string_el_ptr_list& term_list );
00031
00032 public:
00033 typedef boost::numeric::ublas::vector< double > Vector;
00034 static edge_string_ptr_list extractFromImage( property_image& im, int len_thres,
00035 double up_edge_thres );
00036 static edge_string_ptr_list findStrings( string_el_ptr_list& term_list );
00037 static edge_string_ptr findEdgeString( string_el_ptr el );
00038 static edge_string_ptr findLoop( string_el_ptr el );
00039 static void thresholdStrings( edge_string_ptr_list& strings,
00040 int lt, double t );
00041 static bool thresholdString( const edge_string& s, int len, double t );
00042 static void findContrastMaxima( edge_string& s, property_image& cim );
00043 static void filterWiggles( edge_string_ptr_list& edge_strings,
00044 double wiggle_thres, double len_thres, double contrast_thre );
00045
00046
00047 static void useFastMode() {fast_mode=true;}
00048 static void useNormalMode(){fast_mode=false;}
00049 static edge_string_ptr_list findEdgeStrings_Fast( property_image& input, int len_thres, double thres );
00050 static edge_string_ptr getString_Fast(property_image& input, int len_thres, double thres,
00051 int start_x, int start_y );
00052 static void firstHalf_Fast(property_image& input, double thres,
00053 int startx, int starty, edge_string& es,
00054 bool* crossed_thres, long *len );
00055 static void secondHalf_Fast(property_image& input, double thres,
00056 int startx, int starty, edge_string& es,
00057 bool* crossed_thres, long *len );
00058
00059
00060 };
00061
00062 };
00063
00064 #endif
00065
00066
00067