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

ADD: Introduced RemoveFromMask() to aid removing stuff from masks.

parent d887c773
Loading
Loading
Loading
Loading
+17 −10
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ std::vector<int> centreOffsets;

bool LoadNewMesh(const char* path,const int ID,const int fileNo,const bool keepTrajectories=false);
int  RenderMesh(const char* path,const int ID,int fileNo);
void RemoveFromMask(i3d::Image3d<i3d::GRAY16>& mask, const i3d::GRAY16 val);

int main(int argc,char **argv)
{
@@ -636,17 +637,8 @@ int RenderMesh(const char* path,const int ID,int fileNo)
			else
			{
				//tip is not visible
				int removedCnt=0;

				//remove all voxels of this color (tipIter->first)
				i3d::GRAY16* p = mask.GetFirstVoxelAddr();
				i3d::GRAY16* const pL = p + mask.GetImageSize();
				while (p != pL)
				{
					if (*p == tipIter->first) { *p=0; ++removedCnt; }
					++p;
				}
				std::cout << "WARN: REMOVING " << removedCnt << " PIXELS of filopodium ID " << tipIter->first << "\n";
				RemoveFromMask(mask, (i3d::GRAY16)tipIter->first);

				// declare the filopodium is not present in this time point
				tipIter->second.at((unsigned)fileNo)=-1;
@@ -669,3 +661,18 @@ int RenderMesh(const char* path,const int ID,int fileNo)

	return(0);
}

void RemoveFromMask(i3d::Image3d<i3d::GRAY16>& mask, const i3d::GRAY16 val)
{
	int removedCnt=0;

	i3d::GRAY16* p = mask.GetFirstVoxelAddr();
	i3d::GRAY16* const pL = p + mask.GetImageSize();
	while (p != pL)
	{
		if (*p == val) { *p=0; ++removedCnt; }
		++p;
	}

	std::cout << "WARN: REMOVING " << removedCnt << " PIXELS of filopodium ID " << val << "\n";
}