Ignore:
Timestamp:
12/20/11 18:45:53 (8 years ago)
Author:
aivar
Message:

UI panel now has noise model, fitted images, and chi square target

Location:
trunk/projects/slim-plugin/src/main/java/imagej/slim
Files:
1 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/projects/slim-plugin/src/main/java/imagej/slim/fitting/AbstractBaseFittedImage.java

    r7838 r7842  
    3535        _values = new double[x][y]; 
    3636        //TODO need to handle multiple channels: 
    37         // _values c/b slice being drawn only; refer to Image for other slices 
     37        // _values c/b slice being drawn only; refer to Image for other slices; this scheme would fall apart if Image is colorized grayscale like SPCImage 
    3838        HistogramDataChannel histogramDataChannel = new HistogramDataChannel(_values); 
    3939        HistogramDataChannel[] histogramDataChannels = new HistogramDataChannel[] { histogramDataChannel }; 
     
    4141        _image = new FloatProcessor(x, y); 
    4242        _image.setColorModel(imagej.slim.histogram.HistogramTool.getIndexColorModel()); 
     43        //TODO fill the image with a color that will be out of LUT range and paint black!: 
     44        _image.setValue(Float.NaN); //TODO 
     45        _image.fill(); //TODO 
    4346        _imagePlus = new ImagePlus(title, _image); 
    4447        _imagePlus.show(); 
     
    4851            } 
    4952             
    50             public void focusLost(FocusEvent e) { 
    51                  
    52             } 
     53            public void focusLost(FocusEvent e) { } 
    5354        });   
    5455    } 
     
    8687        // clear the 2D slice 
    8788        clear(_values); 
    88  
    8989    } 
    9090    /** 
     
    118118        // etc. 
    119119        _imagePlus.setProcessor(_image.duplicate()); 
     120         
     121         
     122        System.out.println("RECALC " + numInvalid(_values)); 
    120123    } 
     124     
     125     
     126    private int numInvalid(double[][] values) { 
     127        int count = 0; 
     128        int num = 0; 
     129        for (int y = 0; y < values[0].length; ++y) { 
     130            for (int x = 0; x < values.length; ++x) { 
     131                if (InvalidDouble.isValue(values[x][y])) { 
     132                    ++num; 
     133                } 
     134                ++count; 
     135            } 
     136        } 
     137        System.out.println("checked " + count + " pixels,  found invalid " + num); 
     138        return num; 
     139    }    
     140     
     141     
     142     
    121143     
    122144    /** 
     
    158180    abstract public double getValue(double[] parameters);  
    159181 
     182    /* 
     183     * Clears the values for this slice. 
     184     *  
     185     * @param values  
     186     */ 
    160187    private void clear(double[][] values) { 
    161188        for (int y = 0; y < values[0].length; ++y) { 
    162189            for (int x = 0; x < values.length; ++x) { 
    163                 values[x][y] = Double.NaN; 
     190                values[x][y] = InvalidDouble.value(); 
    164191            } 
    165192        } 
  • trunk/projects/slim-plugin/src/main/java/imagej/slim/fitting/IFittedImage.java

    r7833 r7842  
    1212/** 
    1313 * 
    14  * @author aivar 
     14 * @author Sivar Grislis 
    1515 */ 
    1616public interface IFittedImage { 
  • trunk/projects/slim-plugin/src/main/java/imagej/slim/fitting/callable/FittingEngineCallable.java

    r7811 r7842  
    6868        _curveFitter.setFitAlgorithm(_globalParams.getFitAlgorithm()); 
    6969        _curveFitter.setFitFunction(_globalParams.getFitFunction()); 
     70        _curveFitter.setNoiseModel(_globalParams.getNoiseModel()); 
    7071        _curveFitter.setInstrumentResponse(_globalParams.getPrompt()); 
    7172        _curveFitter.setXInc(_globalParams.getXInc()); 
  • trunk/projects/slim-plugin/src/main/java/imagej/slim/fitting/params/GlobalFitParams.java

    r7811 r7842  
    3737import loci.curvefitter.ICurveFitter.FitAlgorithm; 
    3838import loci.curvefitter.ICurveFitter.FitFunction; 
     39import loci.curvefitter.ICurveFitter.NoiseModel; 
    3940 
    4041/** 
     
    4748    private FitAlgorithm _fitAlgorithm; 
    4849    private FitFunction _fitFunction; 
     50    private NoiseModel _noiseModel; 
    4951    private double _xInc; 
    5052    private double[] _prompt; 
     
    7476    public FitFunction getFitFunction() { 
    7577        return _fitFunction; 
     78    } 
     79 
     80    @Override 
     81    public void setNoiseModel(NoiseModel noiseModel) { 
     82        _noiseModel = noiseModel; 
     83    } 
     84 
     85    @Override 
     86    public NoiseModel getNoiseModel() { 
     87        return _noiseModel; 
    7688    } 
    7789     
  • trunk/projects/slim-plugin/src/main/java/imagej/slim/fitting/params/IGlobalFitParams.java

    r7811 r7842  
    3737import loci.curvefitter.ICurveFitter.FitAlgorithm; 
    3838import loci.curvefitter.ICurveFitter.FitFunction; 
     39import loci.curvefitter.ICurveFitter.NoiseModel; 
    3940 
    4041/** 
     
    5354     
    5455    public FitFunction getFitFunction(); 
     56     
     57    public void setNoiseModel(NoiseModel noiseModel); 
     58     
     59    public NoiseModel getNoiseModel(); 
    5560     
    5661    public void setXInc(double xInc); 
  • trunk/projects/slim-plugin/src/main/java/imagej/slim/histogram/HistogramDataChannel.java

    r7834 r7842  
    44 */ 
    55package imagej.slim.histogram; 
     6 
     7import imagej.slim.fitting.InvalidDouble; 
    68 
    79/** 
     
    6870        for (int i = 0; i < _values.length; ++i) { 
    6971            for (int j = 0; j < _values[0].length; ++j) { 
    70                 if (_values[i][j] != Double.NaN) { 
     72                if (InvalidDouble.isValue(_values[i][j])) { 
    7173                    if (_values[i][j] < _min) { 
    7274                        _min = _values[i][j]; 
Note: See TracChangeset for help on using the changeset viewer.