Skip to content
Snippets Groups Projects
Commit 44761a40 authored by Vladimír Ulman's avatar Vladimír Ulman
Browse files

Uneven BG illumination introduced into ActiveMesh::RenderOneTimeTexture().

parent 1a77336e
No related branches found
No related tags found
No related merge requests found
......@@ -865,11 +865,12 @@ void ActiveMesh::RenderOneTimeTexture(const i3d::Image3d<i3d::GRAY16>& mask,
{
i3d::Image3d<float> dt;
i3d::GrayToFloat(mask,dt);
i3d::EDM(dt,0,100.f,false);
//i3d::EDM(dt,0,100.f,false);
dt.SaveImage("dt.ics");
//dt.SaveImage("dt.ics");
float* p=dt.GetFirstVoxelAddr();
/*
float* const pL=p+dt.GetImageSize();
int randomCounter=20;
while (p != pL)
......@@ -894,24 +895,33 @@ void ActiveMesh::RenderOneTimeTexture(const i3d::Image3d<i3d::GRAY16>& mask,
dt.SaveImage("dt2.ics");
i3d::GaussIIR(dt,3.f,3.f,9.f);
*/
p=dt.GetFirstVoxelAddr();
for (; p != pL; ++p)
for (int z=0; z < (signed)dt.GetSizeZ(); ++z)
for (int y=0; y < (signed)dt.GetSizeY(); ++y)
for (int x=0; x < (signed)dt.GetSizeX(); ++x, ++p)
{
//background signal:
float distSq=((float)x-110.f)*((float)x-110.f) + ((float)y-110.f)*((float)y-110.f);
*p=100.f*expf(-0.5f * distSq / 900.f);
//uncertainty in the number of incoming photons
float noiseMean = sqrt(*p), // from statistics: shot noise = sqrt(signal)
noiseVar = noiseMean; // for Poisson distribution E(X) = D(X)
const float noiseMean = sqrtf(*p), // from statistics: shot noise = sqrt(signal)
noiseVar = noiseMean; // for Poisson distribution E(X) = D(X)
*p=ceilf(*p + GetRandomPoisson(noiseMean) - noiseVar);
*p+=15.f*((float)GetRandomPoisson(noiseMean) - noiseVar);
//constants are parameters of Andor iXon camera provided from vendor:
//photon shot noise: dark current
*p+=GetRandomPoisson(0.06f);
*p+=(float)GetRandomPoisson(0.06f);
//read-out noise:
// variance up to 25.f (old camera on ILBIT)
// variance about 1.f (for the new camera on ILBIT)
//*p+=GetRandomGauss(700.f,90.f);
*p+=GetRandomGauss(480.f,20.f);
//*p+=530.f;
}
dt.SaveImage("dt3.ics");
i3d::FloatToGrayNoWeight(dt,texture);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment