@Override Object get() { return new Point3i(value); }
@Override Object get() { Tuple3i[] arr = new Tuple3i[this.length]; for (int i = 0; i < this.length; i++) { int j = i * 3; arr[i] = new Point3i(); arr[i].x = this.value[j+0]; arr[i].y = this.value[j+1]; arr[i].z = this.value[j+2]; } return arr; }
/** * Beginning at the startPoint, slabNeighbors will return *all* contiguous * pixels - not just the immediate neighbors. * * @param startPoint * @return All contiguous neighboring points or empty set. */ Set<Point3i> slabNeighbors(Point3i startPoint) { Set<Point3i> slabPoints = new HashSet<Point3i>(); Queue<Point3i> pointQueue = new LinkedList<Point3i>(); Point3i checkPoint = new Point3i(startPoint.x, startPoint.y, startPoint.z); while (null != checkPoint) { Set<Point3i> slabNeighbors = neighbors(checkPoint, 255); for (Point3i slabPoint : slabNeighbors) { if (slabPoints.add(slabPoint)) { pointQueue.add(slabPoint); } } checkPoint = pointQueue.poll(); } return slabPoints; } }
Point3i point3i; point3i = new Point3i(point.x, point.y, point.z);
private CompressionStream() { this.stream = new LinkedList() ; byteCount = 0 ; vertexCount = 0 ; meshReferenceCount = 0 ; mcBounds[0] = new Point3d(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY) ; mcBounds[1] = new Point3d(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY) ; qcBounds[0] = new Point3i(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE) ; qcBounds[1] = new Point3i(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE) ; /* normalized bounds computed from quantized bounds */ ncBounds[0] = new Point3d() ; ncBounds[1] = new Point3d() ; }
private CompressionStream() { this.stream = new LinkedList() ; byteCount = 0 ; vertexCount = 0 ; meshReferenceCount = 0 ; mcBounds[0] = new Point3d(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY) ; mcBounds[1] = new Point3d(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY) ; qcBounds[0] = new Point3i(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE) ; qcBounds[1] = new Point3i(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE) ; /* normalized bounds computed from quantized bounds */ ncBounds[0] = new Point3d() ; ncBounds[1] = new Point3d() ; }
if (x + 1 < imageWidth) { if (sliceProcessor.getPixel(x + 1, y - 1) == targetPixel) { neighborPointSet.add(new Point3i(x + 1, y - 1, homePoint.z)); neighborPointSet.add(new Point3i(x - 1, y - 1, homePoint.z)); neighborPointSet.add(new Point3i(x, y - 1, homePoint.z)); neighborPointSet.add(new Point3i(x - 1, y, homePoint.z)); neighborPointSet.add(new Point3i(x + 1, y, homePoint.z)); if (x + 1 < imageWidth) { if (sliceProcessor.getPixel(x + 1, y + 1) == targetPixel) { neighborPointSet.add(new Point3i(x + 1, y + 1, homePoint.z)); neighborPointSet.add(new Point3i(x - 1, y + 1, homePoint.z)); neighborPointSet.add(new Point3i(x, y + 1, homePoint.z));
/** * If there are any adjacent pixels at this checkPoint then there could also be * a blob there as well. Get the biggest contiguous blob possible. * * @param checkPoint * @param edge * @param eroded * @return a new Blob or null */ private Blob checkForBlob(Point checkPoint, Edge edge, boolean eroded) { Blob newBlob = null; Point3i point3i = new Point3i(checkPoint.x, checkPoint.y, checkPoint.z); // Get this points adjacent pixels. There can be a maximum of eight. Set<Point3i> neighbors = neighbors(point3i, 255); if (!neighbors.isEmpty()) { for (Point3i nPoint3i : neighbors) { Point nPoint = new Point(nPoint3i.x, nPoint3i.y, nPoint3i.z); newBlob = getBlobAtPoint(nPoint, eroded); if (newBlob == null) { return null; } if (!newBlob.eroded) { return null; } newBlob.edges.add(edge); return newBlob; } } return newBlob; }
public void subtractInverse(final Canvas3D canvas, final Roi roi) { final Polygon p = roi.getPolygon(); final Transform3D volToIP = new Transform3D(); volumeToImagePlate(canvas, volToIP); final Point2d onCanvas = new Point2d(); final Point3i pos = new Point3i(0, 0, 0); for (int z = 0; z < zDim; z++) { for (int y = 0; y < yDim; y++) { for (int x = 0; x < xDim; x++) { volumePointInCanvas(canvas, volToIP, x, y, z, onCanvas); if (!p.contains(onCanvas.x, onCanvas.y)) { setNoCheckNoUpdate(x, y, z, BG); } } } IJ.showStatus("Filling..."); IJ.showProgress(z, zDim); } updateData(); }