Ignore:
Timestamp:
02/13/12 09:55:09 (8 years ago)
Author:
aivar
Message:

Fixed some channel bugs; started Estimator.

Location:
trunk/projects/slim-plugin/src/main/java/loci/slim/fitting
Files:
7 added
27 copied

Legend:

Unmodified
Added
Removed
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/FitInfo.java

    r7887 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.fitting; 
     5package loci.slim.fitting; 
    66 
    77import java.awt.image.IndexColorModel; 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/IDecayImage.java

    r7887 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.fitting; 
     5package loci.slim.fitting; 
     6 
     7import loci.slim.process.IProcessor; 
    68 
    79import mpicbg.imglib.image.Image; 
     
    1315 * @author Aivar Grislis 
    1416 */ 
    15 public interface IDecayImage<T extends RealType<T>> { 
     17public interface IDecayImage<T extends RealType<T>> extends IProcessor { 
    1618     
    1719    /** 
     
    4143     */ 
    4244    public int getBins(); 
    43  
     45     
    4446    /** 
    45      * Gets whether or not to fit this pixel. 
     47     * Specifies a source IProcessor to be chained to this one. 
    4648     *  
    47      * @param x 
    48      * @param y 
    49      * @param channel 
    50      * @return  
     49     * @param processor  
    5150     */ 
    52     public boolean fitThisPixel(int[] location); 
    53     
     51    public void chain(IProcessor processor); 
     52     
    5453    /** 
    5554     * Gets input pixel value. 
     
    5857     * @param y 
    5958     * @param channel 
    60      * @return  
     59     * @return null or pixel value 
    6160     */ 
    6261    public double[] getPixel(int[] location); 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/IFittedImage.java

    r7887 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.fitting; 
     5package loci.slim.fitting; 
    66 
    77import mpicbg.imglib.image.Image; 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/callable/FittingEngineCallable.java

    r7875 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.callable; 
     35package loci.slim.fitting.callable; 
    3636 
    37 import imagej.slim.fitting.params.FitResults; 
    38 import imagej.slim.fitting.params.ILocalFitParams; 
    39 import imagej.slim.fitting.params.IGlobalFitParams; 
    40 import imagej.slim.fitting.params.IFitResults; 
     37import loci.slim.fitting.params.FitResults; 
     38import loci.slim.fitting.params.ILocalFitParams; 
     39import loci.slim.fitting.params.IGlobalFitParams; 
     40import loci.slim.fitting.params.IFitResults; 
    4141 
    4242import loci.curvefitter.CurveFitData; 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/callable/IFittingEngineCallable.java

    r7811 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.callable; 
     35package loci.slim.fitting.callable; 
    3636 
    37 import imagej.slim.fitting.params.ILocalFitParams; 
    38 import imagej.slim.fitting.params.IGlobalFitParams; 
    39 import imagej.slim.fitting.params.IFitResults; 
     37import loci.slim.fitting.params.ILocalFitParams; 
     38import loci.slim.fitting.params.IGlobalFitParams; 
     39import loci.slim.fitting.params.IFitResults; 
    4040import loci.curvefitter.ICurveFitter; 
    4141 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/config/Configuration.java

    r7832 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.config; 
     35package loci.slim.fitting.config; 
    3636 
    37 import imagej.slim.fitting.callable.IFittingEngineCallable; 
    38 import imagej.slim.fitting.callable.FittingEngineCallable; 
    39 import imagej.slim.fitting.cursor.LameCursorEstimator; 
    40 import imagej.slim.fitting.cursor.ICursorEstimator; 
    41 import imagej.slim.fitting.engine.IFittingEngine; 
    42 import imagej.slim.fitting.engine.ThreadedFittingEngine; 
     37import loci.slim.fitting.callable.IFittingEngineCallable; 
     38import loci.slim.fitting.callable.FittingEngineCallable; 
     39import loci.slim.fitting.cursor.LameCursorEstimator; 
     40import loci.slim.fitting.cursor.ICursorEstimator; 
     41import loci.slim.fitting.engine.IFittingEngine; 
     42import loci.slim.fitting.engine.ThreadedFittingEngine; 
    4343 
    4444import loci.curvefitter.ICurveFitter; 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/config/ConfigurationHelper.java

    r7805 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.config; 
     35package loci.slim.fitting.config; 
    3636 
    3737/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/cursor/Cursor.java

    r7805 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.cursor; 
     35package loci.slim.fitting.cursor; 
    3636 
    3737/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/cursor/ICursor.java

    r7805 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.cursor; 
     35package loci.slim.fitting.cursor; 
    3636 
    3737/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/cursor/ICursorEstimator.java

    r7805 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.cursor; 
     35package loci.slim.fitting.cursor; 
    3636 
    3737/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/cursor/LameCursorEstimator.java

    r7805 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.cursor; 
     35package loci.slim.fitting.cursor; 
    3636 
    3737/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/engine/IFittingEngine.java

    r7864 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.engine; 
     35package loci.slim.fitting.engine; 
    3636 
    37 import imagej.slim.fitting.params.ILocalFitParams; 
    38 import imagej.slim.fitting.params.IGlobalFitParams; 
    39 import imagej.slim.fitting.params.IFitResults; 
     37import loci.slim.fitting.params.ILocalFitParams; 
     38import loci.slim.fitting.params.IGlobalFitParams; 
     39import loci.slim.fitting.params.IFitResults; 
    4040 
    4141import java.util.List; 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/engine/ThreadedFittingEngine.java

    r7811 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.engine; 
     35package loci.slim.fitting.engine; 
    3636 
    37 import imagej.slim.fitting.params.ILocalFitParams; 
    38 import imagej.slim.fitting.params.IGlobalFitParams; 
    39 import imagej.slim.fitting.params.IFitResults; 
    40 import imagej.slim.fitting.callable.IFittingEngineCallable; 
    41 import imagej.slim.fitting.config.Configuration; 
     37import loci.slim.fitting.params.ILocalFitParams; 
     38import loci.slim.fitting.params.IGlobalFitParams; 
     39import loci.slim.fitting.params.IFitResults; 
     40import loci.slim.fitting.callable.IFittingEngineCallable; 
     41import loci.slim.fitting.config.Configuration; 
    4242 
    4343import loci.curvefitter.ICurveFitter; 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/images/AbstractBaseColorizedImage.java

    r7887 r7889  
    44 */ 
    55 
    6 package imagej.slim.fitting.images; 
     6package loci.slim.fitting.images; 
    77 
    88import java.awt.event.FocusEvent; 
     
    1616import ij.process.FloatProcessor; 
    1717 
    18 import imagej.slim.histogram.HistogramData; 
    19 import imagej.slim.histogram.HistogramDataChannel; 
    20 import imagej.slim.histogram.HistogramTool; 
    21 import imagej.slim.histogram.PaletteFix; 
     18import loci.slim.histogram.HistogramData; 
     19import loci.slim.histogram.HistogramDataChannel; 
     20import loci.slim.histogram.HistogramTool; 
     21import loci.slim.histogram.PaletteFix; 
    2222 
    2323import loci.slim.MyStackWindow; 
     
    8080        _stackWindow.addFocusListener(new FocusListener() { 
    8181            public void focusGained(FocusEvent e) { 
     82                int channelIndex = _stackWindow.getSlice() - 1; 
     83                _histogramData.setChannelIndex(channelIndex); 
     84                System.out.println("focusGained channel " + channelIndex); 
    8285                HistogramTool.getInstance().setHistogramData(_histogramData); 
    8386            } 
     
    143146    public void recalcHistogram() { 
    144147        double[] minMaxLUT = _histogramData.recalcHistogram(); 
     148         
     149        System.out.println("RecalcHistogram to " + minMaxLUT[0] + " " + minMaxLUT[1]); 
    145150 
    146151        if (null != minMaxLUT) { 
     
    181186        int y       = location[1]; 
    182187        int channel = location[2]; 
    183         System.out.println("updatePixel(" + x + " " + y + " " + channel + " prev channel is " + _channel); 
     188        //System.out.println("updatePixel(" + x + " " + y + " " + channel + " prev channel is " + _channel); 
    184189         
    185190        if (_channel != channel) { 
     
    188193            _values = _histogramDataChannels[channel].getValues(); 
    189194             
    190             System.out.println("values is " + _values + " " + _values.hashCode()); 
     195            //System.out.println("values is " + _values + " " + _values.hashCode()); 
    191196             
    192197            _imageProcessor = (FloatProcessor) _imageStack.getProcessor(channel + 1); 
    193             System.out.println("ImageProc for " + channel + " is " + _imageProcessor.toString() + " hash " + _imageProcessor.hashCode()); 
     198            //System.out.println("ImageProc for " + channel + " is " + _imageProcessor.toString() + " hash " + _imageProcessor.hashCode()); 
    194199        } 
    195200         
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/images/ColorizedImage.java

    r7887 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.fitting.images; 
     5package loci.slim.fitting.images; 
    66 
    77import java.awt.image.IndexColorModel; 
    88 
    9 import imagej.slim.fitting.images.AbstractBaseColorizedImage; 
     9import loci.slim.fitting.images.AbstractBaseColorizedImage; 
    1010 
    1111/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/images/ColorizedImageFactory.java

    r7887 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.fitting.images; 
     5package loci.slim.fitting.images; 
    66 
    77import java.awt.image.IndexColorModel; 
    88 
    9 import imagej.slim.fitting.images.IColorizedImage; 
    10 import imagej.slim.fitting.images.ColorizedImage; 
    11 import imagej.slim.fitting.images.FractionalIntensityImage; 
    12 import imagej.slim.fitting.images.FractionalContributionImage; 
    13 import imagej.slim.fitting.images.ColorizedImageFitter.ColorizedImageType; 
     9import loci.slim.fitting.images.IColorizedImage; 
     10import loci.slim.fitting.images.ColorizedImage; 
     11import loci.slim.fitting.images.FractionalIntensityImage; 
     12import loci.slim.fitting.images.FractionalContributionImage; 
     13import loci.slim.fitting.images.ColorizedImageFitter.ColorizedImageType; 
    1414 
    1515/** 
     
    7070                break; 
    7171            case CHISQ: 
    72                 fittedImage = new ColorizedImage("ChiSquare", dimension, 
     72                fittedImage = new ColorizedImage("X2", dimension, 
    7373                        indexColorModel, ColorizedImageFitter.CHISQ_INDEX); 
    7474                break; 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/images/ColorizedImageFitter.java

    r7887 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.fitting.images; 
     5package loci.slim.fitting.images; 
    66 
    77import java.awt.image.IndexColorModel; 
     
    99import java.util.List; 
    1010 
    11 import imagej.slim.histogram.HistogramTool; 
     11import loci.slim.histogram.HistogramTool; 
    1212 
    1313/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/images/ColorizedImageParser.java

    r7865 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.fitting.images; 
     5package loci.slim.fitting.images; 
    66 
    7 import imagej.slim.fitting.images.ColorizedImageFitter.ColorizedImageType; 
     7import loci.slim.fitting.images.ColorizedImageFitter.ColorizedImageType; 
    88 
    99import java.util.ArrayList; 
     
    2222    private static final String TAU_STRING = "" + TAU; 
    2323    private static final String CHI_SQ_STRING = "" + CHI + SQUARE; 
     24    private static final int Z_INDEX = 0; 
     25    private static final int A1_INDEX = 1; 
     26    private static final int T1_INDEX = 2; 
     27    private static final int A2_INDEX = 3; 
     28    private static final int H_INDEX = 3; 
     29    private static final int T2_INDEX = 4; 
     30    private static final int A3_INDEX = 5; 
     31    private static final int T3_INDEX = 6; 
     32    private static final int MAX_INDEX = 6; 
    2433    private String _input; 
    2534    private int _components; 
    2635    private boolean _stretched; 
     36    private boolean[] _free; 
    2737 
    2838    /** 
    2939     * Creates an instance for a given input string, etc. 
    3040     *  
    31      * @param input 
    32      * @param components 
    33      * @param stretched  
     41     * @param input string with colorized images to produce 
     42     * @param components number of exponential fit components 
     43     * @param stretched whether it's a stretched exponential 
     44     * @param free whether each parameter is free or fixed 
    3445     */ 
    35     public ColorizedImageParser(String input, int components, boolean stretched) { 
     46    public ColorizedImageParser(String input, int components, boolean stretched, 
     47            boolean[] free) { 
    3648        _input = input; 
    3749        _components = components; 
    3850        _stretched = stretched; 
     51        if (null == free) { 
     52            _free = new boolean[MAX_INDEX + 1]; 
     53            for (int i = 0; i < _free.length; ++i) { 
     54                _free[i] = true; 
     55            } 
     56        } 
     57        else { 
     58            _free = free; 
     59        } 
    3960    } 
    4061 
     
    5374                switch (_components) { 
    5475                    case 1: 
    55                         list.add(ColorizedImageType.A1); 
     76                        if (_free[A1_INDEX]) { 
     77                            list.add(ColorizedImageType.A1); 
     78                        } 
    5679                        break; 
    5780                    case 2: 
    58                         list.add(ColorizedImageType.A1); 
    59                         list.add(ColorizedImageType.A2); 
     81                        if (_free[A1_INDEX]) { 
     82                            list.add(ColorizedImageType.A1); 
     83                        } 
     84                        if (_free[A2_INDEX]) { 
     85                            list.add(ColorizedImageType.A2); 
     86                        } 
    6087                        break; 
    6188                    case 3: 
    62                         list.add(ColorizedImageType.A1); 
    63                         list.add(ColorizedImageType.A2); 
    64                         list.add(ColorizedImageType.A3); 
     89                        if (_free[A1_INDEX]) { 
     90                            list.add(ColorizedImageType.A1); 
     91                        } 
     92                        if (_free[A2_INDEX]) { 
     93                            list.add(ColorizedImageType.A2); 
     94                        } 
     95                        if (_free[A3_INDEX]) { 
     96                            list.add(ColorizedImageType.A3); 
     97                        } 
    6598                        break; 
    6699               } 
     
    69102                switch (_components) { 
    70103                    case 1: 
    71                         list.add(ColorizedImageType.T1); 
     104                        if (_free[T1_INDEX]) { 
     105                            list.add(ColorizedImageType.T1); 
     106                        } 
    72107                        break; 
    73108                    case 2: 
    74                         list.add(ColorizedImageType.T1); 
    75                         list.add(ColorizedImageType.T2); 
     109                        if (_free[T1_INDEX]) { 
     110                            list.add(ColorizedImageType.T1); 
     111                        } 
     112                        if (_free[T2_INDEX]) { 
     113                            list.add(ColorizedImageType.T2); 
     114                        } 
    76115                        break; 
    77116                    case 3: 
    78                         list.add(ColorizedImageType.T1); 
    79                         list.add(ColorizedImageType.T2); 
    80                         list.add(ColorizedImageType.T3); 
     117                        if (_free[T1_INDEX]) { 
     118                            list.add(ColorizedImageType.T1); 
     119                        } 
     120                        if (_free[T2_INDEX]) { 
     121                            list.add(ColorizedImageType.T2); 
     122                        } 
     123                        if (_free[T3_INDEX]) { 
     124                            list.add(ColorizedImageType.T3); 
     125                        } 
    81126                        break; 
    82127               } 
    83128            } 
    84129            else if ("Z".equals(token)) { 
    85                 list.add(ColorizedImageType.Z); 
     130                if (_free[Z_INDEX]) { 
     131                    list.add(ColorizedImageType.Z); 
     132                } 
    86133            } 
    87134            else if ("X2".equals(token) || CHI_SQ_STRING.equals(token)) { 
     
    90137            else if ("H".equals(token)) { 
    91138                if (_stretched) { 
    92                     list.add(ColorizedImageType.H); 
     139                    if (_free[H_INDEX]) { 
     140                        list.add(ColorizedImageType.H); 
     141                    } 
    93142                } 
    94143            } 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/images/FractionalContributionImage.java

    r7887 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.fitting.images; 
     5package loci.slim.fitting.images; 
    66 
    77import java.awt.image.IndexColorModel; 
    88 
    9 import imagej.slim.fitting.images.AbstractBaseColorizedImage; 
     9import loci.slim.fitting.images.AbstractBaseColorizedImage; 
    1010 
    1111/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/images/FractionalIntensityImage.java

    r7887 r7889  
    33 * and open the template in the editor. 
    44 */ 
    5 package imagej.slim.fitting.images; 
     5package loci.slim.fitting.images; 
    66 
    77import java.awt.image.IndexColorModel; 
    88 
    9 import imagej.slim.fitting.images.AbstractBaseColorizedImage; 
     9import loci.slim.fitting.images.AbstractBaseColorizedImage; 
    1010 
    1111/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/images/IColorizedImage.java

    r7865 r7889  
    44 */ 
    55 
    6 package imagej.slim.fitting.images; 
     6package loci.slim.fitting.images; 
    77 
    88import java.awt.image.IndexColorModel; 
    99 
    10 import imagej.slim.histogram.HistogramData; 
     10import loci.slim.histogram.HistogramData; 
    1111 
    1212/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/params/FitResults.java

    r7811 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.params; 
     35package loci.slim.fitting.params; 
    3636 
    3737/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/params/GlobalFitParams.java

    r7862 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.params; 
     35package loci.slim.fitting.params; 
    3636 
    3737import loci.curvefitter.ICurveFitter.FitAlgorithm; 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/params/IFitResults.java

    r7811 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.params; 
     35package loci.slim.fitting.params; 
    3636 
    3737/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/params/IGlobalFitParams.java

    r7862 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.params; 
     35package loci.slim.fitting.params; 
    3636 
    3737import loci.curvefitter.ICurveFitter.FitAlgorithm; 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/params/ILocalFitParams.java

    r7811 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.params; 
     35package loci.slim.fitting.params; 
    3636 
    3737/** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/fitting/params/LocalFitParams.java

    r7811 r7889  
    3333*/ 
    3434 
    35 package imagej.slim.fitting.params; 
     35package loci.slim.fitting.params; 
    3636 
    3737/** 
Note: See TracChangeset for help on using the changeset viewer.