Commit 549a5b85 authored by David Wiesner's avatar David Wiesner
Browse files

ADD: Visualization of Scheduling.

BUGFIX: Compilation with multi-threading OFF.
parent 88d5d83f
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -64,7 +64,8 @@ option (USE_REAL_PSF "Shall I use real PSF for final images (slower!!!)?" OFF)
option (HIGH_SNR "Shall I generate final images of higher SNR (not applied if real PSF is used)?" ON)
option (SAVE_TIFFS "Shall I save 3D TIFF images rather than ICS images?" OFF)
option (SAVE_FLOWFIELDS "Shall I also output flow field images?" OFF)
option (SAVE_LOCK_VISUALIZATION "Shall I save visualization of custom-shaped locks? (Only when DO_MULTITHREADING is turned ON.)" OFF)
option (SAVE_LOCK_VIS "Shall I save visualization of custom-shaped locks? (Only when DO_MULTITHREADING is turned ON.)" OFF)
option (SAVE_SCHEDULING_VIS "Shall I save visualization of scheduling? (Only when DO_MULTITHREADING is turned ON.)" OFF)
option (DO_RIGID_MOTION "Shall I include rigid movement (translation plus rotation) of cells into the simulation?" ON)
option (DO_NONRIGID_MOTION "Shall I include non-rigid movement (smooth shape deformation) of cells into the simulation?" ON)
option (DO_FLAT_2DMOTION "Shall I prevent cells from movement along z-axis?" OFF)
@@ -101,9 +102,12 @@ endif (SAVE_TIFFS)
if (SAVE_FLOWFIELDS)
    add_definitions(-DGTGEN_WITH_FLOWFIELDS)
endif (SAVE_FLOWFIELDS)
if (SAVE_LOCK_VISUALIZATION)
if (SAVE_LOCK_VIS)
    add_definitions(-DGTGEN_WITH_LOCKVISUALIZATION)
endif (SAVE_LOCK_VISUALIZATION)
endif (SAVE_LOCK_VIS)
if (SAVE_SCHEDULING_VIS)
    add_definitions(-DGTGEN_WITH_SCHEDULINGVISUALIZATION)
endif (SAVE_SCHEDULING_VIS)
if (DO_RIGID_MOTION)
    add_definitions(-DGTGEN_WITH_RIGIDMOTION)
endif (DO_RIGID_MOTION)
+6 −0
Original line number Diff line number Diff line
@@ -396,10 +396,12 @@ void Cell<MV,PV>::ReadMaskInG2Phase(const i3d::Image3d<MV> &cellMask,
	 //to have all masks consistently generated, we must generate even this initial mask
	 //with the ScmRenderCellIntoMask() function, which needs to know the CellBP vectors
	 ScmRenderCellIntoMask(*scheduler.sceneMasks[this->timePoint],NULL,this->timePoint);
#ifdef GTGEN_WITH_MULTITHREADING
	 //also init the ScmRemoveCellFromMask()-related lock
	 //(as it is just now when we learned the current position of the cell)
	 scmReservationLock.setSphereRadius(1.25f * this->cellDiameter);
	 scmReservationLock.updateSphereCentre(scmCellBPCentre);
#endif

	 //also init the cell polarity vector
	 ScmResetCellPolarityVector();
@@ -480,10 +482,12 @@ void Cell<MV,PV>::GenerateMaskInG2Phase()
	 //to have all masks consistently generated, we must generate even this initial mask
	 //with the ScmRenderCellIntoMask() function, which needs to know the CellBP vectors
	 ScmRenderCellIntoMask(*scheduler.sceneMasks[this->timePoint],NULL,this->timePoint);
#ifdef GTGEN_WITH_MULTITHREADING
	 //also init the ScmRemoveCellFromMask()-related lock
	 //(as it is just now when we learned the current position of the cell)
	 scmReservationLock.setSphereRadius(1.25f * this->cellDiameter);
	 scmReservationLock.updateSphereCentre(scmCellBPCentre);
#endif

	 //also init the cell polarity vector
	 ScmResetCellPolarityVector();
@@ -829,10 +833,12 @@ void Cell<MV, PV>::DoNextPhase(void)
			cellTP++;
		}

#ifdef GTGEN_WITH_MULTITHREADING
		//update scmReservationLock
		//(only once/after the while-cycle
		// and only after outdated/old future reservations were wiped out)
		scmReservationLock.updateSphereCentre(scmCellBPCentre);
#endif

		DEBUG_REPORT("changed reservations in "
			<< scheduler.newestScene - timePoint
+4 −0
Original line number Diff line number Diff line
@@ -109,7 +109,9 @@ template <class MV, class PV> class Cell
					duplicatedCell1(NULL),
					duplicatedCell2(NULL),
					delay(0),
#ifdef GTGEN_WITH_MULTITHREADING
					scmReservationLock(0,0,this,masks),
#endif
					scmLastScmUsed(INT_MAX),
					SOFA_InitialPosition(0.f),
					SOFA_InitialRotation(0.f),
@@ -1034,6 +1036,7 @@ template <class MV, class PV> class Cell
			  */
			 void ScmRemoveCellFromMask(i3d::Image3d<MV> &mask);

#ifdef GTGEN_WITH_MULTITHREADING
			 /**
			  * A SphereLock that represents the region (spatial extent) in which the cell
			  * appeared when soft-reservation of future space was happening
@@ -1045,6 +1048,7 @@ template <class MV, class PV> class Cell
			  * The temporal extent of this structure is never updated.
			  */
			 SphereLock scmReservationLock;
#endif

			 /**
			  * Fills in the \e mask image using the list of boundary points Cell::scmCellBPList,
+4 −3
Original line number Diff line number Diff line
@@ -52,7 +52,8 @@ void Cell<MV, PV>::ScmRemoveCellFromMask(i3d::Image3d<MV> &mask)
	DEBUG_REPORT("removing  ID=" << ID << " from source image at " << mask.GetOffset() << " of size " \
	       << i3d::PixelsToMicrons(mask.GetSize(),mask.GetResolution())  << " in microns");

/* OLD code that was sweeping the whole image
#ifndef GTGEN_WITH_MULTITHREADING
	// OLD code that was sweeping the whole image
	MV *m=mask.GetFirstVoxelAddr();
#ifndef MITOGEN_DEBUG
	for (size_t i=0; i < mask.GetImageSize(); ++i, ++m)
@@ -64,8 +65,7 @@ void Cell<MV, PV>::ScmRemoveCellFromMask(i3d::Image3d<MV> &mask)
		if (*m == this->ID) { *m=0; ++c; }
	REPORT(c << " dots were removed (ID " << ID << ")");
#endif
*/

#else
	//NEW code that sweeps only the region given by this::scmReservationLock

	//time savers :-)
@@ -113,6 +113,7 @@ void Cell<MV, PV>::ScmRemoveCellFromMask(i3d::Image3d<MV> &mask)
		}
	}
	DEBUG_REPORT(c << " dots were removed (ID " << ID << ")");
#endif
}

//-----------------------------------------------------------------------------
+2 −0
Original line number Diff line number Diff line
@@ -849,11 +849,13 @@ void Cell<MV, PV>::DoCytokinesis(const size_t noFrames)
#endif
	}

#ifdef GTGEN_WITH_MULTITHREADING
	//init the scmReservationLocks for both daughters
	daughter1->scmReservationLock.setSphereRadius(1.25f * daughter1->cellDiameter);
	daughter1->scmReservationLock.updateSphereCentre(duplicatedCell1->scmCellBPCentre);
	daughter2->scmReservationLock.setSphereRadius(1.25f * daughter2->cellDiameter);
	daughter2->scmReservationLock.updateSphereCentre(duplicatedCell2->scmCellBPCentre);
#endif
	
	// left cell - last finished phase and timepoint
	daughter1->currentPhase = Cytokinesis;
Loading