private Segment addRelativeDendrite(Segment parent, Point3f relPosition) { Point3f newPosition = (new Point3f(parent.getEndPointPosition())); newPosition.add(relPosition); float newRadius = parent.getRadius() * .6f; String newName = "Dend_" + getOnlyDendriticSegments().size(); Segment tempDend = addDendriticSegment(newRadius, newName, newPosition, parent, 1, newName + "_Sec", true); return tempDend; }
public boolean isCellWithinRegion(Point3f point, Cell cell, boolean completelyInside) { logger.logComment("Checking point: " + point + " in: " + toString()); float minXLoc, minYLoc, minZLoc; float maxXLoc, maxYLoc, maxZLoc; Segment firstSeg = cell.getFirstSomaSegment(); if (completelyInside) logger.logComment("Cell needs to be completely inside"); else logger.logComment( "Only cell centre (" + firstSeg.getStartPointPosition() + ") needs to be inside"); int factor = 0; if (completelyInside) factor = 1; minXLoc = parameterList[0].value + factor * firstSeg.getSection().getStartRadius(); minYLoc = parameterList[1].value + factor * firstSeg.getSection().getStartRadius(); minZLoc = parameterList[2].value + factor * firstSeg.getSection().getStartRadius(); maxXLoc = parameterList[0].value + parameterList[3].value - factor * firstSeg.getSection().getStartRadius(); maxYLoc = parameterList[1].value + parameterList[4].value - factor * firstSeg.getSection().getStartRadius(); maxZLoc = parameterList[2].value + parameterList[5].value - factor * firstSeg.getSection().getStartRadius(); Point3f actualStartOfSoma = new Point3f( point.x + firstSeg.getSection().getStartPointPositionX(), point.y + firstSeg.getSection().getStartPointPositionY(), point.z + firstSeg.getSection().getStartPointPositionZ()); logger.logComment( "actualStartOfSoma: " + actualStartOfSoma + ", radius: " + firstSeg.getSection().getStartRadius()); if (actualStartOfSoma.x < minXLoc || actualStartOfSoma.x > maxXLoc || actualStartOfSoma.y < minYLoc || actualStartOfSoma.y > maxYLoc || actualStartOfSoma.z < minZLoc || actualStartOfSoma.z > maxZLoc) return false; if (completelyInside) { Vector somaSegments = cell.getOnlySomaSegments(); for (int i = 0; i < somaSegments.size(); i++) { Segment nextSeg = (Segment) somaSegments.elementAt(i); Point3f actualEndPoint = new Point3f( point.x + nextSeg.getEndPointPositionX(), point.y + nextSeg.getEndPointPositionY(), point.z + nextSeg.getEndPointPositionZ()); logger.logComment("actualEndPoint: " + actualEndPoint + ", radius: " + nextSeg.getRadius()); if (actualEndPoint.x < parameterList[0].value + nextSeg.getRadius() || actualEndPoint.x > parameterList[0].value + parameterList[3].value - nextSeg.getRadius() || actualEndPoint.y < parameterList[1].value + nextSeg.getRadius() || actualEndPoint.y > parameterList[1].value + parameterList[4].value - nextSeg.getRadius() || actualEndPoint.z < parameterList[2].value + nextSeg.getRadius() || actualEndPoint.z > parameterList[2].value + parameterList[5].value - nextSeg.getRadius()) return false; } } return true; }