Changeset 4225


Ignore:
Timestamp:
07/22/08 15:08:00 (12 years ago)
Author:
nor
Message:

Continuing modifications to run method of BurnInRenderer. First draft complete.
Fixed email address in other two files.

Location:
trunk/loci/slim
Files:
3 edited

Legend:

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

    r4221 r4225  
    3030 
    3131/** 
    32  * TODO 
    3332 * 
    3433 * <dl><dt><b>Source code:</b></dt> 
     
    3635 * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/loci/slim/BurnInRenderer.java">SVN</a></dd></dl> 
    3736 * 
    38  * @author Eric Kjellman egkjellma at wisc.edu 
     37 * @author Eric Kjellman egkjellman at wisc.edu 
    3938 */ 
    4039public class BurnInRenderer extends Renderer { 
     
    4443  protected double[][] image; 
    4544  protected int maxdim; 
     45  private boolean estimated; 
     46  private boolean improving; 
    4647 
    4748  public BurnInRenderer(CurveCollection cc) { 
     
    6364    currentDim = 1; 
    6465    numExponentials = 1; 
     66    estimated = false; 
     67    improving = false; 
    6568  } 
    6669 
     
    7174  public void run() { 
    7275    // initial pass - estimates 
    73     while(subsampleLevel >= 0 && alive) { 
     76    while(subsampleLevel >= 0 && alive && !estimated) { 
    7477      currentCurves = curveData.getCurves(subsampleLevel); 
    7578      while(currentY < currentDim && alive) { 
     
    9295            } 
    9396          } 
     97          currentX++; 
     98          currProgress++; 
    9499        } 
    95100        if(alive) { 
     
    107112      } 
    108113    } 
     114    estimated = true; 
    109115    // initial pass - iterations 
     116    while(estimated && alive && !improving) { 
     117      for(; currentX < currentDim && alive && currentIterations < maxIterations; currentX++) { 
     118        for(; currentY < currentDim && alive && currentIterations < maxIterations; currentY++) { 
     119          currentIterations++; 
     120          currProgress++; 
     121          double currRCSE = currentCurves[currentY][currentX].getReducedChiSquaredError(); 
     122          currentCurves[currentY][currentX].iterate(); 
     123          if(currentCurves[currentY][currentX].getReducedChiSquaredError() < currRCSE) { 
     124            if(currentCurves[currentY][currentX].getReducedChiSquaredError() < maxRCSE) { 
     125              currentIterations = maxIterations; 
     126            } 
     127            double[][] curve = currentCurves[currentY][currentX].getCurve(); 
     128            double[] exponentials = new double[numExponentials]; 
     129            for(int i = 0; i < numExponentials; i++) { 
     130              exponentials[i] = curve[i][1]; 
     131            } 
     132            Arrays.sort(exponentials); 
     133            int pixelsize = maxdim / currentDim; 
     134            for(int x = 0; x < pixelsize; x++) { 
     135              for(int y = 0; y < pixelsize; y++) { 
     136                for(int c = 0; c < numExponentials; c++) { 
     137                  image[numExponentials-c-1][((currentY * pixelsize + y) * maxdim) + 
     138                    (currentX * pixelsize + x)] = exponentials[c]; 
     139                } 
     140              } 
     141            } 
     142          } 
     143        } 
     144      } 
     145    } 
    110146    // continuing improvement 
    111147    while(alive) { 
     148      improving = true; 
     149      currProgress = maxProgress; 
     150      // Find worst: 
     151      int worstx = -1; 
     152      int worsty = -1; 
     153      double worstval = 0; 
     154      for(int x = 0; x < maxdim; x++) { 
     155        for(int y = 0; y < maxdim; y++) { 
     156          if(currentCurves[y][x].getReducedChiSquaredError() > worstval) { 
     157            worstval = currentCurves[y][x].getReducedChiSquaredError(); 
     158            worstx = x; 
     159            worsty = y; 
     160          } 
     161        } 
     162      } 
     163      currentX = worstx; 
     164      currentY = worsty; 
     165      currentCurves[currentY][currentX].iterate(); 
    112166    } 
    113167  } 
  • trunk/loci/slim/GACurveFitter.java

    r4223 r4225  
    1 // TODO: Tau cannot be negative. >_< 
    21// 
    32// GACurveFitter.java 
  • trunk/loci/slim/Renderer.java

    r4221 r4225  
    3232 * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/loci/slim/Renderer.java">SVN</a></dd></dl> 
    3333 * 
    34  * @author Eric Kjellman egkjellma at wisc.edu 
     34 * @author Eric Kjellman egkjellman at wisc.edu 
    3535 */ 
    3636public abstract class Renderer implements Runnable { 
Note: See TracChangeset for help on using the changeset viewer.