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

Bug fix in the Rendering functions.

M    src/toolbox/bp_lists.cpp

Some report has decenlty changed.
M    src/cell.cpp

Some more tweaks for the TMI paper.
M    src/cellScm.cpp
parent e8a076ed
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -746,7 +746,7 @@ void Cell<MV, PV>::DoNextPhase(void)
	if (currentPhase != Cytokinesis) {
	if (currentPhase != Cytokinesis) {
		size_t cellTP=this->timePoint+1;
		size_t cellTP=this->timePoint+1;
		while (cellTP <= scheduler.newestScene) {
		while (cellTP <= scheduler.newestScene) {
			DEBUG_REPORT("updating reservation in " << cellTP << " sceneMask");
			DEBUG_REPORT("updating reservation in sceneMask # " << cellTP);


			ScmRemoveCellFromMask(*scheduler.sceneMasks[cellTP]);
			ScmRemoveCellFromMask(*scheduler.sceneMasks[cellTP]);
			SoftRenderBPListIntoMask(*scheduler.sceneMasks[cellTP],this->ID,
			SoftRenderBPListIntoMask(*scheduler.sceneMasks[cellTP],this->ID,
+5 −1
Original line number Original line Diff line number Diff line
@@ -417,8 +417,10 @@ int Cell<MV, PV>::ScmSuggestRigidTowardsEmpty_SS(i3d::Image3d<float> &MovsMask)


	//are we in the fast-growing phases?
	//are we in the fast-growing phases?
	int SE=1; //SearchExpansion coefficient
	int SE=1; //SearchExpansion coefficient
	/* TMI disabled
	if ((currentPhase == Anaphase)
	if ((currentPhase == Anaphase)
	  || (currentPhase == Cytokinesis)) SE=2;
	  || (currentPhase == Cytokinesis)) SE=2;
	*/


#ifdef GTGEN_DEBUG
#ifdef GTGEN_DEBUG
	//time-measurement
	//time-measurement
@@ -932,8 +934,10 @@ int Cell<MV, PV>::ScmSuggestTranslationsTowardsEmpty_SS(i3d::Image3d<float> &Mov


	//are we in the fast-growing phases?
	//are we in the fast-growing phases?
	int SE=1; //SearchExpansion coefficient
	int SE=1; //SearchExpansion coefficient
	/* TMI disabled
	if ((currentPhase == Anaphase)
	if ((currentPhase == Anaphase)
	  || (currentPhase == Cytokinesis)) SE=2;
	  || (currentPhase == Cytokinesis)) SE=2;
	*/


#ifdef GTGEN_DEBUG
#ifdef GTGEN_DEBUG
	//time-measurement
	//time-measurement
@@ -961,7 +965,7 @@ int Cell<MV, PV>::ScmSuggestTranslationsTowardsEmpty_SS(i3d::Image3d<float> &Mov


	// prepare for distance transform, data/content:
	// prepare for distance transform, data/content:
#ifdef GTGEN_WITH_MULTITHREADING
#ifdef GTGEN_WITH_MULTITHREADING
	#pragma omp parallel for schedule(static,1) num_threads(5)
	#pragma omp parallel for schedule(dynamic,1) num_threads(5)
#endif
#endif
	for (int z=-MovsMask_zSize/2; z <= MovsMask_zSize/2; ++z) {
	for (int z=-MovsMask_zSize/2; z <= MovsMask_zSize/2; ++z) {
	  float *pDT=MovsMask.GetVoxelAddr(0,0,z+(MovsMask_zSize/2));
	  float *pDT=MovsMask.GetVoxelAddr(0,0,z+(MovsMask_zSize/2));
+20 −10
Original line number Original line Diff line number Diff line
@@ -422,9 +422,9 @@ void RenderBPListIntoMask(i3d::Image3d<MV> &mask, const MV value,
		else
		else
		if (BPList[i].y > maxCorner.y) maxCorner.y=BPList[i].y;
		if (BPList[i].y > maxCorner.y) maxCorner.y=BPList[i].y;


		if (BPList[i].z > maxCorner.z) maxCorner.z=BPList[i].z;
		else
		if (BPList[i].z < minCorner.z) minCorner.z=BPList[i].z;
		if (BPList[i].z < minCorner.z) minCorner.z=BPList[i].z;
		else
		if (BPList[i].z > maxCorner.z) maxCorner.z=BPList[i].z;
	}
	}


	//setup the AABB and prepare the auxiliary image:
	//setup the AABB and prepare the auxiliary image:
@@ -455,6 +455,8 @@ void RenderBPListIntoMask(i3d::Image3d<MV> &mask, const MV value,
	 || (pixelShift.y > (int)mask.GetSizeY())
	 || (pixelShift.y > (int)mask.GetSizeY())
	 || (pixelShift.z > (int)mask.GetSizeZ()))
	 || (pixelShift.z > (int)mask.GetSizeZ()))
		throw ERROR_REPORT("pixelShift has some coordinate outside the mask image.");
		throw ERROR_REPORT("pixelShift has some coordinate outside the mask image.");

	REPORT("pixelShift=" << pixelShift);
#endif
#endif


	//time savers: myMask offset
	//time savers: myMask offset
@@ -499,9 +501,12 @@ void RenderBPListIntoMask(i3d::Image3d<MV> &mask, const MV value,
		   && (x < maxX) && (y < maxY) && (z < maxZ)) {
		   && (x < maxX) && (y < maxY) && (z < maxZ)) {
		   	i3d::GRAY8 *mb=mB +z*Slice +y*xLine +x;
		   	i3d::GRAY8 *mb=mB +z*Slice +y*xLine +x;
#ifdef GTGEN_DEBUG
#ifdef GTGEN_DEBUG
			if ((! *mb) && (mask.GetVoxel(x,y,z)) && (mask.GetOffset().x == 0.f))
			//translate local myMask coordinates to the mask coordinates by +pixelShift
				REPORT("Warning: overwriting value " << mask.GetVoxel(x,y,z)
			if ( (! *mb) && (mask.GetOffset().x == 0.f)
				  << " at pixel (" << x << "," << y << "," << z << ")");
			   && (mask.GetVoxel(x+pixelShift.x,y+pixelShift.y,z+pixelShift.z)) )
					REPORT("Warning: overwriting value "
					  << mask.GetVoxel(i3d::Vector3d<int>(x,y,z)+pixelShift)
					  << " at pixel " << i3d::Vector3d<int>(x,y,z)+pixelShift);
#endif
#endif
			//dilation of this pixel
			//dilation of this pixel
#ifndef GTGEN_WITH_SOFA
#ifndef GTGEN_WITH_SOFA
@@ -839,9 +844,9 @@ void SoftRenderBPListIntoMask(i3d::Image3d<MV> &mask, const MV value,
		else
		else
		if (BPList[i].y > maxCorner.y) maxCorner.y=BPList[i].y;
		if (BPList[i].y > maxCorner.y) maxCorner.y=BPList[i].y;


		if (BPList[i].z > maxCorner.z) maxCorner.z=BPList[i].z;
		else
		if (BPList[i].z < minCorner.z) minCorner.z=BPList[i].z;
		if (BPList[i].z < minCorner.z) minCorner.z=BPList[i].z;
		else
		if (BPList[i].z > maxCorner.z) maxCorner.z=BPList[i].z;
	}
	}


	//setup the AABB and prepare the auxiliary image:
	//setup the AABB and prepare the auxiliary image:
@@ -872,6 +877,8 @@ void SoftRenderBPListIntoMask(i3d::Image3d<MV> &mask, const MV value,
	 || (pixelShift.y > (int)mask.GetSizeY())
	 || (pixelShift.y > (int)mask.GetSizeY())
	 || (pixelShift.z > (int)mask.GetSizeZ()))
	 || (pixelShift.z > (int)mask.GetSizeZ()))
		throw ERROR_REPORT("pixelShift has some coordinate outside the mask image.");
		throw ERROR_REPORT("pixelShift has some coordinate outside the mask image.");

	REPORT("pixelShift=" << pixelShift);
#endif
#endif


	//time savers: myMask offset
	//time savers: myMask offset
@@ -916,9 +923,12 @@ void SoftRenderBPListIntoMask(i3d::Image3d<MV> &mask, const MV value,
		   && (x < maxX) && (y < maxY) && (z < maxZ)) {
		   && (x < maxX) && (y < maxY) && (z < maxZ)) {
		   	i3d::GRAY8 *mb=mB +z*Slice +y*xLine +x;
		   	i3d::GRAY8 *mb=mB +z*Slice +y*xLine +x;
#ifdef GTGEN_DEBUG
#ifdef GTGEN_DEBUG
			if ((! *mb) && (mask.GetVoxel(x,y,z)) && (mask.GetOffset().x == 0.f))
			//translate local myMask coordinates to the mask coordinates by +pixelShift
				REPORT("Warning: overwriting value " << mask.GetVoxel(x,y,z)
			if ( (! *mb) && (mask.GetOffset().x == 0.f)
				  << " at pixel (" << x << "," << y << "," << z << ")");
			   && (mask.GetVoxel(x+pixelShift.x,y+pixelShift.y,z+pixelShift.z)) )
					REPORT("Warning: overwriting value "
					  << mask.GetVoxel(i3d::Vector3d<int>(x,y,z)+pixelShift)
					  << " at pixel " << i3d::Vector3d<int>(x,y,z)+pixelShift);
#endif
#endif
			//dilation of this pixel
			//dilation of this pixel
#ifndef GTGEN_WITH_SOFA
#ifndef GTGEN_WITH_SOFA