예제 #1
0
  /**
   * This method should be called whenever a new set of histogram values is to be displayed (i.e.
   * when a different image gets focus).
   *
   * @param histogramData
   */
  public void setHistogramData(final HistogramDataGroup histogramData) {
    double[] minMaxView;
    double[] minMaxLUT;
    synchronized (_synchObject) {
      _histogramDataGroup = histogramData;
      _histogramDataGroup.setListener(new HistogramDataListener());
      minMaxView = _histogramDataGroup.getMinMaxView();
      minMaxLUT = _histogramDataGroup.getMinMaxLUT();
    }

    //		IJ.log("----");
    //		IJ.log("setHistogramData");
    //		IJ.log("view " + minMaxView[0] + " "  + minMaxView[1] + " lut " + minMaxLUT[0] + " " +
    // minMaxLUT[1]);
    //		IJ.log("----");

    if (null != _frame) {
      if (_frame.isVisible()) {
        _frame.setVisible(true);
      }
      _frame.setTitle(histogramData.getTitle());

      _histogramPanel.setStatistics(histogramData.getStatistics(WIDTH));

      final boolean autoRange = histogramData.getAutoRange();
      if (autoRange) {
        // turn cursors off
        _histogramPanel.setCursors(null, null);
      } else {
        // set cursors to edges
        _histogramPanel.setCursors(INSET, INSET + WIDTH - 1);
      }
      _uiPanel.setAutoRange(autoRange);
      _uiPanel.setExcludePixels(histogramData.getExcludePixels());
      _uiPanel.setCombineChannels(histogramData.getCombineChannels());
      _uiPanel.setDisplayChannels(histogramData.getDisplayChannels());
      _uiPanel.enableChannels(histogramData.hasChannels());
      _uiPanel.setMinMaxLUT(minMaxLUT[0], minMaxLUT[1]);

      _colorBarPanel.setMinMax(minMaxView[0], minMaxView[1], minMaxLUT[0], minMaxLUT[1]);
    }
  }
예제 #2
0
  /*
   * Updates histogram and color bar during the fit.
   */
  private void changed(
      final double minView, final double maxView, final double minLUT, final double maxLUT) {
    synchronized (_synchObject) {
      // TODO ARG added this 9/27 to change hDG internal minMaxViews
      _histogramDataGroup.setMinMaxView(minView, maxView);
      _histogramPanel.setStatistics(_histogramDataGroup.getStatistics(WIDTH));
      _colorBarPanel.setMinMax(minView, maxView, minLUT, maxLUT);
      // TODO changed is currently called from two places:
      // i) the HistogramData listener will call it periodically during the
      // fit.
      // ii) if the user types in a new LUT range this gets called.
      // iii) in the future more UI interactions will wind up here
      //
      // TODO if the user drags a new LUT range this doesn't get called!

      // IJ.log("changed min/maxView " + minView + " " + maxView +
      // " min/maxLUT " + minLUT + " " + maxLUT);

      _histogramDataGroup.redisplay();
    }
  }