 Timestamp:
 11/22/10 13:09:36 (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/maven/projects/slimplugin/src/main/java/loci/slim/analysis/plugins/Display.java
r7217 r7232 36 36 37 37 import ij.ImagePlus; 38 import ij.gui.GenericDialog; 38 39 import ij.gui.MessageDialog; 39 40 import ij.process.ColorProcessor; … … 43 44 import java.math.MathContext; 44 45 import java.math.RoundingMode; 46 47 import java.util.HashMap; 48 import java.util.Map; 45 49 46 50 import loci.slim.SLIMProcessor.FitFunction; … … 63 67 @SLIMAnalyzer(name="Display Fit Results") 64 68 public class Display implements ISLIMAnalyzer { 65 private static final Character TAU = 'T'; //TODO IJ doesn't handleUnicode, was: = '\u03c4';69 private static final Character TAU = 'T'; //TODO IJ1 doesn't display Unicode, was: = '\u03c4'; 66 70 private static final String T = "" + TAU; 67 71 private static final String T1 = "" + TAU + '1'; … … 101 105 * This table is very specifically tied to the order of parameter indices. 102 106 */ 107 //TODO need Ta, Ti, Tm 103 108 private static enum Formula { 104 109 T_FORMULA(T, 2), … … 185 190 */ 186 191 public void analyze(Image<DoubleType> image, FitRegion region, FitFunction function) { 187 boolean combineMinMax = false; //TODO needs to be set from UI. 192 // Used to build optional lists of formulas 193 Map<String, Formula[]> formulasMap = null; 194 boolean combineMinMax = false; 188 195 189 196 // is this plugin appropriate for current data? … … 209 216 int params = dimensions[pIndex]; 210 217 211 // get appropriate formula for image dimensions218 // allow user to select formula to display 212 219 Formula formulas[] = null; 213 switch (function) { 214 case SINGLE_EXPONENTIAL: 215 formulas = new Formula[] { Formula.A_FORMULA, Formula.T_FORMULA, Formula.C_FORMULA }; //TODO these three formulas are just for testing. 216 break; 217 case DOUBLE_EXPONENTIAL: 218 formulas = new Formula[] { Formula.A1_A2_FORMULA, Formula.T1_T2_FORMULA }; 219 break; 220 case TRIPLE_EXPONENTIAL: 221 formulas = new Formula[] { Formula.T1_T2_FORMULA, Formula.T1_T3_FORMULA }; 222 break; 223 case STRETCHED_EXPONENTIAL: 224 break; 220 if (null == formulasMap) { 221 formulasMap = initFormulasMap(function); 222 } 223 GenericDialog dialog = new GenericDialog("Display Formula"); 224 String choices[] = formulasMap.keySet().toArray(new String[0]); 225 dialog.addChoice("Show", choices, choices[0]); 226 if (channels > 1) { 227 dialog.addCheckbox("Use common range for all channels", true); 228 } 229 dialog.showDialog(); 230 formulas = formulasMap.get(dialog.getNextChoice()); 231 if (channels > 1) { 232 combineMinMax = dialog.getNextBoolean(); 225 233 } 226 234 … … 344 352 } 345 353 354 /** 355 * Builds lists of formulas and associated descriptions that are appropriate 356 * to a given fit function. 357 * 358 * @param function 359 * @return 360 */ 361 private Map<String, Formula[]> initFormulasMap(FitFunction function) { 362 Map<String, Formula[]> map = new HashMap<String, Formula[]>(); 363 switch (function) { 364 case SINGLE_EXPONENTIAL: 365 map.put("T", new Formula[] { Formula.T_FORMULA }); 366 map.put("A T", new Formula[] { Formula.A_FORMULA, Formula.T_FORMULA }); 367 map.put("A T C", new Formula[] { Formula.A_FORMULA, Formula.T_FORMULA, Formula.C_FORMULA }); 368 break; 369 case DOUBLE_EXPONENTIAL: 370 map.put("T1/T2", new Formula[] { Formula.T1_T2_FORMULA }); 371 map.put("A1/A2 T1/T2", new Formula[] { Formula.A1_A2_FORMULA, Formula.T1_T2_FORMULA }); 372 map.put("T1 T2", new Formula[] { Formula.T1_FORMULA, Formula.T2_FORMULA }); 373 map.put("A1 A2 T1 T2", new Formula[] { Formula.A1_FORMULA, Formula.A2_FORMULA, Formula.T1_FORMULA, Formula.T2_FORMULA }); 374 map.put("A1 A2 T1 T2 C", new Formula[] { Formula.A1_FORMULA, Formula.A2_FORMULA, Formula.T1_FORMULA, Formula.T2_FORMULA, Formula.C_FORMULA }); 375 break; 376 case TRIPLE_EXPONENTIAL: 377 map.put("T1/T2 T1/T3", new Formula[] { Formula.T1_T2_FORMULA, Formula.T1_T3_FORMULA }); 378 map.put("A1/A2 A1/A3 T1/T2 T1/T3", new Formula[] { Formula.A1_A2_FORMULA, Formula.A1_A3_FORMULA, Formula.T1_T2_FORMULA, Formula.T1_T3_FORMULA }); 379 map.put("T1 T2 T3", new Formula[] { Formula.T1_FORMULA, Formula.T2_FORMULA, Formula.T3_FORMULA }); 380 map.put("A1 A2 A3 T1 T2 T3", new Formula[] { Formula.A1_FORMULA, Formula.A2_FORMULA, Formula.A3_FORMULA, Formula.T1_FORMULA, Formula.T2_FORMULA, Formula.T3_FORMULA }); 381 map.put("A1 A2 A3 T1 T2 T3 C", new Formula[] { Formula.A1_FORMULA, Formula.A2_FORMULA, Formula.A3_FORMULA, Formula.T1_FORMULA, Formula.T2_FORMULA, Formula.T3_FORMULA, Formula.C_FORMULA }); 382 break; 383 case STRETCHED_EXPONENTIAL: 384 break; 385 } 386 return map; 387 } 388 389 /** 390 * Initializes minimum and maximum value arrays. 391 * 392 * @param minValue 393 * @param maxValue 394 */ 346 395 private void initMinMax(double minValue[], double maxValue[]) { 347 396 for (int i = 0; i < minValue.length; ++i) {
Note: See TracChangeset
for help on using the changeset viewer.