예제 #1
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;
  }
  @Before
  public void setUp() {
    System.out.println("---------------   setUp() ParameterisedGroupTest");

    cell = new OneSegment("Simple");

    d1 =
        cell.addDendriticSegment(
            1, "d1", new Point3f(10, 0, 0), cell.getFirstSomaSegment(), 1, "Sec1", false);
    d2 = cell.addDendriticSegment(2, "d2", new Point3f(20, 0, 0), d1, 1, "Sec2", false);
    d3 = cell.addDendriticSegment(7, "d3", new Point3f(20, 10, 0), d2, 1, "Sec3", false);

    d3.getSection().setStartRadius(3);

    d1.getSection().setNumberInternalDivisions(4);
    d2.getSection().setNumberInternalDivisions(3);
    d3.getSection().setNumberInternalDivisions(5);

    d3.getSection().addToGroup(tipSection);

    pg1 =
        new ParameterisedGroup(
            "ZeroToOne",
            Section.DENDRITIC_GROUP,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.MOST_PROX_AT_0,
            DistalPref.MOST_DIST_AT_1,
            "p1");

    pg2 =
        new ParameterisedGroup(
            "StartToEnd",
            Section.DENDRITIC_GROUP,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.NO_TRANSLATION,
            DistalPref.NO_NORMALISATION,
            "p2");

    pg3 =
        new ParameterisedGroup(
            "TipZeroToOne",
            tipSection,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.MOST_PROX_AT_0,
            DistalPref.MOST_DIST_AT_1,
            "p3");

    pg4 =
        new ParameterisedGroup(
            "TipToEnd",
            tipSection,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.MOST_PROX_AT_0,
            DistalPref.NO_NORMALISATION,
            "p4");

    pg5 =
        new ParameterisedGroup(
            "TipToEnd_PathFromRoot",
            tipSection,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.NO_TRANSLATION,
            DistalPref.NO_NORMALISATION,
            "p5");

    /*
    pg5 = new ParameterisedGroup("3DDistZeroToOne",
                               Section.ALL,
                               Metric.THREE_D_RADIAL_POSITION,
                               ProximalPref.MOST_PROX_AT_0,
                               DistalPref.MOST_DIST_AT_1);*/

  }
예제 #3
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);
    }
  }