Skip to content
Snippets Groups Projects
Commit fc2f149f authored by Vladimír Ulman's avatar Vladimír Ulman
Browse files

ActiveMesh::RenderMask() now renders nucleus+fTree properly (and binary).

parent e714b8b2
No related branches found
No related tags found
No related merge requests found
......@@ -2,9 +2,13 @@
#include <fstream>
#include <map>
#include <lapacke.h>
#include <i3d/draw.h>
#include <i3d/morphology.h>
#include "TriangleMesh.h"
#include "../cmath3d_v/TriangleMesh_v.h"
#undef min
#undef max
//'multiple' should be ideally 10^desired_decimal_accuracy
int inline RoundTo(const float val, const float multiple=1000.f)
......@@ -687,10 +691,25 @@ void ActiveMesh::RenderMask(i3d::Image3d<i3d::GRAY16>& mask,const bool showTrian
const int y=(int)roundf( (v.y-yOff) *yRes);
const int z=(int)roundf( (v.z-zOff) *zRes);
short val=(showTriangles)? short(i%5 *30 +100) : 200;
short val=(showTriangles)? short(i%5 *30 +100) : 100;
if (mask.Include(x,y,z)) mask.SetVoxel(x,y,z,val);
}
}
//this floods cell exterior from the image corner
i3d::Image3d<i3d::GRAY16> tmpMask(mask);
i3d::Dilation(tmpMask,mask,i3d::nb3D_o18);
i3d::FloodFill(mask,(i3d::GRAY16)50,0);
//this removes the flooding while filling
//everything else (and closing holes in this was)
i3d::GRAY16* p=mask.GetFirstVoxelAddr();
i3d::GRAY16* const pL=p+mask.GetImageSize();
while (p != pL)
{
*p=(*p != 50)? std::max(*p,i3d::GRAY16(100)) : 0;
++p;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment