#include <pitsync1.h>
Inheritance diagram for FPSEGPT:
'Code to find the optimum fixed pitch segmentation of some blobs'
Definition at line 40 of file pitsync1.h.
FPSEGPT::FPSEGPT | ( | ) | [inline] |
FPSEGPT::FPSEGPT | ( | INT16 | x | ) |
Constructor to make a new FPSEGPT.
Definition at line 62 of file pitsync1.cpp.
References cost, fake_count, FALSE, mean_sum, mid_cuts, NULL, pred, sq_sum, and terminal.
00064 :xpos (x) { 00065 pred = NULL; 00066 mean_sum = 0; 00067 sq_sum = 0; 00068 cost = 0; 00069 faked = FALSE; 00070 terminal = FALSE; 00071 fake_count = 0; 00072 mid_cuts = 0; 00073 }
FPSEGPT::FPSEGPT | ( | INT16 | x, | |
BOOL8 | faking, | |||
INT16 | offset, | |||
INT16 | region_index, | |||
INT16 | pitch, | |||
INT16 | pitch_error, | |||
FPSEGPT_LIST * | prev_list | |||
) |
Constructor to make a new FPSEGPT.
Definition at line 79 of file pitsync1.cpp.
References cost, fake_count, FALSE, MAX_FLOAT32, MAX_INT16, mean_sum, mid_cuts, NULL, pred, sq_sum, terminal, and xpos.
00087 :xpos (x) { 00088 INT16 best_fake; //on previous 00089 FPSEGPT *segpt; //segment point 00090 INT32 dist; //from prev segment 00091 double sq_dist; //squared distance 00092 double mean; //mean pitch 00093 double total; //total dists 00094 double factor; //cost function 00095 FPSEGPT_IT pred_it = prev_list;//for previuos segment 00096 00097 cost = MAX_FLOAT32; 00098 pred = NULL; 00099 faked = faking; 00100 terminal = FALSE; 00101 best_fake = MAX_INT16; 00102 mid_cuts = 0; 00103 for (pred_it.mark_cycle_pt (); !pred_it.cycled_list (); pred_it.forward ()) { 00104 segpt = pred_it.data (); 00105 if (segpt->fake_count < best_fake) 00106 best_fake = segpt->fake_count; 00107 dist = x - segpt->xpos; 00108 if (dist >= pitch - pitch_error && dist <= pitch + pitch_error 00109 && !segpt->terminal) { 00110 total = segpt->mean_sum + dist; 00111 sq_dist = dist * dist + segpt->sq_sum + offset * offset; 00112 //sum of squarees 00113 mean = total / region_index; 00114 factor = mean - pitch; 00115 factor *= factor; 00116 factor += sq_dist / (region_index) - mean * mean; 00117 if (factor < cost) { 00118 cost = factor; //find least cost 00119 pred = segpt; //save path 00120 mean_sum = total; 00121 sq_sum = sq_dist; 00122 fake_count = segpt->fake_count + faked; 00123 } 00124 } 00125 } 00126 if (fake_count > best_fake + 1) 00127 pred = NULL; //fail it 00128 }
FPSEGPT::FPSEGPT | ( | FPCUTPT * | cutpt | ) |
Constructor to make a new FPSEGPT. The existing FPCUTPT is duplicated.
Definition at line 44 of file pitsync1.cpp.
References FPCUTPT::cheap_cuts(), cost, FPCUTPT::cost_function(), FPCUTPT::fake_count, fake_count, FPCUTPT::faked, mean_sum, mid_cuts, NULL, FPCUTPT::position(), pred, sq_sum, FPCUTPT::squares(), FPCUTPT::sum(), FPCUTPT::terminal, terminal, and xpos.
00046 { 00047 pred = NULL; 00048 mean_sum = cutpt->sum (); 00049 sq_sum = cutpt->squares (); 00050 cost = cutpt->cost_function (); 00051 faked = cutpt->faked; 00052 terminal = cutpt->terminal; 00053 fake_count = cutpt->fake_count; 00054 xpos = cutpt->position (); 00055 mid_cuts = cutpt->cheap_cuts (); 00056 }
INT16 FPSEGPT::cheap_cuts | ( | ) | const [inline] |
Definition at line 72 of file pitsync1.h.
References mid_cuts.
00072 { //no of cheap cuts 00073 return mid_cuts; 00074 }
double FPSEGPT::cost_function | ( | ) | [inline] |
Definition at line 60 of file pitsync1.h.
References cost.
Referenced by check_pitch_sync(), and make_illegal_segment().
00060 { 00061 return cost; 00062 }
void ELIST_LINK::de_serialise_asc | ( | FILE * | f | ) | [inherited] |
Reimplemented in ICOORDELT.
Definition at line 39 of file elst.cpp.
References ABORT, ERRCODE::error(), and SERIALISE_LINKS.
00040 { 00041 SERIALISE_LINKS.error ("ELIST_LINK::de_serialise_asc", ABORT, 00042 "Don't call this, override!"); 00043 }
FPSEGPT::NEWDELETE2 | ( | FPSEGPT | ) |
INT32 FPSEGPT::position | ( | ) | [inline] |
Definition at line 57 of file pitsync1.h.
References xpos.
Referenced by make_illegal_segment(), plot_fp_cells(), and plot_fp_cells2().
00057 { //acces func 00058 return xpos; 00059 }
FPSEGPT* FPSEGPT::previous | ( | ) | [inline] |
Definition at line 69 of file pitsync1.h.
References pred.
Referenced by check_pitch_sync(), and make_illegal_segment().
00069 { 00070 return pred; 00071 }
void ELIST_LINK::serialise_asc | ( | FILE * | f | ) | [inherited] |
Generates an error, as it should never be called.
Definition at line 32 of file elst.cpp.
References ABORT, ERRCODE::error(), and SERIALISE_LINKS.
00033 { 00034 SERIALISE_LINKS.error ("ELIST_LINK::serialise_asc", ABORT, 00035 "Don't call this, override!"); 00036 }
double FPSEGPT::squares | ( | ) | [inline] |
double FPSEGPT::sum | ( | ) | [inline] |
Definition at line 66 of file pitsync1.h.
References mean_sum.
00066 { 00067 return mean_sum; 00068 }
double FPSEGPT::cost [private] |
double FPSEGPT::mean_sum [private] |
INT16 FPSEGPT::mid_cuts [private] |
FPSEGPT* FPSEGPT::pred [private] |
double FPSEGPT::sq_sum [private] |
INT32 FPSEGPT::xpos [private] |