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

Added missing #include line so that it now does compile.

Cells now initiated to use normally distributed displ. step
with params rather close to the HeLa Mitocheck dataset (provided
delay between frames is cca 30min).
M    src/cell.h

Added some DEBUG reports to study RndWlk behaviour better.
M    src/cellScm.cpp

Added support for the normally distributed displacement vectors.
M    src/toolbox/randWalk.h
parent 56281491
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
#include "scheduler.h"
#include "toolbox/bp_lists.h"
#include "toolbox/rnd_generators.h"
#include "toolbox/randWalk.h"

// The frequency of restarting the chromatin (texture)
// note: set high number to disable it
@@ -176,16 +177,17 @@ template <class MV, class PV> class Cell

						//Rigid motion stuff: params setting
						//
						//persistance of the cell movement
						//persistance of the cell movement, ala turning-angle distribution
						scmRandomWalk.UseWrappedCauchyDistribution(0.5f); //TODO new param
						//displacement magnitude of the cell movement
						scmRandomWalk.UseFixedDisplacementStep(cellLookDistance); //TODO new param name
																							//TODO nafitovat na HeLa distribuci
						//displacement magnitude of the cell movement, ala disp.-step-size distribution
						scmRandomWalk.UseNormalDistDisplacementStep(1.52f,0.6f); //TODO new param name
						//initial heading of the cell movement
						scmRandomWalk.ResetXYHeading(GetRandomUniform(0.f,6.28f));

						//Rigid motion stuff: required preprocessing
						scmRandomWalk.PrepareRandomTurningField();
						scmRandomWalk.PrepareRandomStepSizeField();
						scmRandomWalk.PrepareRandomStepSizeField(0.1f);

						//set to zero since there was no previous movement
						scmLastRotationAngle=0.f;
+6 −0
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ void Cell<MV, PV>::ScmRenderCellIntoMask(i3d::Image3d<MV> &mask,
{
	DEBUG_REPORT("inserting ID=" << ID << " into source image at " << mask.GetOffset() << " of size " \
	       << i3d::PixelsToMicrons(mask.GetSize(),mask.GetResolution())  << " in microns");
	DEBUG_REPORT("inserting ID=" << ID << " with centre at " << scmCellBPCentre << " in microns");

	RenderBPListIntoMask(mask,(MV)this->ID,scmCellBPList,scmCellBPCentre,scmCellOuterBPNumber);

@@ -168,6 +169,10 @@ void Cell<MV, PV>::ScmUniversalMovement(FlowField<float> &FF)
		rndWlkCollision=ScmNewCellPositionCollide(v);
	} while ((rndWlkCollision) and (tries < 5));

	//here, if rndWlkCollision==true -> doing translation the slow way
	//         (i.e., full search, MovsMask is used, v must be zero)
	//      else rndWlkCollision==false -> using RandomWalk for v

	int availTranslations=0;
	if (rndWlkCollision)
	{
@@ -296,6 +301,7 @@ void Cell<MV, PV>::ScmUniversalMovement(FlowField<float> &FF)
		}
	}
	
	//DEBUG_REPORT("RndWlk stat, cell ID " << this->ID << ", translation by " << v);

#ifdef MITOGEN_DEBUG
	//TODO VLADO, disable the consistency test here
+22 −3
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
#include <vector>

///define to obtain some debugging auxiliary outputs
#define RNDWLK_DEBUG
//#define RNDWLK_DEBUG


/**
@@ -318,6 +318,19 @@ class RandomWalk
		displacementStepSizeDistribution[dispSize+1.0]=0.;
	}

	void UseNormalDistDisplacementStep(const FLOAT mean,const FLOAT sigma)
	{
		displacementStepSizeDistribution.clear();
		int intStart=std::max(int((mean-3.f*sigma)*10.f),0);
		int intStop =std::max(int((mean+3.f*sigma)*10.f),intStart);
		for (int i=intStart; i <= intStop; ++i)
		{
			const FLOAT step=FLOAT(i)/10.f;
			displacementStepSizeDistribution[step]= 1./(sigma*2.506)
			      * exp(-0.5*(step-mean)*(step-mean) / (sigma*sigma));
		}
	}

	//TODO: pridat HeLa step size distribuci a nahodnyma accel peakama


@@ -360,7 +373,7 @@ class RandomWalk
	{
		//see the RandomWalk::PrepareRandomTurningField() for some more comments...
		if (stepSampling <= 0.)
			throw ERROR_REPORT("stepSampling parameter must be strictly positive.");
			throw ERROR_REPORT("The stepSampling parameter must be strictly positive.");

		randomStepSizeField.clear();

@@ -465,7 +478,12 @@ class RandomWalk

	///Set bias vector to use.
	void SetBiasVector(const FLOAT x,const FLOAT y,const FLOAT z=0.)
	{ wlk_displacementBias_x=x; wlk_displacementBias_y=y; wlk_displacementBias_z=z; }
	{
		wlk_displacementBias_x=x; wlk_displacementBias_y=y; wlk_displacementBias_z=z;
		DEBUG_REPORT("new Bias vector: (" << wlk_displacementBias_x << ","
		             << wlk_displacementBias_y << ","
						 << wlk_displacementBias_z << ") in microns");
	}

	///Get currently used bias 2D vector.
	void GetBiasVector(FLOAT& x,FLOAT& y) const
@@ -489,6 +507,7 @@ class RandomWalk
		while (newHeading > 6.28318) newHeading-=6.28318;

		wlk_xy_heading=newHeading;
		DEBUG_REPORT("new XY heading angle: " << wlk_xy_heading << " radians");
	}

	/**