Changeset 4249


Ignore:
Timestamp:
07/23/08 16:47:16 (11 years ago)
Author:
curtis
Message:

Do not start per-pixel lifetime analysis until Start button is pressed.

Location:
trunk/loci/slim
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/slim/GACurveFitter.java

    r4244 r4249  
    286286      // Fix bug where the estimate occasionally produces negative 
    287287      // tau values. If this happens, we'll sort it out in iteration. 
    288       System.out.println("Exp: " + exp); 
    289288      if (curveEstimate[0][1] <= 0) curveEstimate[0][1] = 1000; 
    290289    } 
  • trunk/loci/slim/TwoDPane.java

    r4245 r4249  
    5959  private static final Color INVALID_COLOR = Color.red.brighter(); 
    6060 
     61  /** Progress bar is updated every RATE milliseconds. */ 
     62  private static final int RATE = 100; // TODO - make this a UI option 
     63 
     64  /** Lifetime image is redrawn every SKIPth frame. */ 
     65  private static final int SKIP = 3; 
     66 
    6167  // -- Fields -- 
    6268 
     
    104110  private Thread[] curveThreads; 
    105111  private Timer lifetimeRefresh; 
     112  private boolean lifetimeActive; 
     113  private int frame; // internal frame counter 
    106114 
    107115  // -- Constructor -- 
     
    301309    cSlider.setValue(maxChan + 1); 
    302310 
    303     // set up lifetime curve fitting threads for per-pixel lifetime analysis 
     311    // set up lifetime curve fitting renderers for per-pixel lifetime analysis 
    304312    curveRenderers = new Renderer[data.channels]; 
    305313    curveThreads = new Thread[data.channels]; 
     
    308316      curveRenderers[c].setComponentCount(data.numExp); 
    309317      curveRenderers[c].setMaxIterations(100); 
    310       curveThreads[c] = new Thread(curveRenderers[c], "Lifetime-" + c); 
    311       curveThreads[c].setPriority(Thread.MIN_PRIORITY); 
    312     } 
    313     int delay = 100; // TODO - make this a UI option (FPS) 
     318    } 
     319    int delay = RATE; 
    314320    lifetimeRefresh = new Timer(delay, this); 
    315     for (int c=0; c<data.channels; c++) curveThreads[c].start(); 
    316321    lifetimeRefresh.start(); 
    317322  } 
     
    331336    Object src = e.getSource(); 
    332337    if (src == startStopButton) { 
    333       // TODO 
    334       if (startStopButton.getText().equals("Start")) { 
     338      lifetimeActive = !lifetimeActive; 
     339      if (lifetimeActive) { 
    335340        // begin lifetime computation 
    336341        startStopButton.setText("Stop"); 
     342        for (int c=0; c<data.channels; c++) { 
     343          curveThreads[c] = new Thread(curveRenderers[c], "Lifetime-" + c); 
     344          curveThreads[c].setPriority(Thread.MIN_PRIORITY); 
     345        } 
     346        for (int c=0; c<data.channels; c++) curveThreads[c].start(); 
    337347      } 
    338348      else { 
    339349        // terminate lifetime computation 
    340350        startStopButton.setText("Start"); 
     351        for (int c=0; c<data.channels; c++) curveRenderers[c].stop(); 
    341352      } 
    342353    } 
     
    353364    else { 
    354365      // timer event - update progress bar and lifetime display 
     366      if (!lifetimeActive) return; 
     367      frame++; 
    355368      int c = cSlider.getValue() - 1; 
    356369 
    357370      int curProg = curveRenderers[c].getCurrentProgress(); 
    358371      int maxProg = curveRenderers[c].getMaxProgress(); 
     372      progress.setValue(curProg <= maxProg ? curProg : 0); 
    359373      progress.setMaximum(maxProg); 
    360       progress.setValue(curProg); 
    361374      if (curProg == maxProg) { 
    362375        int totalIter = curveRenderers[c].getTotalIterations(); 
     
    376389      } 
    377390 
    378       if (lifetimeMode.isSelected()) { 
     391      if (frame % SKIP == 0 && lifetimeMode.isSelected()) { 
    379392        // update VisAD display 
    380393        double[][] lifetimeImage = curveRenderers[c].getImage(); 
     
    588601      imageRef.setData(lifetimeField); 
    589602 
    590       // reset to HSV color map 
     603      // reset to RGB color map 
    591604      ColorControl cc = (ColorControl) iPlot.getControl(ColorControl.class); 
    592       cc.setTable(ColorControl.initTableHSV(new float[3][256])); 
     605      cc.setTable(ColorControl.initTableVis5D(new float[3][256])); 
    593606 
    594607      resetMinMax(lifetimeMin, lifetimeMax); 
Note: See TracChangeset for help on using the changeset viewer.