コード例 #1
0
ファイル: ShadowsDemo.java プロジェクト: physion/imagej
  /**
   * Runs the plugin. The plugin continually runs each shadow transformation until ESC is pressed.
   */
  @Override
  public void run() {
    if (unsupportedImage(display)) {
      cancel("This command only works with a single plane of data");
      return;
    }
    statusService.showStatus("Press ESC to terminate");

    final Dataset input = imgDispService.getActiveDataset(display);
    final RealRect selection = overlayService.getSelectionBounds(display);
    final Dataset originalData = input.duplicate();
    userHasQuit = false;
    while (!userHasQuit) {
      for (int i = 0; i < KERNELS.length; i++) {
        final Convolve3x3Operation operation =
            new Convolve3x3Operation(input, selection, KERNELS[i]);
        operation.run();
        try {
          Thread.sleep(100);
        } catch (final Exception e) {
          // do nothing
        }
        originalData.copyInto(input);
        if (userHasQuit) break;
      }
    }
    statusService.showStatus("Shadows demo terminated");
  }
コード例 #2
0
ファイル: TableDemo.java プロジェクト: MeiChunLo/imagej
  @Override
  public void run() {
    statusService.showStatus("Creating a small table...");
    createBaseballTable();

    // create a larger table with 10K elements
    statusService.showStatus("Creating a large table...");
    createBigTable();

    // create a simple spreadsheet (with string data values)
    statusService.showStatus("Creating spreadsheet...");
    createSpreadsheet();

    statusService.clearStatus();
  }
コード例 #3
0
ファイル: AnimationService.java プロジェクト: Jondeen/imagej
 /** Stops animation for the given {@link ImageDisplay}. */
 public void stop(final ImageDisplay display) {
   final Animation animation = animations.get(display);
   if (animation != null) {
     animation.stop();
     statusService.showStatus(STOPPED_STATUS);
   }
 }
コード例 #4
0
ファイル: RectangleAdapter.java プロジェクト: CaTaHaTa/imagej
 // drag - publish rectangle dimensions in status bar
 @Override
 public void onMouseDrag(final MsDraggedEvent evt) {
   if (evt.getButton() != MsButtonEvent.LEFT_BUTTON) return;
   final StatusService statusService = evt.getContext().getService(StatusService.class);
   final ImageDisplayService imgService = evt.getContext().getService(ImageDisplayService.class);
   final ImageDisplay imgDisp = imgService.getActiveImageDisplay();
   final IntCoords startPt = new IntCoords(anchor.x, anchor.y);
   final IntCoords endPt = new IntCoords(evt.getX() - anchor.x, evt.getY() - anchor.y);
   final RealCoords startPtModelSpace = imgDisp.getCanvas().panelToImageCoords(startPt);
   final RealCoords endPtModelSpace = imgDisp.getCanvas().panelToImageCoords(endPt);
   final int x = (int) startPtModelSpace.x;
   final int y = (int) startPtModelSpace.y;
   final int w = (int) endPtModelSpace.x;
   final int h = (int) endPtModelSpace.y;
   final String message = String.format("x=%d, y=%d, w=%d, h=%d", x, y, w, h);
   statusService.showStatus(message);
   // NB: Prevent PixelProbe from overwriting the status bar.
   evt.consume();
 }
コード例 #5
0
ファイル: AnimationService.java プロジェクト: Jondeen/imagej
 /** Starts animation for the given {@link ImageDisplay}. */
 public void start(final ImageDisplay display) {
   getAnimation(display).start();
   statusService.showStatus(STARTED_STATUS);
 }
コード例 #6
0
ファイル: AnimationService.java プロジェクト: Jondeen/imagej
 /** Stops all animations. */
 public void stopAll() {
   for (final Animation animation : animations.values()) {
     animation.stop();
   }
   statusService.showStatus(ALL_STOPPED_STATUS);
 }