コード例 #1
0
 /** Creates new form HDRResponseFunctionCalculatorFrame */
 public HDRResponseFunctionCalculatorFrame(ResponseFunctionCalculator calculator) {
   initComponents();
   this.calculator = calculator;
   this.txtNoOfPixels.setText(
       String.valueOf(calculator.getResponseFunctionCalculatorSettings().getNoOfPixelsN()));
   this.txtNoOfChannels.setText(
       String.valueOf(calculator.getResponseFunctionCalculatorSettings().getNoOfChannels()));
   this.txtNoOfImages.setText(
       String.valueOf(calculator.getResponseFunctionCalculatorSettings().getNoOfImages()));
   this.txtExpTimes.setText(
       ArrayTools.arrayToString(calculator.getResponseFunctionCalculatorSettings().getExpTimes()));
   this.lblAlgorithm_.setText(calculator.getAlgorithm());
 }
コード例 #2
0
 private void btnSaveBinActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnSaveBinActionPerformed
   if (getOut() == null) {
     return;
   }
   String fn = calculator.getResponseFunctionCalculatorSettings().getFileName();
   String path = getPath(fn);
   if (path == null) {
     return;
   }
   ObjectOutputStream writer = null;
   try {
     writer = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(path)));
     writer.writeObject(getOut());
   } catch (IOException ex) {
     Logger.getLogger(HDRResponseFunctionCalculatorFrame.class.getName())
         .log(Level.SEVERE, null, ex);
   } finally {
     try {
       writer.close();
     } catch (IOException ex) {
       Logger.getLogger(HDRResponseFunctionCalculatorFrame.class.getName())
           .log(Level.SEVERE, null, ex);
     }
   }
 } // GEN-LAST:event_btnSaveBinActionPerformed
コード例 #3
0
 private void btnCalcActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnCalcActionPerformed
   try {
     btnCalc.setEnabled(false);
     btnShow.setEnabled(false);
     btnSaveBin.setEnabled(false);
     btnCancel.setEnabled(false);
     btnHelp.setEnabled(false);
     int type = calculator.getResponseFunctionCalculatorSettings().getType();
     int lambda = Integer.parseInt(txtLambda.getText());
     double[][] g;
     switch (type) {
       case ImagePlus.COLOR_RGB:
         g = new double[3][];
         System.out.println("Channel 0:");
         g[0] = calculator.calcResponse(0, lambda);
         System.out.println("Channel 1:");
         g[1] = calculator.calcResponse(1, lambda);
         System.out.println("Channel 2:");
         g[2] = calculator.calcResponse(2, lambda);
         out = new ResponseFunction(g, type, calculator.getW());
         btnCalc.setEnabled(true);
         btnShow.setEnabled(true);
         btnSaveBin.setEnabled(true);
         btnCancel.setEnabled(true);
         btnHelp.setEnabled(true);
         btnSaveTxt.setEnabled(true);
         break;
       case ImagePlus.GRAY16:
         g = new double[1][];
         g[0] = calculator.calcResponse(0, lambda);
         out = new ResponseFunction(g, type, calculator.getW());
         btnCalc.setEnabled(true);
         btnShow.setEnabled(true);
         btnSaveBin.setEnabled(true);
         btnCancel.setEnabled(true);
         btnHelp.setEnabled(true);
         break;
       default:
         IJ.error("The image has an unsupported image type!");
         btnCalc.setEnabled(true);
         btnShow.setEnabled(false);
         btnSaveBin.setEnabled(false);
         btnCancel.setEnabled(true);
         btnHelp.setEnabled(true);
     }
   } catch (TypeNotSupportedException ex) {
     Logger.getLogger(HDRResponseFunctionCalculatorFrame.class.getName())
         .log(Level.SEVERE, null, ex);
   }
 } // GEN-LAST:event_btnCalcActionPerformed
コード例 #4
0
 private void btnShowActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnShowActionPerformed
   double[] yVal = new double[calculator.getResponseFunctionCalculatorSettings().getLevels()];
   for (int i = 0; i < yVal.length; i++) {
     yVal[i] = i;
   }
   PlotWindow plot;
   switch (out.getType()) {
     case ImagePlus.COLOR_RGB:
       plot = new PlotWindow("Response Function", "x", "y", out.getG()[0], yVal);
       plot.setColor(Color.GREEN);
       plot.addPoints(out.getG()[1], yVal, PlotWindow.LINE);
       plot.setColor(Color.BLUE);
       plot.addPoints(out.getG()[2], yVal, PlotWindow.LINE);
       plot.setColor(Color.RED);
       plot.draw();
       break;
     case ImagePlus.GRAY16:
       plot = new PlotWindow("Response Function", "x", "y", out.getG()[0], yVal);
       plot.draw();
       break;
   }
 } // GEN-LAST:event_btnShowActionPerformed