Example #1
0
  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;
  }
Example #2
0
  private Segment addRelativeAxon(Segment parent, Point3f relPosition, float radius) {
    Point3f newPosition = (new Point3f(parent.getEndPointPosition()));
    newPosition.add(relPosition);

    String newName = "Axon_" + getOnlyAxonalSegments().size();

    Segment tempAxon = addAxonalSegment(radius, newName, newPosition, parent, 1, newName + "_Sec");
    return tempAxon;
  }
Example #3
0
  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;
  }
Example #4
0
  private void createSections() {
    float axonRadius = .5f;

    Point3f posnEndPoint = new Point3f(0, -15, 0);

    Segment rootAxon =
        addAxonalSegment(axonRadius, "root", posnEndPoint, somaSection, 1, "axonRootSec");

    Vector<Segment> layer = new Vector<Segment>();

    layer.add(addRelativeAxon(rootAxon, new Point3f(-30, -20, -30), axonRadius));
    layer.add(addRelativeAxon(rootAxon, new Point3f(-30, -20, 30), axonRadius));
    layer.add(addRelativeAxon(rootAxon, new Point3f(30, -20, 30), axonRadius));
    layer.add(addRelativeAxon(rootAxon, new Point3f(30, -20, -30), axonRadius));

    for (int i = 0; i < layer.size(); i++) {
      Segment axon = (Segment) layer.elementAt(i);
      Segment a1 = addRelativeAxon(axon, new Point3f(-6, -4, -6), axonRadius);
      Segment a2 = addRelativeAxon(axon, new Point3f(6, -4, -6), axonRadius);
      Segment a3 = addRelativeAxon(axon, new Point3f(-6, -4, 6), axonRadius);
      Segment a4 = addRelativeAxon(axon, new Point3f(6, -4, 6), axonRadius);

      a1.getSection().addToGroup(axonSynGroup);
      a2.getSection().addToGroup(axonSynGroup);
      a3.getSection().addToGroup(axonSynGroup);
      a4.getSection().addToGroup(axonSynGroup);
    }

    float dendriteDiam = 2;

    int numDendrites = 6;

    for (int i = 0; i < numDendrites; i++) {
      double theta = ((2 * Math.PI) / numDendrites) * i;

      float xFact = (float) Math.sin(theta);
      float zFact = (float) Math.cos(theta);

      posnEndPoint = new Point3f(60 * xFact, 60, 60 * zFact);
      Segment radialDend =
          addDendriticSegment(
              dendriteDiam,
              "radialDend_" + i,
              posnEndPoint,
              somaSection,
              0,
              "radialDend_" + i + "_Sec",
              false);

      Point3f posnNew = new Point3f(30 * xFact, 40, 30 * zFact);
      Segment radialDend2 = addRelativeDendrite(radialDend, posnNew);
      radialDend2.getSection().addToGroup(dendSynGroup);
      Point3f posnNew2 = new Point3f(0, 30, 0);
      Segment radialDend3 = addRelativeDendrite(radialDend2, posnNew2);

      radialDend3.getSection().addToGroup(dendSynGroup);

      Point3f posnNew3 = new Point3f(-10 * xFact, 30, -10 * zFact);
      Segment radialDend4 = addRelativeDendrite(radialDend, posnNew3);

      radialDend4.getSection().addToGroup(dendSynGroup);
      Point3f posnNew4 = new Point3f(0, 25, 0);
      Segment radialDend5 = addRelativeDendrite(radialDend4, posnNew4);

      radialDend5.getSection().addToGroup(dendSynGroup);
    }
  }