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

CHG 2/2: RenderMesh() implements new 'prunning' parameter (to

         cut away from mask after rendering is done).
parent 62d57356
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -657,8 +657,31 @@ int RenderMesh(const char* path,const std::map<std::string, float>& pruning,cons
	centreOffsets[(unsigned)fileNo]=(int)mask.GetIndex(x,y,z);

	//save the mask image, finally (might have some pixels removed)
	//NB: if there is prunning[""] == 0.0 then this saving is redundant...
	mask.SaveImage(fileName);

	//start processing the prunnings...
	std::map<std::string, float>::const_iterator pruningIter = pruning.begin();
	while (pruningIter != pruning.end())
	{
		//over all tips/filopodia:
		//check their lengths and wipe them out if necessary
		tipIter=tipOffsets.begin();
		while (tipIter != tipOffsets.end())
		{
			if (tipLengths[tipIter->first].at((unsigned)fileNo) < pruningIter->second)
				RemoveFromMask(mask, (i3d::GRAY16)tipIter->first);
			++tipIter;
		}

		//save the "updated" mask
		std::cout << "exporting mask #" << fileNo << "\n";
		sprintf(fileName,"%s/ID%d_afterTM/mask_t%03d%s.tif",path,ID,fileNo,pruningIter->first.c_str());
		mask.SaveImage(fileName);

		++pruningIter;
	}

	return(0);
}