Example #1
0
 @Override
 protected Stx doInBackground(ProgressMonitor pm) throws Exception {
   final Stx stx;
   HistogramPanelModel.HistogramConfig config = createHistogramConfig();
   if (model.hasStx(config)) {
     return model.getStx(config);
   }
   if (!compute) {
     return null;
   }
   if (histogramPlotConfig.useRoiMask
       || histogramPlotConfig.numBins != Stx.DEFAULT_BIN_COUNT
       || histogramPlotConfig.histogramLogScaled
       || min != null
       || max != null) {
     final StxFactory factory = new StxFactory();
     if (histogramPlotConfig.useRoiMask) {
       /*if(histogramPlotConfig.roiMask.getValidShape() == null){
           handleError("The selected mask is empty.\n"+
               "No valid histogram could be computed.");
       }*/
       factory.withRoiMask(histogramPlotConfig.roiMask);
     }
     factory.withHistogramBinCount(histogramPlotConfig.numBins);
     factory.withLogHistogram(histogramPlotConfig.histogramLogScaled);
     if (min != null) {
       if (histogramPlotConfig.histogramLogScaled) {
         factory.withMinimum(Stx.LOG10_SCALING.scaleInverse(min));
       } else {
         factory.withMinimum(min);
       }
     }
     if (max != null) {
       if (histogramPlotConfig.histogramLogScaled) {
         factory.withMaximum(Stx.LOG10_SCALING.scaleInverse(max));
       } else {
         factory.withMaximum(max);
       }
     }
     stx = factory.create(getRaster(), pm);
   } else {
     stx = getRaster().getStx(true, pm);
   }
   if (getRaster() != config.raster) {
     return null;
   }
   return stx;
 }
Example #2
0
 @Override
 public void propertyChange(PropertyChangeEvent evt) {
   if (!adjusting) {
     adjusting = true;
     if (evt.getPropertyName().equals(PROPERTY_NAME_LOGARITHMIC_HISTOGRAM)) {
       if (evt.getNewValue().equals(Boolean.TRUE)) {
         xAxisRangeControl.adjustComponents(
             Stx.LOG10_SCALING.scale(xAxisRangeControl.getMin()),
             Stx.LOG10_SCALING.scale(xAxisRangeControl.getMax()),
             3);
       } else {
         xAxisRangeControl.adjustComponents(
             Stx.LOG10_SCALING.scaleInverse(xAxisRangeControl.getMin()),
             Stx.LOG10_SCALING.scaleInverse(xAxisRangeControl.getMax()),
             3);
       }
     }
     adjusting = false;
   }
 }