ThreeB 1.1
Classes | Functions
SampledMultispot Namespace Reference

Classes

struct  SpotWithBackgroundMasked
 This class compute the log-diff-hess probability of a spot, given an image patch and background due to existing spots. More...
class  GibbsSampler
 Draw samples from the spot states given the spots positions and some data. More...
class  GibbsSampler2
 Gibbs sampling class which masks spots to reduce computation. More...

Functions

double intensity (double i)
double intensity (const pair< double, Vector< 4 > > &i)
template<class T >
void remove_spot (vector< vector< double > > &current_sample_intensities, const vector< T > &spot_intensities, const vector< State > &spot_sample)
template<class T >
void add_spot (vector< vector< double > > &current_sample_intensities, const vector< T > &spot_intensities, const vector< State > &spot_sample)
template<class T >
void remove_spot (vector< vector< double > > &current_sample_intensities, const vector< T > &spot_intensities, const vector< State > &spot_sample, const vector< int > &mask)
template<class T >
void add_spot (vector< vector< double > > &current_sample_intensities, const vector< T > &spot_intensities, const vector< State > &spot_sample, const vector< int > &mask)
template<class T >
void remove_spot (vector< vector< double > > &current_sample_intensities, const vector< vector< T > > &spot_intensities, const vector< State > &spot_sample, const vector< int > &mask)
template<class T >
void add_spot (vector< vector< double > > &current_sample_intensities, const vector< vector< T > > &spot_intensities, const vector< State > &spot_sample, const vector< int > &mask)
vector< double > compute_spot_intensity (const vector< ImageRef > &pixels, const Vector< 4 > &params)
vector< pair< double, Vector< 4 > > > compute_spot_intensity_derivatives (const vector< ImageRef > &pixels, const Vector< 4 > &params)
vector< tuple< double, Vector
< 4 >, Matrix< 4 > > > 
compute_spot_intensity_hessian (const vector< ImageRef > &pixels, const Vector< 4 > &params)
vector< int > sequence (int n)

Function Documentation

double SampledMultispot::intensity ( double  i) [inline]

Definition at line 46 of file sampled_multispot.h.

Referenced by add_spot(), and remove_spot().

{
    return i;
}
double SampledMultispot::intensity ( const pair< double, Vector< 4 > > &  i) [inline]

Definition at line 51 of file sampled_multispot.h.

{
    return i.first;
}
template<class T >
void SampledMultispot::remove_spot ( vector< vector< double > > &  current_sample_intensities,
const vector< T > &  spot_intensities,
const vector< State > &  spot_sample 
)

Definition at line 59 of file sampled_multispot.h.

References intensity().

Referenced by SampledMultispot::GibbsSampler2::next(), SampledMultispot::GibbsSampler::next(), FitSpots::optimize_each_spot_in_turn_for_several_passes(), and FitSpots::try_modifying_model().

{
    for(unsigned int frame=0; frame < current_sample_intensities.size(); frame++)
        if(spot_sample[frame] == 0) //Spot is on, so remove it
            for(unsigned int p=0; p < spot_intensities.size(); p++)
                current_sample_intensities[frame][p] -= intensity(spot_intensities[p]);
}
template<class T >
void SampledMultispot::add_spot ( vector< vector< double > > &  current_sample_intensities,
const vector< T > &  spot_intensities,
const vector< State > &  spot_sample 
)

Definition at line 68 of file sampled_multispot.h.

References intensity().

Referenced by SampledMultispot::GibbsSampler2::next(), SampledMultispot::GibbsSampler::next(), and FitSpots::try_modifying_model().

{
    for(unsigned int frame=0; frame < current_sample_intensities.size(); frame++)
        if(spot_sample[frame] == 0) //Spot is on, so add it
            for(unsigned int p=0; p < spot_intensities.size(); p++)
                current_sample_intensities[frame][p] += intensity(spot_intensities[p]);
}
template<class T >
void SampledMultispot::remove_spot ( vector< vector< double > > &  current_sample_intensities,
const vector< T > &  spot_intensities,
const vector< State > &  spot_sample,
const vector< int > &  mask 
)

Definition at line 79 of file sampled_multispot.h.

References intensity().

{
    for(unsigned int frame=0; frame < current_sample_intensities.size(); frame++)
        if(spot_sample[frame] == 0) //Spot is on, so remove it
            for(unsigned int p=0; p < mask.size(); p++)
                current_sample_intensities[frame][mask[p]] -= intensity(spot_intensities[mask[p]]);
}
template<class T >
void SampledMultispot::add_spot ( vector< vector< double > > &  current_sample_intensities,
const vector< T > &  spot_intensities,
const vector< State > &  spot_sample,
const vector< int > &  mask 
)

Definition at line 88 of file sampled_multispot.h.

References intensity().

{
    for(unsigned int frame=0; frame < current_sample_intensities.size(); frame++)
        if(spot_sample[frame] == 0) //Spot is on, so add it
            for(unsigned int p=0; p < mask.size(); p++)
                current_sample_intensities[frame][mask[p]] += intensity(spot_intensities[mask[p]]);
}
template<class T >
void SampledMultispot::remove_spot ( vector< vector< double > > &  current_sample_intensities,
const vector< vector< T > > &  spot_intensities,
const vector< State > &  spot_sample,
const vector< int > &  mask 
)

Definition at line 99 of file sampled_multispot.h.

References intensity(), and spot_intensities.

{
    const int steps = spot_intensities.size();
    const int frames = current_sample_intensities.size();

    for(int frame=0; frame < frames; frame++)
    {
        int s = frame * steps / frames;

        if(spot_sample[frame] == 0) //Spot is on, so remove it
            for(unsigned int p=0; p < mask.size(); p++)
                current_sample_intensities[frame][mask[p]] -= intensity(spot_intensities[s][mask[p]]);
    }
}
template<class T >
void SampledMultispot::add_spot ( vector< vector< double > > &  current_sample_intensities,
const vector< vector< T > > &  spot_intensities,
const vector< State > &  spot_sample,
const vector< int > &  mask 
)

Definition at line 115 of file sampled_multispot.h.

References intensity(), and spot_intensities.

{
    const int steps = spot_intensities.size();
    const int frames = current_sample_intensities.size();

    for(int frame=0; frame < frames; frame++)
    {
        int s = frame * steps / frames;

        if(spot_sample[frame] == 0) //Spot is on, so add it
            for(unsigned int p=0; p < mask.size(); p++)
                current_sample_intensities[frame][mask[p]] += intensity(spot_intensities[s][mask[p]]);
    }
}
vector<double> SampledMultispot::compute_spot_intensity ( const vector< ImageRef > &  pixels,
const Vector< 4 > &  params 
) [inline]

Definition at line 133 of file sampled_multispot.h.

Referenced by NegativeFreeEnergy::compute_with_mask(), FreeEnergyHessian::hessian(), NegativeFreeEnergy::operator()(), FitSpots::optimize_each_spot_in_turn_for_several_passes(), sampled_background_spot_hessian_ffbs(), and FitSpots::try_modifying_model().

{
    vector<double> intensities(pixels.size());

    for(unsigned int i=0; i < pixels.size(); i++)
        intensities[i] = spot_shape(vec(pixels[i]), params);

    return intensities;
}
vector<pair<double, Vector<4> > > SampledMultispot::compute_spot_intensity_derivatives ( const vector< ImageRef > &  pixels,
const Vector< 4 > &  params 
) [inline]

Definition at line 144 of file sampled_multispot.h.

Referenced by SpotNegProbabilityDiffWithSampledBackground::operator()().

{
    vector<pair<double, Vector<4> > > derivatives(pixels.size());

    for(unsigned int i=0; i < pixels.size(); i++)
        derivatives[i] = spot_shape_diff_position(vec(pixels[i]), params);
    return derivatives;
}
vector<tuple<double, Vector<4>, Matrix<4> > > SampledMultispot::compute_spot_intensity_hessian ( const vector< ImageRef > &  pixels,
const Vector< 4 > &  params 
) [inline]

Definition at line 153 of file sampled_multispot.h.

Referenced by FreeEnergyHessian::hessian(), sampled_background_spot_hessian2(), sampled_background_spot_hessian_FAKE(), and sampled_background_spot_hessian_ffbs().

{
    vector<tuple<double, Vector<4>, Matrix<4> > > hessian(pixels.size());

    for(unsigned int i=0; i < pixels.size(); i++)
        hessian[i] = spot_shape_hess_position(vec(pixels[i]), params);
    return hessian;
}