Changeset 7839


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

UI Changes

Location:
trunk/projects/slim-plugin/src/main/java
Files:
5 edited

Legend:

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

    r7830 r7839  
    2626    public IFittedImage createImage(OutputImage outputImage, int[] dimension, int components) { 
    2727        IFittedImage fittedImage = null; 
     28        String title; 
    2829        switch (outputImage) { 
    2930            case A1: 
    30                 fittedImage = new FittedImage("A1", dimension, FLIMImageFitter.A1_INDEX); 
     31                title = (1 == components) ? "A" : "A1"; 
     32                fittedImage = new FittedImage(title, dimension, FLIMImageFitter.A1_INDEX); 
    3133                break; 
    3234            case T1: 
    33                 fittedImage = new FittedImage("T1", dimension, FLIMImageFitter.T1_INDEX); 
     35                title = (1 == components) ? "T" : "T1"; 
     36                fittedImage = new FittedImage(title, dimension, FLIMImageFitter.T1_INDEX); 
    3437                break; 
    3538            case A2: 
  • trunk/projects/slim-plugin/src/main/java/imagej/slim/fitting/FLIMImageFitter.java

    r7833 r7839  
    1717 */ 
    1818public class FLIMImageFitter { 
    19     public enum OutputImage { A1, T1, A2, T2, A3, T3, H, Z, CHISQ, F1, F2, F3, f1, f2, f3 }; 
     19    public enum OutputImage { A1, T1, A2, T2, A3, T3, Z, H, CHISQ, F1, F2, F3, f1, f2, f3 }; 
    2020    public static final int A1_INDEX    = 2; 
    2121    public static final int T1_INDEX    = 3; 
     
    4545        // Show histogram tool for the last image created 
    4646        int lastIndex = images.length - 1; 
    47         HistogramTool.getInstance().setHistogramData(_fittedImages.get(lastIndex).getHistogramData()); 
     47        if (lastIndex >= 0) { 
     48            HistogramTool.getInstance().setHistogramData(_fittedImages.get(lastIndex).getHistogramData()); 
     49        } 
    4850    } 
    4951     
  • trunk/projects/slim-plugin/src/main/java/loci/slim/SLIMProcessor.java

    r7832 r7839  
    8585 
    8686// Kludge in the new stuff: 
     87import imagej.slim.fitting.OutputImageParser; 
    8788import imagej.slim.fitting.params.IGlobalFitParams; 
    8889import imagej.slim.fitting.params.LocalFitParams; 
     
    10091010        //TODO new style code starts only here: 
    10101011        FLIMImageFitter imageFitter = new FLIMImageFitter(); 
    1011         OutputImage[] outputImages = { OutputImage.A1, OutputImage.T1, OutputImage.CHISQ }; 
     1012        int components = 1; 
     1013        boolean stretched = false; 
     1014        switch (uiPanel.getFunction()) { 
     1015            case SINGLE_EXPONENTIAL: 
     1016                break; 
     1017            case DOUBLE_EXPONENTIAL: 
     1018                components = 2; 
     1019                break; 
     1020            case TRIPLE_EXPONENTIAL: 
     1021                components = 3; 
     1022                break; 
     1023            case STRETCHED_EXPONENTIAL: 
     1024                stretched = true; 
     1025                break; 
     1026        } 
     1027        String outputs = uiPanel.getImages(); 
     1028        OutputImageParser parser = new OutputImageParser(outputs, components, stretched); 
     1029         
     1030        OutputImage[] outputImages = parser.getOutputImages(); 
    10121031        imageFitter.setUpFit(outputImages, new int[] { m_width, m_height }, 1); 
    10131032        imageFitter.beginFit();        
     
    17991818                curveFitter = new JaolhoCurveFitter(); 
    18001819                break; 
    1801            /* case AKUTAN: 
    1802                 curveFitter = new AkutanCurveFitter(); 
    1803                 break; */ 
    1804             case BARBER_RLD: 
    1805                 curveFitter = new GrayCurveFitter(); 
    1806                 curveFitter.setFitAlgorithm(ICurveFitter.FitAlgorithm.RLD); 
    1807                 break; 
    1808             case BARBER_LMA: 
    1809                 curveFitter = new GrayCurveFitter(); 
    1810                 curveFitter.setFitAlgorithm(ICurveFitter.FitAlgorithm.LMA); 
    1811                 break; 
    1812             case MARKWARDT: 
    1813                 curveFitter = new MarkwardtCurveFitter(); 
    1814                 break; 
    1815             case BARBER2_RLD: 
    1816                 curveFitter = new GrayNRCurveFitter(); 
    1817                 curveFitter.setFitAlgorithm(ICurveFitter.FitAlgorithm.RLD);         
    1818                 break; 
    1819             case BARBER2_LMA: 
    1820                 curveFitter = new GrayNRCurveFitter(); 
    1821                 curveFitter.setFitAlgorithm(ICurveFitter.FitAlgorithm.RLD); 
    1822                 break; 
    18231820            case SLIMCURVE_RLD: 
    18241821                curveFitter = new SLIMCurveFitter(); 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/ui/IUserInterfacePanel.java

    r7838 r7839  
    5151    } 
    5252 
    53     public static enum FitAlgorithm { //TODO not really algorithm, usu. LMA 
    54        JAOLHO, /*AKUTAN,*/ BARBER_RLD, BARBER_LMA, MARKWARDT, BARBER2_RLD, BARBER2_LMA, SLIMCURVE_RLD, SLIMCURVE_LMA, SLIMCURVE_RLD_LMA 
     53    public static enum FitAlgorithm { 
     54       JAOLHO, SLIMCURVE_RLD, SLIMCURVE_LMA, SLIMCURVE_RLD_LMA 
    5555    } 
    5656 
     
    6060 
    6161    public static enum NoiseModel { 
    62         POISSON 
     62        GAUSSIAN_FIT, POISSON_FIT, POISSON_DATA, MAXIMUM_LIKELIHOOD 
    6363    } 
    6464 
     
    114114     * @return 
    115115     */ 
    116     public String[] getImages(); 
     116    public String getImages(); 
    117117 
    118118    /** 
  • trunk/projects/slim-plugin/src/main/java/loci/slim/ui/UserInterfacePanel.java

    r7838 r7839  
    9090    private static final String ALL_REGION = "Each Pixel"; 
    9191     
    92     private static final String GRAY_RLD_ALGORITHM = "Gray NR RLD"; 
    93     private static final String GRAY_LMA_ALGORITHM = "Gray NR LMA"; 
    9492    private static final String JAOLHO_LMA_ALGORITHM = "Jaolho LMA"; 
    9593    private static final String SLIM_CURVE_RLD_ALGORITHM = "SLIMCurve RLD"; 
     
    102100    private static final String STRETCHED_EXPONENTIAL = "Stretched Exponential"; 
    103101 
    104     private static final String GAUSSIAN = "Gaussian"; 
    105     private static final String POISSON = "Poisson"; 
     102    private static final String GAUSSIAN_FIT = "Gaussian Fit"; 
     103    private static final String POISSON_FIT = "Poisson Fit"; 
     104    private static final String POISSON_DATA = "Poisson Data"; 
    106105    private static final String MAXIMUM_LIKELIHOOD = "Maximum Likelihood"; 
    107106 
    108     private static final String A_T_Z_X2 = "A " + TAU + " Z " + CHI + SQUARE; 
    109     private static final String A_T_X2 = "A " + TAU + " " + CHI +  SQUARE; 
    110     private static final String A_T = "A " + TAU; 
    111     private static final String T_X2 = TAU + " " + CHI + SQUARE; 
    112     private static final String T = TAU + ""; 
     107    private static final String A_T_H_Z_X2 = "A " + TAU + " H Z " + CHI + SQUARE; 
     108    private static final String A_T_H_X2 = "A " + TAU + " H " + CHI +  SQUARE; 
     109    private static final String A_T_H = "A " + TAU + " H"; 
     110    private static final String T_H_X2 = TAU + " H " + CHI + SQUARE; 
     111    private static final String T_H = TAU + " H"; 
     112    private static final String T = "" + TAU; 
    113113    private static final String F_UPPER = "F"; 
    114114    private static final String F_LOWER = "f"; 
     
    127127 
    128128    private static final String REGION_ITEMS[] = { SUM_REGION, ROIS_REGION, PIXEL_REGION, ALL_REGION }; 
    129     private static final String ALGORITHM_ITEMS[] = { JAOLHO_LMA_ALGORITHM, GRAY_RLD_ALGORITHM, GRAY_LMA_ALGORITHM, SLIM_CURVE_RLD_ALGORITHM, SLIM_CURVE_LMA_ALGORITHM, SLIM_CURVE_RLD_LMA_ALGORITHM }; 
     129    private static final String ALGORITHM_ITEMS[] = { JAOLHO_LMA_ALGORITHM, SLIM_CURVE_RLD_ALGORITHM, SLIM_CURVE_LMA_ALGORITHM, SLIM_CURVE_RLD_LMA_ALGORITHM }; 
    130130    private static final String FUNCTION_ITEMS[] = { SINGLE_EXPONENTIAL, DOUBLE_EXPONENTIAL, TRIPLE_EXPONENTIAL, STRETCHED_EXPONENTIAL }; 
    131     private static final String NOISE_MODEL_ITEMS[] = { GAUSSIAN, POISSON, MAXIMUM_LIKELIHOOD }; 
    132     private static final String FITTED_IMAGE_ITEMS[] = { A_T_Z_X2, A_T_X2, A_T, T_X2, T, F_UPPER, F_LOWER }; 
     131    private static final String NOISE_MODEL_ITEMS[] = { GAUSSIAN_FIT, POISSON_FIT, POISSON_DATA, MAXIMUM_LIKELIHOOD }; 
     132    private static final String FITTED_IMAGE_ITEMS[] = { A_T_H_Z_X2, A_T_H_X2, A_T_H, T_H_X2, T_H, T, F_UPPER, F_LOWER }; 
    133133 
    134134    private static final String EXCITATION_ITEMS[] = { EXCITATION_NONE, EXCITATION_FILE, EXCITATION_CREATE }; 
     
    876876        m_algorithmComboBox.setEnabled(enable); 
    877877        m_functionComboBox.setEnabled(enable); 
     878        m_noiseModelComboBox.setEnabled(enable); 
     879        m_fittedImagesComboBox.setEnabled(enable); 
    878880        for (JCheckBox checkBox : m_analysisCheckBoxList) { 
    879881            checkBox.setEnabled(enable); 
     
    888890        m_stopField.setEditable(enable); 
    889891        m_thresholdField.setEditable(enable); 
     892        m_chiSqTargetField.setEditable(enable); 
    890893        m_binningComboBox.setEnabled(enable); 
    891894 
     
    965968            algorithm = FitAlgorithm.JAOLHO; 
    966969        } 
    967         else if (selected.equals(GRAY_RLD_ALGORITHM)) { 
    968             algorithm = FitAlgorithm.BARBER2_RLD; 
    969         } 
    970         else if (selected.equals(GRAY_LMA_ALGORITHM)) { 
    971             algorithm = FitAlgorithm.BARBER2_LMA; 
    972         } 
    973970        else if (selected.equals(SLIM_CURVE_RLD_ALGORITHM)) { 
    974971            algorithm = FitAlgorithm.SLIMCURVE_RLD; 
     
    10171014     */ 
    10181015    public NoiseModel getNoiseModel() { 
    1019         return NoiseModel.POISSON; 
     1016        NoiseModel noiseModel = null; 
     1017        String selected = (String) m_noiseModelComboBox.getSelectedItem(); 
     1018        if (selected.equals(GAUSSIAN_FIT)) { 
     1019            noiseModel = NoiseModel.GAUSSIAN_FIT; 
     1020        } 
     1021        else if (selected.equals(POISSON_FIT)) { 
     1022            noiseModel = NoiseModel.POISSON_FIT; 
     1023        } 
     1024        else if (selected.equals(POISSON_DATA)) { 
     1025            noiseModel = NoiseModel.POISSON_DATA; 
     1026        } 
     1027        else if (selected.equals(MAXIMUM_LIKELIHOOD)) { 
     1028            noiseModel = NoiseModel.MAXIMUM_LIKELIHOOD; 
     1029        } 
     1030        return noiseModel; 
    10201031    } 
    10211032 
     
    10251036     * @return 
    10261037     */ 
    1027     public String[] getImages() { 
    1028         return new String[0]; 
     1038    public String getImages() { 
     1039        String selected = (String) m_fittedImagesComboBox.getSelectedItem(); 
     1040        return selected; 
    10291041    } 
    10301042 
Note: See TracChangeset for help on using the changeset viewer.