\hypertarget{namespaceSampledMultispot}{
\subsection{SampledMultispot Namespace Reference}
\label{namespaceSampledMultispot}\index{SampledMultispot@{SampledMultispot}}
}
\subsubsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structSampledMultispot_1_1SpotWithBackgroundMasked}{SpotWithBackgroundMasked}
\begin{DoxyCompactList}\small\item\em This class compute the log-\/diff-\/hess probability of a spot, given an image patch and background due to existing spots. \end{DoxyCompactList}\item 
class \hyperlink{classSampledMultispot_1_1GibbsSampler}{GibbsSampler}
\begin{DoxyCompactList}\small\item\em Draw samples from the spot states given the spots positions and some data. \end{DoxyCompactList}\item 
class \hyperlink{classSampledMultispot_1_1GibbsSampler2}{GibbsSampler2}
\begin{DoxyCompactList}\small\item\em Gibbs sampling class which masks spots to reduce computation. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
double \hyperlink{namespaceSampledMultispot_a98a46760f01f55102e6bf91293c85efc}{intensity} (double i)
\item 
double \hyperlink{namespaceSampledMultispot_aba48cb526e720286c2b5f16e07a806a6}{intensity} (const pair$<$ double, Vector$<$ 4 $>$ $>$ \&i)
\item 
{\footnotesize template$<$class T $>$ }\\void \hyperlink{namespaceSampledMultispot_a7a9e1626a0dc6806840806b246b28eea}{remove\_\-spot} (vector$<$ vector$<$ double $>$ $>$ \&current\_\-sample\_\-intensities, const vector$<$ T $>$ \&spot\_\-intensities, const vector$<$ \hyperlink{sampled__multispot_8h_a923fb9080b37d642c98cbc0159c9fd0e}{State} $>$ \&spot\_\-sample)
\item 
{\footnotesize template$<$class T $>$ }\\void \hyperlink{namespaceSampledMultispot_a813b9ac80de47660db70359111953c30}{add\_\-spot} (vector$<$ vector$<$ double $>$ $>$ \&current\_\-sample\_\-intensities, const vector$<$ T $>$ \&spot\_\-intensities, const vector$<$ \hyperlink{sampled__multispot_8h_a923fb9080b37d642c98cbc0159c9fd0e}{State} $>$ \&spot\_\-sample)
\item 
{\footnotesize template$<$class T $>$ }\\void \hyperlink{namespaceSampledMultispot_a5a7bb7a7e421f195b0cfc02e454513a6}{remove\_\-spot} (vector$<$ vector$<$ double $>$ $>$ \&current\_\-sample\_\-intensities, const vector$<$ T $>$ \&spot\_\-intensities, const vector$<$ \hyperlink{sampled__multispot_8h_a923fb9080b37d642c98cbc0159c9fd0e}{State} $>$ \&spot\_\-sample, const vector$<$ int $>$ \&mask)
\item 
{\footnotesize template$<$class T $>$ }\\void \hyperlink{namespaceSampledMultispot_af2f3851f96ef3528527c1eade91e0ade}{add\_\-spot} (vector$<$ vector$<$ double $>$ $>$ \&current\_\-sample\_\-intensities, const vector$<$ T $>$ \&spot\_\-intensities, const vector$<$ \hyperlink{sampled__multispot_8h_a923fb9080b37d642c98cbc0159c9fd0e}{State} $>$ \&spot\_\-sample, const vector$<$ int $>$ \&mask)
\item 
{\footnotesize template$<$class T $>$ }\\void \hyperlink{namespaceSampledMultispot_af70c31e016cfe56f6acfbd43b3ad82ed}{remove\_\-spot} (vector$<$ vector$<$ double $>$ $>$ \&current\_\-sample\_\-intensities, const vector$<$ vector$<$ T $>$ $>$ \&spot\_\-intensities, const vector$<$ \hyperlink{sampled__multispot_8h_a923fb9080b37d642c98cbc0159c9fd0e}{State} $>$ \&spot\_\-sample, const vector$<$ int $>$ \&mask)
\item 
{\footnotesize template$<$class T $>$ }\\void \hyperlink{namespaceSampledMultispot_aad775fe4886ba0431fd4dd084310197c}{add\_\-spot} (vector$<$ vector$<$ double $>$ $>$ \&current\_\-sample\_\-intensities, const vector$<$ vector$<$ T $>$ $>$ \&spot\_\-intensities, const vector$<$ \hyperlink{sampled__multispot_8h_a923fb9080b37d642c98cbc0159c9fd0e}{State} $>$ \&spot\_\-sample, const vector$<$ int $>$ \&mask)
\item 
vector$<$ double $>$ \hyperlink{namespaceSampledMultispot_acf04719501ddc348a72533337fb9b509}{compute\_\-spot\_\-intensity} (const vector$<$ ImageRef $>$ \&pixels, const Vector$<$ 4 $>$ \&params)
\item 
vector$<$ pair$<$ double, Vector$<$ 4 $>$ $>$ $>$ \hyperlink{namespaceSampledMultispot_a65c6978967019f138d4373b284de3221}{compute\_\-spot\_\-intensity\_\-derivatives} (const vector$<$ ImageRef $>$ \&pixels, const Vector$<$ 4 $>$ \&params)
\item 
vector$<$ tuple$<$ double, Vector$<$ 4 $>$, Matrix$<$ 4 $>$ $>$ $>$ \hyperlink{namespaceSampledMultispot_a0cb66075bde69c8a7e9a5af7853af229}{compute\_\-spot\_\-intensity\_\-hessian} (const vector$<$ ImageRef $>$ \&pixels, const Vector$<$ 4 $>$ \&params)
\item 
vector$<$ int $>$ \hyperlink{group__gUtility_ga2c9af6bc6b44cab6336954850fba52a7}{sequence} (int n)
\end{DoxyCompactItemize}


\subsubsection{Function Documentation}
\hypertarget{namespaceSampledMultispot_a98a46760f01f55102e6bf91293c85efc}{
\index{SampledMultispot@{SampledMultispot}!intensity@{intensity}}
\index{intensity@{intensity}!SampledMultispot@{SampledMultispot}}
\paragraph[{intensity}]{\setlength{\rightskip}{0pt plus 5cm}double SampledMultispot::intensity (
\begin{DoxyParamCaption}
\item[{double}]{i}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{namespaceSampledMultispot_a98a46760f01f55102e6bf91293c85efc}


Definition at line 65 of file sampled\_\-multispot.h.



Referenced by add\_\-spot(), and remove\_\-spot().


\begin{DoxyCode}
{
    return i;
}
\end{DoxyCode}
\hypertarget{namespaceSampledMultispot_aba48cb526e720286c2b5f16e07a806a6}{
\index{SampledMultispot@{SampledMultispot}!intensity@{intensity}}
\index{intensity@{intensity}!SampledMultispot@{SampledMultispot}}
\paragraph[{intensity}]{\setlength{\rightskip}{0pt plus 5cm}double SampledMultispot::intensity (
\begin{DoxyParamCaption}
\item[{const pair$<$ double, Vector$<$ 4 $>$ $>$ \&}]{i}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{namespaceSampledMultispot_aba48cb526e720286c2b5f16e07a806a6}


Definition at line 70 of file sampled\_\-multispot.h.


\begin{DoxyCode}
{
    return i.first;
}
\end{DoxyCode}
\hypertarget{namespaceSampledMultispot_a7a9e1626a0dc6806840806b246b28eea}{
\index{SampledMultispot@{SampledMultispot}!remove\_\-spot@{remove\_\-spot}}
\index{remove\_\-spot@{remove\_\-spot}!SampledMultispot@{SampledMultispot}}
\paragraph[{remove\_\-spot}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ void SampledMultispot::remove\_\-spot (
\begin{DoxyParamCaption}
\item[{vector$<$ vector$<$ double $>$ $>$ \&}]{current\_\-sample\_\-intensities, }
\item[{const vector$<$ T $>$ \&}]{spot\_\-intensities, }
\item[{const vector$<$ {\bf State} $>$ \&}]{spot\_\-sample}
\end{DoxyParamCaption}
)}}
\label{namespaceSampledMultispot_a7a9e1626a0dc6806840806b246b28eea}


Definition at line 78 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().


\begin{DoxyCode}
{
    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_intensitie
      s[p]);
}
\end{DoxyCode}
\hypertarget{namespaceSampledMultispot_a813b9ac80de47660db70359111953c30}{
\index{SampledMultispot@{SampledMultispot}!add\_\-spot@{add\_\-spot}}
\index{add\_\-spot@{add\_\-spot}!SampledMultispot@{SampledMultispot}}
\paragraph[{add\_\-spot}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ void SampledMultispot::add\_\-spot (
\begin{DoxyParamCaption}
\item[{vector$<$ vector$<$ double $>$ $>$ \&}]{current\_\-sample\_\-intensities, }
\item[{const vector$<$ T $>$ \&}]{spot\_\-intensities, }
\item[{const vector$<$ {\bf State} $>$ \&}]{spot\_\-sample}
\end{DoxyParamCaption}
)}}
\label{namespaceSampledMultispot_a813b9ac80de47660db70359111953c30}


Definition at line 87 of file sampled\_\-multispot.h.



References intensity().



Referenced by SampledMultispot::GibbsSampler2::next(), SampledMultispot::GibbsSampler::next(), and FitSpots::try\_\-modifying\_\-model().


\begin{DoxyCode}
{
    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_intensitie
      s[p]);
}
\end{DoxyCode}
\hypertarget{namespaceSampledMultispot_a5a7bb7a7e421f195b0cfc02e454513a6}{
\index{SampledMultispot@{SampledMultispot}!remove\_\-spot@{remove\_\-spot}}
\index{remove\_\-spot@{remove\_\-spot}!SampledMultispot@{SampledMultispot}}
\paragraph[{remove\_\-spot}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ void SampledMultispot::remove\_\-spot (
\begin{DoxyParamCaption}
\item[{vector$<$ vector$<$ double $>$ $>$ \&}]{current\_\-sample\_\-intensities, }
\item[{const vector$<$ T $>$ \&}]{spot\_\-intensities, }
\item[{const vector$<$ {\bf State} $>$ \&}]{spot\_\-sample, }
\item[{const vector$<$ int $>$ \&}]{mask}
\end{DoxyParamCaption}
)}}
\label{namespaceSampledMultispot_a5a7bb7a7e421f195b0cfc02e454513a6}


Definition at line 98 of file sampled\_\-multispot.h.



References intensity().


\begin{DoxyCode}
{
    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_inte
      nsities[mask[p]]);
}
\end{DoxyCode}
\hypertarget{namespaceSampledMultispot_af2f3851f96ef3528527c1eade91e0ade}{
\index{SampledMultispot@{SampledMultispot}!add\_\-spot@{add\_\-spot}}
\index{add\_\-spot@{add\_\-spot}!SampledMultispot@{SampledMultispot}}
\paragraph[{add\_\-spot}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ void SampledMultispot::add\_\-spot (
\begin{DoxyParamCaption}
\item[{vector$<$ vector$<$ double $>$ $>$ \&}]{current\_\-sample\_\-intensities, }
\item[{const vector$<$ T $>$ \&}]{spot\_\-intensities, }
\item[{const vector$<$ {\bf State} $>$ \&}]{spot\_\-sample, }
\item[{const vector$<$ int $>$ \&}]{mask}
\end{DoxyParamCaption}
)}}
\label{namespaceSampledMultispot_af2f3851f96ef3528527c1eade91e0ade}


Definition at line 107 of file sampled\_\-multispot.h.



References intensity().


\begin{DoxyCode}
{
    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_inte
      nsities[mask[p]]);
}
\end{DoxyCode}
\hypertarget{namespaceSampledMultispot_af70c31e016cfe56f6acfbd43b3ad82ed}{
\index{SampledMultispot@{SampledMultispot}!remove\_\-spot@{remove\_\-spot}}
\index{remove\_\-spot@{remove\_\-spot}!SampledMultispot@{SampledMultispot}}
\paragraph[{remove\_\-spot}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ void SampledMultispot::remove\_\-spot (
\begin{DoxyParamCaption}
\item[{vector$<$ vector$<$ double $>$ $>$ \&}]{current\_\-sample\_\-intensities, }
\item[{const vector$<$ vector$<$ T $>$ $>$ \&}]{spot\_\-intensities, }
\item[{const vector$<$ {\bf State} $>$ \&}]{spot\_\-sample, }
\item[{const vector$<$ int $>$ \&}]{mask}
\end{DoxyParamCaption}
)}}
\label{namespaceSampledMultispot_af70c31e016cfe56f6acfbd43b3ad82ed}


Definition at line 118 of file sampled\_\-multispot.h.



References intensity(), and spot\_\-intensities.


\begin{DoxyCode}
{
    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_inte
      nsities[s][mask[p]]);
    }
}
\end{DoxyCode}
\hypertarget{namespaceSampledMultispot_aad775fe4886ba0431fd4dd084310197c}{
\index{SampledMultispot@{SampledMultispot}!add\_\-spot@{add\_\-spot}}
\index{add\_\-spot@{add\_\-spot}!SampledMultispot@{SampledMultispot}}
\paragraph[{add\_\-spot}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class T $>$ void SampledMultispot::add\_\-spot (
\begin{DoxyParamCaption}
\item[{vector$<$ vector$<$ double $>$ $>$ \&}]{current\_\-sample\_\-intensities, }
\item[{const vector$<$ vector$<$ T $>$ $>$ \&}]{spot\_\-intensities, }
\item[{const vector$<$ {\bf State} $>$ \&}]{spot\_\-sample, }
\item[{const vector$<$ int $>$ \&}]{mask}
\end{DoxyParamCaption}
)}}
\label{namespaceSampledMultispot_aad775fe4886ba0431fd4dd084310197c}


Definition at line 134 of file sampled\_\-multispot.h.



References intensity(), and spot\_\-intensities.


\begin{DoxyCode}
{
    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_inte
      nsities[s][mask[p]]);
    }
}
\end{DoxyCode}
\hypertarget{namespaceSampledMultispot_acf04719501ddc348a72533337fb9b509}{
\index{SampledMultispot@{SampledMultispot}!compute\_\-spot\_\-intensity@{compute\_\-spot\_\-intensity}}
\index{compute\_\-spot\_\-intensity@{compute\_\-spot\_\-intensity}!SampledMultispot@{SampledMultispot}}
\paragraph[{compute\_\-spot\_\-intensity}]{\setlength{\rightskip}{0pt plus 5cm}vector$<$double$>$ SampledMultispot::compute\_\-spot\_\-intensity (
\begin{DoxyParamCaption}
\item[{const vector$<$ ImageRef $>$ \&}]{pixels, }
\item[{const Vector$<$ 4 $>$ \&}]{params}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{namespaceSampledMultispot_acf04719501ddc348a72533337fb9b509}


Definition at line 152 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().


\begin{DoxyCode}
{
    vector<double> intensities(pixels.size());

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

    return intensities;
}
\end{DoxyCode}
\hypertarget{namespaceSampledMultispot_a65c6978967019f138d4373b284de3221}{
\index{SampledMultispot@{SampledMultispot}!compute\_\-spot\_\-intensity\_\-derivatives@{compute\_\-spot\_\-intensity\_\-derivatives}}
\index{compute\_\-spot\_\-intensity\_\-derivatives@{compute\_\-spot\_\-intensity\_\-derivatives}!SampledMultispot@{SampledMultispot}}
\paragraph[{compute\_\-spot\_\-intensity\_\-derivatives}]{\setlength{\rightskip}{0pt plus 5cm}vector$<$pair$<$double, Vector$<$4$>$ $>$ $>$ SampledMultispot::compute\_\-spot\_\-intensity\_\-derivatives (
\begin{DoxyParamCaption}
\item[{const vector$<$ ImageRef $>$ \&}]{pixels, }
\item[{const Vector$<$ 4 $>$ \&}]{params}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{namespaceSampledMultispot_a65c6978967019f138d4373b284de3221}


Definition at line 163 of file sampled\_\-multispot.h.



Referenced by SpotNegProbabilityDiffWithSampledBackground::operator()().


\begin{DoxyCode}
{
    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;
}
\end{DoxyCode}
\hypertarget{namespaceSampledMultispot_a0cb66075bde69c8a7e9a5af7853af229}{
\index{SampledMultispot@{SampledMultispot}!compute\_\-spot\_\-intensity\_\-hessian@{compute\_\-spot\_\-intensity\_\-hessian}}
\index{compute\_\-spot\_\-intensity\_\-hessian@{compute\_\-spot\_\-intensity\_\-hessian}!SampledMultispot@{SampledMultispot}}
\paragraph[{compute\_\-spot\_\-intensity\_\-hessian}]{\setlength{\rightskip}{0pt plus 5cm}vector$<$tuple$<$double, Vector$<$4$>$, Matrix$<$4$>$ $>$ $>$ SampledMultispot::compute\_\-spot\_\-intensity\_\-hessian (
\begin{DoxyParamCaption}
\item[{const vector$<$ ImageRef $>$ \&}]{pixels, }
\item[{const Vector$<$ 4 $>$ \&}]{params}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{namespaceSampledMultispot_a0cb66075bde69c8a7e9a5af7853af229}


Definition at line 172 of file sampled\_\-multispot.h.



Referenced by FreeEnergyHessian::hessian(), sampled\_\-background\_\-spot\_\-hessian2(), sampled\_\-background\_\-spot\_\-hessian\_\-FAKE(), and sampled\_\-background\_\-spot\_\-hessian\_\-ffbs().


\begin{DoxyCode}
{
    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;
}
\end{DoxyCode}
