Classes | |
struct | MT19937 |
Useful wrapper for MT19937 random number generator class. More... | |
class | Kahan |
Class implementing the Kahan summation algorithm to allow accurate summation of very large numbers of doubles. More... | |
Typedefs | |
typedef std::pair < CVD::ImageRef, CVD::ImageRef > | BBox |
Functions | |
double | ln (double x) |
Vector | spots_to_Vector (const vector< Vector< 4 > > &s) |
vector< Vector< 4 > > | spots_to_vector (const Vector<> &s) |
Image< byte > | scale_to_bytes (const Image< float > &im, float lo, float hi) |
Image< byte > | scale_to_bytes (const Image< float > &im) |
Image< float > | average_image (const vector< Image< float > > &ims) |
vector< string > | split (const string &line) |
template<class C > | |
string | xtoa (const C &x) |
template<class C > | |
C | atox (const string &s, const string &msg) |
set< ImageRef > | dilate_mask (const vector< ImageRef > &v, double r) |
vector< int > | SampledMultispot::sequence (int n) |
double | sign (double x) |
float | sq (float f) |
const std::vector < CVD::SubImage< float > > | sub_images (const std::vector< CVD::Image< float > > &im, CVD::ImageRef pos, CVD::ImageRef size) |
std::pair< CVD::ImageRef, CVD::ImageRef > | boundingbox (const std::vector< CVD::ImageRef > &all_spots) |
template<class Stream > | |
void | open_or_die (Stream &save_spots, const std::string &save_spots_file) |
typedef std::pair<CVD::ImageRef, CVD::ImageRef> BBox |
double ln | ( | double | x | ) | [inline] |
Computes the natural logarithm, but returns -1e100 instead of inf for an input of 0.
This prevents trapping of FPU exceptions.
x | x |
Definition at line 34 of file forward_algorithm.h.
Referenced by backward_sampling(), diff_log_log_normal(), forward_algorithm(), forward_algorithm_delta(), forward_algorithm_delta2(), forward_algorithm_hessian(), forward_backward_algorithm(), hess_log_log_normal(), log_log_normal(), and FitSpots::try_modifying_model().
Vector spots_to_Vector | ( | const vector< Vector< 4 > > & | s | ) |
There are two sensible ways of storing the state vector of spot positions.
This function converts between them. See also spots_to_vector.
s | list of spots to convert |
Definition at line 96 of file multispot5.cc.
Referenced by fit_spots_historic(), FitSpots::optimize_each_spot_in_turn_for_several_passes(), FitSpots::run(), and FitSpots::try_modifying_model().
vector<Vector<4> > spots_to_vector | ( | const Vector<> & | s | ) |
There are two sensible ways of storing the state vector of spot positions.
This function converts between them. See also spots_to_Vector.
s | list of spots to convert |
Definition at line 113 of file multispot5.cc.
Referenced by NegativeFreeEnergy::compute_with_mask(), fit_spots_historic(), generate_state_parameters_ye_olde(), and NegativeFreeEnergy::operator()().
Image<byte> scale_to_bytes | ( | const Image< float > & | im, | |
float | lo, | |||
float | hi | |||
) |
Normalize an image for display purposes.
Definition at line 123 of file multispot5.cc.
Referenced by fit_spots_historic(), FitSpots::optimize_each_spot_in_turn_for_several_passes(), and FitSpots::try_modifying_model().
Image<byte> scale_to_bytes | ( | const Image< float > & | im | ) |
Normalize an image for display purposes.
Definition at line 134 of file multispot5.cc.
00135 { 00136 float lo = *min_element(im.begin(), im.end()); 00137 float hi = *max_element(im.begin(), im.end()); 00138 Image<byte> out(im.size()); 00139 for(int r=0; r < out.size().y-0; r++) 00140 for(int c=0; c < out.size().x-0; c++) 00141 out[r][c] = (int)floor((im[r][c]-lo)*255/(hi-lo)); 00142 00143 return out; 00144 }
Image<float> average_image | ( | const vector< Image< float > > & | ims | ) |
Average the input image stack for display purposes.
Definition at line 148 of file multispot5.cc.
References assert_same_size().
Referenced by fit_spots_historic().
00149 { 00150 assert_same_size(ims); 00151 Image<float> r(ims[0].size(), 0); 00152 00153 for(unsigned int i=0; i < ims.size(); i++) 00154 transform(r.begin(), r.end(), ims[i].begin(), r.begin(), plus<float>()); 00155 00156 transform(r.begin(), r.end(), r.begin(), bind2nd(multiplies<float>(), 1./ims.size())); 00157 return r; 00158 }
vector<string> split | ( | const string & | line | ) |
string xtoa | ( | const C & | x | ) | [inline] |
Generic version of itoa.
How many times has this been reimplemented??
x | Value to convert to string |
Definition at line 933 of file multispot5.cc.
Referenced by parse_log_file().
C atox | ( | const string & | s, | |
const string & | msg | |||
) | [inline] |
Inverse of xtoa() How many times has this been reimplemented??
s | String to convert | |
msg | Mesage to print on error |
Definition at line 945 of file multispot5.cc.
00946 { 00947 C c; 00948 istringstream i(s); 00949 i >> c; 00950 if(i.fail()) 00951 throw LogFileParseError("Error parsing " + msg + ". Text is `" + s + "'."); 00952 return c; 00953 }
set<ImageRef> dilate_mask | ( | const vector< ImageRef > & | v, | |
double | r | |||
) |
Very simple and inefficient dilation function.
Definition at line 1317 of file multispot5.cc.
vector<int> SampledMultispot::sequence | ( | int | n | ) | [inline] |
Create a sequence of integers.
These can be used as observations in an observation class by forward_algorithm() and etc.
n | Length of sequence |
Definition at line 188 of file sampled_multispot.h.
Referenced by fit_spots_historic(), and FitSpots::optimize_each_spot_in_turn_for_several_passes().
double sign | ( | double | x | ) | [inline] |
float sq | ( | float | f | ) | [inline] |
The ubiquitous square function.
f | Number to square |
Definition at line 48 of file utility.h.
Referenced by auto_fixed_scaling(), NegativeFreeEnergy::compute_with_mask(), diff_log_log_normal(), hess_log_log_normal(), log_log_normal(), log_normal_std(), log_probability_spot(), log_probability_spot_diff(), log_probability_spot_hess(), mean_and_variance(), NegativeFreeEnergy::operator()(), spot_shape_diff_position(), spot_shape_hess_position(), and NegativeFreeEnergy::variance_from_sample().
const std::vector<CVD::SubImage<float> > sub_images | ( | const std::vector< CVD::Image< float > > & | im, | |
CVD::ImageRef | pos, | |||
CVD::ImageRef | size | |||
) |
Cut sub images out of every member of a vector of images.
im | Images to be cut | |
pos | Top left corner | |
size | Size of the patch |
std::pair<CVD::ImageRef, CVD::ImageRef> boundingbox | ( | const std::vector< CVD::ImageRef > & | all_spots | ) |
Compute the bounding box of a set of points.
all_spots | List of points |
Referenced by fit_spots_historic(), FitSpots::optimize_each_spot_in_turn_for_several_passes(), and FitSpots::try_modifying_model().
void open_or_die | ( | Stream & | save_spots, | |
const std::string & | save_spots_file | |||
) | [inline] |
save_spots | Stream | |
save_spots_file | File to open |
Definition at line 83 of file utility.h.
Referenced by mmain().
00084 { 00085 using std::cerr; 00086 using std::endl; 00087 using std::strerror; 00088 using std::exit; 00089 save_spots.open(save_spots_file.c_str()); 00090 int err = errno; 00091 00092 if(!save_spots.good()) 00093 { 00094 cerr << "***********************************************************\n"; 00095 cerr << "ERROR: failed to open " << save_spots_file << ": " <<strerror(err) << endl; 00096 cerr << "***********************************************************\n"; 00097 exit(1); 00098 } 00099 }