コード例 #1
0
  private Content makeTrackContent() {
    // Prepare tracks instant
    trackNode = new TrackDisplayNode(model);
    universe.addTimelapseListener(trackNode);

    // Pass tracks instant to all instants
    final TreeMap<Integer, ContentInstant> instants = new TreeMap<Integer, ContentInstant>();
    final ContentInstant trackCI = new ContentInstant("Tracks_all_frames");
    trackCI.display(trackNode);
    instants.put(0, trackCI);
    final Content tc = new Content(TRACK_CONTENT_NAME, instants);
    tc.setShowAllTimepoints(true);
    tc.showCoordinateSystem(false);
    return tc;
  }
コード例 #2
0
  private void buildFrameContent(
      final SpotCollection spots,
      final Integer frame,
      final double radiusRatio,
      final FeatureColorGenerator<Spot> spotColorGenerator) {
    final Map<Spot, Point4d> centers = new HashMap<Spot, Point4d>(spots.getNSpots(frame, false));
    final Map<Spot, Color4f> colors = new HashMap<Spot, Color4f>(spots.getNSpots(frame, false));
    final double[] coords = new double[3];

    for (final Iterator<Spot> it = spots.iterator(frame, false); it.hasNext(); ) {
      final Spot spot = it.next();
      TMUtils.localize(spot, coords);
      final Double radius = spot.getFeature(Spot.RADIUS);
      final double[] pos = new double[] {coords[0], coords[1], coords[2], radius * radiusRatio};
      centers.put(spot, new Point4d(pos));
      final Color4f col = new Color4f(spotColorGenerator.color(spot));
      col.w = 0f;
      colors.put(spot, col);
    }
    final SpotGroupNode<Spot> blobGroup = new SpotGroupNode<Spot>(centers, colors);
    final ContentInstant contentThisFrame = new ContentInstant("Spots_frame_" + frame);

    try {
      contentThisFrame.display(blobGroup);
    } catch (final BadTransformException bte) {
      System.err.println(
          "Bad content for frame "
              + frame
              + ". Generated an exception:\n"
              + bte.getLocalizedMessage()
              + "\nContent was:\n"
              + blobGroup.toString());
    }

    // Set visibility:
    if (spots.getNSpots(frame, true) > 0) {
      blobGroup.setVisible(spots.iterable(frame, true));
    }

    contentAllFrames.put(frame, contentThisFrame);
    blobs.put(frame, blobGroup);
  }