Commit cba2eca0 authored by Vladimír Ulman's avatar Vladimír Ulman
Browse files

DEL: Dropped obsoleted ActiveMesh::RenderOneTimeTexture().

parent 9cf2740c
Loading
Loading
Loading
Loading
+0 −106
Original line number Diff line number Diff line
@@ -1288,112 +1288,6 @@ void ActiveMesh::RenderMask_filo(i3d::Image3d<i3d::GRAY16>& mask,const unsigned
}


void ActiveMesh::RenderOneTimeTexture(const i3d::Image3d<i3d::GRAY16>& mask,
                                      i3d::Image3d<i3d::GRAY16>& texture)
{
	i3d::Image3d<float> dt;
	i3d::GrayToFloat(mask,dt);

	i3d::EDM(dt,0,100.f,false);
#ifdef SAVE_INTERMEDIATE_IMAGES
	dt.SaveImage("1_DTAlone.ics");
#endif

	i3d::Image3d<float> perlinInner,perlinOutside;
	perlinInner.CopyMetaData(mask);
	DoPerlin3D(perlinInner,5.0,0.8*1.5,0.7*1.5,6);
#ifdef SAVE_INTERMEDIATE_IMAGES
	//perlinInner.SaveImage("2_PerlinAlone_Inner.ics");
#endif

	perlinOutside.CopyMetaData(mask);
	DoPerlin3D(perlinOutside,1.8,0.8*1.5,0.7*1.5,6);
#ifdef SAVE_INTERMEDIATE_IMAGES
	//perlinOutside.SaveImage("2_PerlinAlone_Outside.ics");
#endif

	i3d::Image3d<i3d::GRAY16> erroded;
	i3d::ErosionO(mask,erroded,1);

	//initial object intensity levels
	float* p=dt.GetFirstVoxelAddr();
	float* const pL=p+dt.GetImageSize();
	const float* pI=perlinInner.GetFirstVoxelAddr();
	const float* pO=perlinOutside.GetFirstVoxelAddr();
	const i3d::GRAY16* er=erroded.GetFirstVoxelAddr();
	while (p != pL)
	{
		//are we within the mask?
		if (*p > 0.f)
		{
			//close to the surface?
			if (*p < 0.3f || *er == 0) *p=2000.f + 5000.f*(*pO); //corona
			else                       *p=600.f  + 600.f*(*pI);  //inside
			if (*er == 0) *p=2000.f; //std::max(*p,2000.f);                //corona

			if (*p < 0.f) *p=0.f;
		}
		++p; ++pI; ++pO; ++er;
	}
#ifdef SAVE_INTERMEDIATE_IMAGES
	dt.SaveImage("3_texture.ics");
#endif

	perlinInner.DisposeData();
	perlinOutside.DisposeData();
	erroded.DisposeData();

	i3d::GaussIIR(dt,3.f,3.f,2.5f);
#ifdef SAVE_INTERMEDIATE_IMAGES
	dt.SaveImage("4_texture_filtered.ics");
#endif


	//downsample now:
	float factor[3]={1.f,1.f,0.125f};
	i3d::Image3d<float>* tmp=NULL;
	i3d::lanczos_resample(&dt,tmp,factor,2);
#ifdef SAVE_INTERMEDIATE_IMAGES
	tmp->SaveImage("5_texture_filtered_resampled.ics");
#endif
	dt=*tmp;
	delete tmp;


	p=dt.GetFirstVoxelAddr();
	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+=150.f*expf(-0.5f * distSq / 2500.f);

		//uncertainty in the number of incoming photons
		const float noiseMean = sqrtf(*p), // from statistics: shot noise = sqrt(signal) 
				      noiseVar = noiseMean;  // for Poisson distribution E(X) = D(X)

		*p+=40.f*((float)GetRandomPoisson(noiseMean) - noiseVar);

		//constants are parameters of Andor iXon camera provided from vendor:
		//photon shot noise: dark current
		*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(480.f,20.f);
		//*p+=530.f;
	}
#ifdef SAVE_INTERMEDIATE_IMAGES
	dt.SaveImage("6_texture_filtered_resampled_finalized.ics");
#endif

	//obtain final GRAY16 image
	i3d::FloatToGrayNoWeight(dt,texture);
}


void ActiveMesh::UpdateMeshBBox(Vector3F& min,Vector3F& max)
{
	//first, for the cell body
+0 −4
Original line number Diff line number Diff line
@@ -114,10 +114,6 @@ class ActiveMesh
	/// render directly into mask using volumetric mesh
	void RenderMask_bodyVol(i3d::Image3d<i3d::GRAY16>& mask,const bool showTriangles=false);

	///one-shot texture renderer meant for testing
	void RenderOneTimeTexture(const i3d::Image3d<i3d::GRAY16>& mask,
	                          i3d::Image3d<i3d::GRAY16>& texture);

	///time-lapse (coherent) manipulation with fluorescent dots,
	///always with the given mask
	void InitDots_body(const i3d::Image3d<i3d::GRAY16>& mask);