}//CheckRange操作 protected int FindXLeft(Int16Triple p) { int xleft = p.X - 1; while (true) { if (xleft == -1 || flagsMap.GetFlagOn(xleft, p.Y, p.Z)) { break; } else { byte value = bmp.GetPixel(xleft, p.Y, p.Z); if (IncludePredicate(xleft, p.Y, p.Z)) { Int16Triple t = new Int16Triple(xleft, p.Y, p.Z); flagsMap.SetFlagOn(xleft, p.Y, p.Z, true); Process(t); xleft--; } else { break; } } } return(xleft + 1); }//FindXLeft操作
public virtual bool IsInside(int x, int y, int z) { if (x <= 0 || y <= 0 || z <= 0 || x > bmp.width || y > bmp.height || z > bmp.depth) { return(false); } else { return(bmp.GetPixel(x, y, z) == BitMap3d.WHITE); } }//judge if a voxel is inside the surface
internal static BitMap3d GetLayers(BitMap3d bmp, int p1, int p2) { BitMap3d bmp2 = new BitMap3d(bmp.width, bmp.height, p2 - p1 + 1, 0); for (int i = 0; i < bmp.width; i++) { for (int j = 0; j < bmp.height; j++) { for (int k = p1; k <= p2; k++) { bmp2.SetPixel(i, j, k - p1, bmp.GetPixel(i, j, k)); } } } return(bmp2); }
protected bool IncludePredicate(int x, int y, int z) { byte v = bmp.GetPixel(x, y, z); return(v > min && v < max); }
protected bool IncludePredicate(Int16Triple p) { byte v = bmp.GetPixel(p.X, p.Y, p.Z); return(v > min && v < max); }
private bool IsWhite(int x, int y, int z) { return(bmp.GetPixel(x, y, z) == BitMap3d.WHITE); }