private Point3D ScanProjection(Point3D point, Axis axis, Probe fixProbe) { #if DEBUG _labelMap().AddDebugPoint(point); #endif var projection = _scanData.GetProjection(axis, point[axis]); if (projection.Empty) { return(point); } var scalarPoint = point.To2D(axis); ushort probe = _lookupTable.Map(projection.Pixels[scalarPoint.X, scalarPoint.Y]); if (fixProbe.InRange(probe)) { var layer = RayCasting(point, projection, fixProbe); var point3Ds = layer as Point3D[] ?? layer.ToArray(); var center = Helpers.CalculateLayerCenter(point3Ds.ToList()); _labelMap().Add(point3Ds); _labelMap().AddCenter(point); return(center); } return(point); }
private bool SafeCheckProbe(Probe probe, Projection proj, Point2D p) { if (p.X < 0 || p.X >= proj.Width || p.Y < 0 || p.Y >= proj.Height) { return(false); } return(probe.InRange(_lookupTable.Map(proj.Pixels[p.X, p.Y]))); }
private Point3D ScanProjection(Point3D point, Probe fixProbe) { var projection = _scanData.GetProjection(Axis.Z, point[Axis.Z]); if (projection.Empty) { return(point); } var scalarPoint = point.To2D(Axis.Z); var crop = _labelMap().Crop; for (var x = scalarPoint.X; x < crop.XR; x++) { scalarPoint.X = x; var probe = _lookupTable.Map(projection.Pixels[scalarPoint.X, scalarPoint.Y]); if (!fixProbe.InRange(probe) || _crossCheck.Check(scalarPoint.To3D(Axis.Z, point.Z), _labelMap().Id)) { break; } } var layer = Scan(scalarPoint, projection, fixProbe, point[Axis.Z]); var point3Ds = layer as Point3D[] ?? layer.ToArray(); if (point3Ds.Any()) { var center = Helpers.CalculateLayerCenter(point3Ds.ToList()); _labelMap().Add(point3Ds); _labelMap().AddCenter(center); return(center); } return(point); }
private Point2D Cast(Point2D point, double angle, Projection projection, Probe refProbe) { var p2d = new Point2D(point.X, point.Y); int skipped = 0; var crop = _labelMap().Crop; for (var l = 0; l < Math.Max(projection.Width, projection.Height); l++) { p2d.X = (int)(point.X + Math.Cos(angle) * l); p2d.Y = (int)(point.Y + Math.Sin(angle) * l); var p3d = p2d.To3D(projection.Axis, projection.AxisPos); Point3D p3dBounded; if (!crop.IsInCrop(p3d, out p3dBounded) || _crossCheck.Check(p3d, _labelMap().Id)) { return(p3dBounded.To2D(projection.Axis)); } var probe = _lookupTable.Map(projection.Pixels[p2d.X, p2d.Y]); if (!refProbe.InRange(probe)) { skipped++; } else { skipped = 0; } if (skipped >= ScannerProperties.MaxSkip) { break; } } return(p2d); }