|
ThreeB 1.1
|
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 15 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().
{
if(x == 0)
return -1e100;
else
return std::log(x);
}
| 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 99 of file multispot5.cc.
Referenced by FitSpots::optimize_each_spot_in_turn_for_several_passes(), FitSpots::run(), and FitSpots::try_modifying_model().
{
Vector<> r(s.size()*4);
for(unsigned int i=0; i < s.size(); i++)
{
r[i*4+0] = s[i][0];
r[i*4+1] = s[i][1];
r[i*4+2] = s[i][2];
r[i*4+3] = s[i][3];
}
return r;
}
| 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 116 of file multispot5.cc.
Referenced by NegativeFreeEnergy::compute_with_mask(), generate_state_parameters_ye_olde(), and NegativeFreeEnergy::operator()().
{
vector<Vector<4> > r(s.size()/4);
for(unsigned int i=0; i < r.size(); i++)
r[i] = s.slice<Dynamic, 4>(i*4, 4);
return r;
}
| Image<byte> scale_to_bytes | ( | const Image< float > & | im, |
| float | lo, | ||
| float | hi | ||
| ) |
Normalize an image for display purposes.
Definition at line 126 of file multispot5.cc.
{
Image<byte> out(im.size());
for(int r=0; r < out.size().y-0; r++)
for(int c=0; c < out.size().x-0; c++)
out[r][c] = (int)floor((im[r][c]-lo)*255/(hi-lo));
return out;
}
| Image<byte> scale_to_bytes | ( | const Image< float > & | im | ) |
Normalize an image for display purposes.
Definition at line 137 of file multispot5.cc.
{
float lo = *min_element(im.begin(), im.end());
float hi = *max_element(im.begin(), im.end());
Image<byte> out(im.size());
for(int r=0; r < out.size().y-0; r++)
for(int c=0; c < out.size().x-0; c++)
out[r][c] = (int)floor((im[r][c]-lo)*255/(hi-lo));
return out;
}
| Image<float> average_image | ( | const vector< Image< float > > & | ims | ) |
Average the input image stack for display purposes.
Definition at line 151 of file multispot5.cc.
References assert_same_size().
{
assert_same_size(ims);
Image<float> r(ims[0].size(), 0);
for(unsigned int i=0; i < ims.size(); i++)
transform(r.begin(), r.end(), ims[i].begin(), r.begin(), plus<float>());
transform(r.begin(), r.end(), r.begin(), bind2nd(multiplies<float>(), 1./ims.size()));
return r;
}
| vector<string> split | ( | const string & | line | ) |
Tokenize a line.
Definition at line 915 of file multispot5.cc.
Referenced by parse_log_file().
{
vector<string> v;
istringstream i(line);
string s;
while(!i.eof())
{
i >> s;
if(i.fail())
break;
v.push_back(s);
}
return v;
}
| 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 935 of file multispot5.cc.
Referenced by parse_log_file().
{
ostringstream os;
os << x;
return os.str();
}
| 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 947 of file multispot5.cc.
{
C c;
istringstream i(s);
i >> c;
if(i.fail())
throw LogFileParseError("Error parsing " + msg + ". Text is `" + s + "'.");
return c;
}
| set<ImageRef> dilate_mask | ( | const vector< ImageRef > & | v, |
| double | r | ||
| ) |
Very simple and inefficient dilation function.
Definition at line 1319 of file multispot5.cc.
{
vector<ImageRef> m = getDisc(r);
set<ImageRef> ret;
for(unsigned int i=0; i < v.size(); i++)
for(unsigned int j=0; j < m.size(); j++)
ret.insert(v[i] + m[j]);
return ret;
}
| 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 169 of file sampled_multispot.h.
Referenced by FitSpots::optimize_each_spot_in_turn_for_several_passes().
{
vector<int> v;
for(int i=0; i < n; i++)
v.push_back(i);
return v;
}
| double sign | ( | double | x | ) | [inline] |
| float sq | ( | float | f | ) | [inline] |
The ubiquitous square function.
| f | Number to square |
Definition at line 29 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(), NegativeFreeEnergy::operator()(), spot_shape_diff_position(), spot_shape_hess_position(), and NegativeFreeEnergy::variance_from_sample().
{ return f*f; }
| 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 |
Referenced by test_output_patch_variance().
| 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 mmain(), 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 | ||
| ) |
| save_spots | Stream |
| save_spots_file | File to open |
Definition at line 64 of file utility.h.
Referenced by mmain().
{
using std::cerr;
using std::endl;
using std::strerror;
using std::exit;
save_spots.open(save_spots_file.c_str());
int err = errno;
if(!save_spots.good())
{
cerr << "***********************************************************\n";
cerr << "ERROR: failed to open " << save_spots_file << ": " <<strerror(err) << endl;
cerr << "***********************************************************\n";
exit(1);
}
}
1.7.4