Changeset 7671 for trunk/projects/slim-plugin/src
- Timestamp:
- 03/23/11 20:28:55 (9 years ago)
- Location:
- trunk/projects/slim-plugin/src/main/java/loci/slim
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/projects/slim-plugin/src/main/java/loci/slim/CursorHelper.java
r7668 r7671 53 53 public static float[] estimateExcitationCursors(float[] excitation) { 54 54 float baseline; 55 float maxval; 56 int index; 55 57 int startp = 0; 56 58 int endp = 0; 59 int i; 57 60 float[] diffed = new float[excitation.length]; 58 61 int steepp; 59 62 60 63 // "Estimate prompt baseline; very rough and ready" 61 in t index = findMax(excitation);62 floatmaxval = excitation[index];64 index = findMax(excitation); 65 maxval = excitation[index]; 63 66 64 67 if (index > excitation.length * 3 /4) { // "integer arithmetic" … … 68 71 baseline = 0.0f; 69 72 int index2 = (index + excitation.length) / 2; 70 for (i nt i= index2; i < excitation.length; ++i) {73 for (i = index2; i < excitation.length; ++i) { 71 74 baseline += excitation[i]; 72 75 } … … 76 79 // "Where does the prompt first drop to (peak amplitude - baseline) / 10? 77 80 // This could be silly if the baseline is silly; caveat emptor!" 78 for (i nt i= index; i > 0; --i) {81 for (i = index; i > 0; --i) { 79 82 if ((excitation[i] - baseline) < 0.1 * (maxval - baseline)) { 80 startp = i; // "First estimate"81 83 break; 82 84 } 83 85 } 86 startp = i; // "First estimate" 84 87 85 88 // "And first drop away again?" 86 for (i nt i= index; i < excitation.length - 1; ++i) {89 for (i = index; i < excitation.length - 1; ++i) { 87 90 if ((excitation[i] - baseline) < 0.1 * (maxval - baseline)) { 88 endp = i;89 91 break; 90 92 } 91 93 } 94 endp = i; 92 95 93 96 // "Differentiate" 94 for (i nt i= 0; i < index; ++i) {97 for (i = 0; i < index; ++i) { 95 98 diffed[i] = excitation[i + 1] - excitation[i]; 96 99 } … … 119 122 } 120 123 121 public static float[] estimateCursors(float [] prompt, double[] decay) {124 public static float[] estimateCursors(float xInc, float[] prompt, double[] decay) { 122 125 float[] returnValue = new float[5]; 123 126 float baseline; 127 float maxval; // TRCursors.c has "unsigned short maxsval, maxval; float maxfval, *diffed;" 128 int index; 124 129 int startp = 0; 125 130 int startt = 0; 126 131 int endp = 0; 127 132 int endt = 0; 133 int i; 128 134 float[] diffed = new float[prompt.length]; 129 135 int steepp; 130 136 int steept; 137 // "For Marquardt fitting" 138 double param[] = new double[4]; 139 boolean free[] = new boolean[] { true, true, true }; 140 double[] yFitted = new double[decay.length]; 141 double[] chiSqTable = new double[2 * ATTEMPTS + 1]; 142 int transStartIndex; 143 int transFitStartIndex; 144 int transEndIndex; 131 145 132 146 // "Estimate prompt baseline; very rough and ready" 133 in t index = findMax(prompt);134 floatmaxval = prompt[index];147 index = findMax(prompt); 148 maxval = prompt[index]; 135 149 136 150 if (index > prompt.length * 3 /4) { // "integer arithmetic" … … 140 154 baseline = 0.0f; 141 155 int index2 = (index + prompt.length) / 2; 142 for (i nt i= index2; i < prompt.length; ++i) {156 for (i = index2; i < prompt.length; ++i) { 143 157 baseline += prompt[i]; 144 158 } … … 148 162 // "Where does the prompt first drop to (peak amplitude - baseline) / 10? 149 163 // This could be silly if the baseline is silly; caveat emptor!" 150 for (i nt i= index; i > 0; --i) {164 for (i = index; i > 0; --i) { 151 165 if ((prompt[i] - baseline) < 0.1 * (maxval - baseline)) { 152 startp = i; // "First estimate"153 166 break; 154 167 } 155 168 } 169 startp = i; // "First estimate" 156 170 157 171 // "And first drop away again?" 158 for (i nt i= index; i < prompt.length - 1; ++i) {172 for (i = index; i < prompt.length - 1; ++i) { 159 173 if ((prompt[i] - baseline) < 0.1 * (maxval - baseline)) { 160 endp = i;161 174 break; 162 175 } 163 176 } 177 endp = i; 164 178 165 179 // "Differentiate" 166 for (i nt i= 0; i < index; ++i) {180 for (i = 0; i < index; ++i) { 167 181 diffed[i] = prompt[i + 1] - prompt[i]; 168 182 } … … 188 202 189 203 // "Differentiate" 190 double[] diffedd = new double[decay.length]; 191 for (i nt i= 0; i < index; ++i) {204 double[] diffedd = new double[decay.length]; //TODO double vs float issues 205 for (i = 0; i < index; ++i) { 192 206 diffedd[i] = decay[i + 1] - decay[i]; 193 207 } … … 202 216 } 203 217 204 // save estimates205 returnValue[0] = startp;206 returnValue[1] = endp;207 returnValue[2] = baseline;208 returnValue[3] = startt;209 returnValue[4] = endt; //TODO ITS JUST ZERO HERE!!218 // save estimates //TODO not in original 219 returnValue[0] = startp; 220 returnValue[1] = endp; 221 returnValue[2] = baseline; 222 returnValue[3] = startt; 223 returnValue[4] = endt; //TODO ITS JUST ZERO HERE!! 210 224 211 225 // "Now we've got estimates we can do some Marquardt fitting to fine-tune 212 226 // the estimates" 213 227 214 int gTransStartIndex = startt - ATTEMPTS;215 if ( gTransStartIndex < 0) {216 gTransStartIndex = 0;217 } 218 int gTransEndIndex = 9 * decay.length / 10; // "90% of transient"219 if ( gTransEndIndex <= gTransStartIndex + 2 * ATTEMPTS) { // "oops"220 return returnValue;221 }222 223 double[] param = new double[3]; 224 boolean[] free = new boolean[] { true, true, true };225 double[] yFitted = new double[decay.length]; 226 double[] chiSqTable = new double[2 * ATTEMPTS + 1];227 for (int i = 0; i < 2 * ATTEMPTS + 1; ++i, ++gTransStartIndex) { 228 int fit _start = 0; // gTransFitStartIndex - gTransStartIndex;229 int fit _end = gTransEndIndex - gTransStartIndex;230 231 //int gTransFitStartIndex = gTransStartIndex;228 transStartIndex = startt - ATTEMPTS; 229 if (transStartIndex < 0) { 230 transStartIndex = 0; 231 } 232 transEndIndex = 9 * decay.length / 10; // "90% of transient" 233 if (transEndIndex <= transStartIndex + 2 * ATTEMPTS) { // "oops" 234 System.out.println("oops return"); 235 return returnValue; //TODO "do_estimate_resets; do_estimate_frees; " 236 } 237 238 for (i = 0; i < 2 * ATTEMPTS + 1; ++i, ++transStartIndex) { 239 240 transFitStartIndex = transStartIndex; 241 242 int fitStart = transFitStartIndex - transStartIndex; 243 int fitStop = transEndIndex - transStartIndex; 244 int nData = transEndIndex - transStartIndex; 245 System.out.println("fitStart " + fitStart + " fitStop " + fitStop + " nData " + nData); 232 246 233 247 CurveFitData curveFitData = new CurveFitData(); 234 curveFitData.setParams(param); 235 curveFitData.setFree(free); 248 curveFitData.setParams(param); //TODO param has random values!! 236 249 curveFitData.setYCount(decay); 237 250 curveFitData.setSig(null); … … 240 253 241 254 SLIMCurveFitter curveFitter = new SLIMCurveFitter(SLIMCurveFitter.AlgorithmType.RLD_LMA); 242 int ret = 0; //curveFitter.fitData(data, fitStart, fitStop); 255 curveFitter.setXInc(xInc); 256 curveFitter.setFree(free); 257 258 int ret = curveFitter.fitData(data, fitStart, fitStop); 243 259 244 260 if (ret >= 0) { 245 //System.out.println("for start " + fitStart + " stop " + fitStop + " chiSq is " + data[0].getChiSquare());261 System.out.println("for start " + fitStart + " stop " + fitStop + " chiSq is " + data[0].getChiSquare()); 246 262 chiSqTable[i] = data[0].getChiSquare(); 247 263 } 248 264 else { 265 System.out.println("ret from fitData is " + ret); 249 266 chiSqTable[i] = 1e10f; // "silly value" 250 267 } … … 253 270 // "Find the minimum chisq in this range" 254 271 index = findMin(chiSqTable, 2 * ATTEMPTS + 1); 255 if (chiSqTable[index] > 9e9f) { 272 if (chiSqTable[index] > 9e9f) { // "no luck here..." 273 System.out.println("no luck here return"); 274 for (double chiSq : chiSqTable) { 275 System.out.println("chiSq is " + chiSq); 276 } 277 System.out.println("index is " + index); 256 278 return null; //TODO do estimate resets/frees??? 257 279 } 280 281 // "Then we're rolling!" 282 transStartIndex = startt - ATTEMPTS; 283 if (transStartIndex < 0) { 284 transStartIndex = 0; 285 } 286 transStartIndex += index; 287 transFitStartIndex = transStartIndex + (transEndIndex - transStartIndex) / 20; 258 288 259 289 returnValue[0] = startp; 260 290 returnValue[1] = endp; 261 291 returnValue[2] = baseline; 262 returnValue[3] = startt; 263 returnValue[4] = endt; //TODO it's still zero!! 292 returnValue[3] = transStartIndex; 293 returnValue[4] = transFitStartIndex; 294 returnValue[5] = transEndIndex; 264 295 return returnValue; 265 296 } -
trunk/projects/slim-plugin/src/main/java/loci/slim/DecayGraph.java
r7668 r7671 214 214 decayRenderer.setSeriesPaint(0, Color.green); 215 215 decayRenderer.setSeriesPaint(1, Color.red); 216 decayRenderer.setSeriesPaint(2, Color. blue);216 decayRenderer.setSeriesPaint(2, Color.darkGray); 217 217 218 218 m_decaySubPlot = new XYPlot(m_decayDataset, null, photonAxis, decayRenderer); -
trunk/projects/slim-plugin/src/main/java/loci/slim/Excitation.java
r7668 r7671 36 36 37 37 /** 38 * TODO 39 * 40 * <dl><dt><b>Source code:</b></dt> 41 * <dd><a href="http://dev.loci.wisc.edu/trac/software/browser/trunk/projects/slim-plugin/src/main/java/loci/slim/Excitation.java">Trac</a>, 42 * <a href="http://dev.loci.wisc.edu/svn/software/trunk/projects/slim-plugin/src/main/java/loci/slim/Excitation.java">SVN</a></dd></dl> 38 * This class is a container for values for the instrument response function, 39 * aka excitation, aka prompt, aka lamp function. 43 40 * 44 41 * @author Aivar Grislis … … 51 48 private float m_base; 52 49 50 /** 51 * Creates an excitation with given filename and values. 52 * 53 * @param fileName 54 * @param values 55 */ 53 56 public Excitation(String fileName, float[] values) { 54 57 m_fileName = fileName; 55 58 m_values = values; 56 float[] cursors = CursorHelper.estimateExcitationCursors(values);57 System.out.println("start " + cursors[0] + " stop " + cursors[1] + " base " + cursors[2]);58 m_start = (int) cursors[0];59 m_stop = (int) cursors[1];60 m_base = cursors[2];61 59 } 62 60 61 /** 62 * Gets the file name. 63 * 64 * @return 65 */ 63 66 public String getFileName() { 64 67 return m_fileName; 65 68 } 66 69 70 /** 71 * Gets the values of the excitation curve. 72 * 73 * @return 74 */ 67 75 public float[] getValues() { 68 76 return m_values; 69 77 } 70 78 79 /** 80 * Sets start cursor. 81 * 82 * @param start 83 */ 84 public void setStart(int start) { 85 m_start = start; 86 } 87 88 /** 89 * Gets start cursor. 90 * 91 * @return 92 */ 71 93 public int getStart() { 72 94 return m_start; 73 95 } 74 96 97 /** 98 * Sets the stop cursor. 99 * 100 * @param stop 101 */ 102 public void setStop(int stop) { 103 m_stop = stop; 104 } 105 106 /** 107 * Gets the stop cursor. 108 * 109 * @return 110 */ 75 111 public int getStop() { 76 112 return m_stop; 77 113 } 78 114 115 /** 116 * Sets the base cursor. 117 * 118 * @param base 119 */ 120 public void setBase(float base) { 121 m_base = base; 122 } 123 124 /** 125 * Gets the base cursor. 126 * 127 * @return 128 */ 79 129 public float getBase() { 80 130 return m_base; -
trunk/projects/slim-plugin/src/main/java/loci/slim/ExcitationFileHandler.java
r7668 r7671 118 118 try { 119 119 icsReader.setId(fileName); 120 System.out.println(" is single file " + icsReader.isSingleFile(fileName));120 //System.out.println(" is single file " + icsReader.isSingleFile(fileName)); 121 121 String domains[] = icsReader.getDomains(); 122 122 int lengths[] = icsReader.getChannelDimLengths(); 123 System.out.print("lengths");124 for (int i : lengths) {125 System.out.print(" " + i);126 }127 System.out.println();123 //System.out.print("lengths"); 124 //for (int i : lengths) { 125 // System.out.print(" " + i); 126 //} 127 //System.out.println(); 128 128 String types[] = icsReader.getChannelDimTypes(); 129 129 int sizeX = icsReader.getSizeX(); … … 137 137 int effSizeC = icsReader.getEffectiveSizeC(); 138 138 boolean littleEndian = icsReader.isLittleEndian(); 139 System.out.println("size X Y Z T C " + sizeX + " " + sizeY + " " + sizeZ + " " + sizeT + " " + sizeC + " ");140 System.out.println("bpp " + bpp + " dim order " + dimOrder + " pixelTYpe + " + pixelType + " effsizec " + effSizeC + " littleendian " + littleEndian);139 //System.out.println("size X Y Z T C " + sizeX + " " + sizeY + " " + sizeZ + " " + sizeT + " " + sizeC + " "); 140 //System.out.println("bpp " + bpp + " dim order " + dimOrder + " pixelTYpe + " + pixelType + " effsizec " + effSizeC + " littleendian " + littleEndian); 141 141 142 142 System.out.println(icsReader.getFormat()); … … 146 146 for (int bin = 0; bin < bins; ++bin) { 147 147 bytes = icsReader.openBytes(bin); 148 for (byte b : bytes) {149 System.out.print(" " + b);150 }151 System.out.println();148 //for (byte b : bytes) { 149 // System.out.print(" " + b); 150 //} 151 //System.out.println(); 152 152 results[bin] = convertBytesToFloat(bytes); 153 153 } -
trunk/projects/slim-plugin/src/main/java/loci/slim/SLIMProcessor.java
r7668 r7671 67 67 import loci.slim.binning.SLIMBinning; 68 68 import loci.slim.colorizer.DataColorizer; 69 import loci.slim.ui.ExcitationPanel; 69 70 import loci.slim.ui.IStartStopListener; 70 71 import loci.slim.ui.IUserInterfacePanel; … … 131 132 private volatile boolean m_fitted; 132 133 133 //TODO total kludge; just to get started134 private boolean m_fakeData = false;135 136 134 private static final String FILE_KEY = "file"; 137 135 private String m_file; … … 173 171 private SLIMBinning m_binning; 174 172 173 private ExcitationPanel m_excitationPanel = null; 175 174 private IGrayScaleImage m_grayScaleImage; 176 175 // user sets these from the grayScalePanel … … 222 221 boolean success = false; 223 222 if (showFileDialog(getFileFromPreferences())) { 224 if (m_fakeData) { 225 fakeData(); 223 m_image = loadImage(m_file); 224 if (getImageInfo(m_image)) { 225 saveFileInPreferences(m_file); 226 226 success = true; 227 }228 else {229 m_image = loadImage(m_file);230 if (getImageInfo(m_image)) {231 saveFileInPreferences(m_file);232 success = true;233 }234 227 } 235 228 } … … 265 258 uiPanel.setListener( 266 259 new IUserInterfacePanelListener() { 260 /** 261 * Triggers a fit. 262 */ 267 263 public void doFit() { 268 264 m_cancel = false; … … 270 266 } 271 267 268 /** 269 * Cancels ongoing fit. 270 */ 272 271 public void cancelFit() { 273 272 m_cancel = true; 274 273 } 275 274 /** 275 * Quits running plugin. 276 */ 276 277 public void quit() { 277 278 m_quit = true; 278 279 } 279 280 281 /** 282 * Loads an excitation curve from file. 283 * 284 * @param fileName 285 * @return whether successful 286 */ 287 public boolean loadExcitation(String fileName) { 288 Excitation excitation = ExcitationFileHandler.getInstance().loadExcitation(fileName); 289 return updateExcitation(uiPanel, excitation); 290 } 291 292 /** 293 * Creates an excitation curve from currrent X, Y and saves to file. 294 * 295 * @param fileName 296 * @return whether successful 297 */ 298 public boolean createExcitation(String fileName) { 299 int channel = m_grayScaleImage.getChannel(); 300 int x = uiPanel.getX(); 301 int y = uiPanel.getY(); 302 float[] values = new float[m_timeBins]; 303 for (int b = 0; b < m_timeBins; ++b) { 304 values[b] = (float) getData(m_cursor, channel, x, y, b); 305 } 306 Excitation excitation = ExcitationFileHandler.getInstance().createExcitation(fileName, values); 307 return updateExcitation(uiPanel, excitation); 308 } 309 310 /** 311 * Cancels the current excitation curve, if any. 312 * 313 */ 314 public void cancelExcitation() { 315 if (null != m_excitationPanel) { 316 m_excitationPanel.quit(); 317 m_excitationPanel = null; 318 //TODO redo stop/start cursors on decay curve? 319 } 320 } 280 321 } 281 322 ); … … 332 373 } 333 374 375 private boolean updateExcitation(IUserInterfacePanel uiPanel, Excitation excitation) { 376 boolean success = false; 377 if (null != excitation) { 378 if (null != m_excitationPanel) { 379 m_excitationPanel.quit(); 380 } 381 382 // sum selected channel 383 double[] decay = new double[m_timeBins]; 384 for (int i = 0; i < decay.length; ++i) { 385 decay[i] = 0.0; 386 } 387 for (int y = 0; y < m_height; ++y) { 388 for (int x = 0; x < m_width; ++x) { 389 for (int b = 0; b < m_timeBins; ++b) { 390 decay[b] += getData(m_cursor, m_channel, x, y, b); 391 } 392 } 393 } 394 395 float[] results = CursorHelper.estimateCursors(m_timeRange, excitation.getValues(), decay); 396 excitation.setStart((int) results[0]); 397 excitation.setStop((int) results[1]); 398 excitation.setBase(results[2]); 399 400 uiPanel.setStart(22); 401 uiPanel.setStop(33); 402 403 m_excitationPanel = new ExcitationPanel(excitation); 404 405 success = true; 406 } 407 return success; 408 } 409 334 410 private void getFitSettings(IGrayScaleImage grayScalePanel, IUserInterfacePanel uiPanel) { 335 411 m_channel = grayScalePanel.getChannel(); … … 363 439 //TODO works with GenericDialogPlus, dialog.addFileField("File:", defaultFile, 24); 364 440 dialog.addStringField("File", defaultFile); 365 dialog.addCheckbox("Fake data", m_fakeData);366 441 dialog.showDialog(); 367 442 if (dialog.wasCanceled()) { 368 443 return false; 369 444 } 370 371 445 m_file = dialog.getNextString(); 372 m_fakeData = dialog.getNextBoolean();373 374 446 return true; 375 447 } … … 474 546 } 475 547 476 private boolean fakeData() {477 return true;478 }479 548 /** 480 549 * This routine creates an artificial set of data that is useful to test fitting. -
trunk/projects/slim-plugin/src/main/java/loci/slim/ui/ExcitationGraph.java
r7668 r7671 125 125 126 126 // create the chart 127 JFreeChart chart = createChart( start, stop,bins, timeInc, values);127 JFreeChart chart = createChart(bins, timeInc, values); 128 128 ChartPanel chartPanel = new ChartPanel(chart, true, true, true, false, true); 129 129 chartPanel.setDomainZoomable(false); … … 190 190 * Creates the chart 191 191 * 192 * @param start time bin193 * @param stop time bin194 192 * @param bins number of bins 195 193 * @param timeInc time increment per bin … … 197 195 * @return the chart 198 196 */ 199 JFreeChart createChart(int start, int stop, intbins, double timeInc, float[] values) {197 JFreeChart createChart(int bins, double timeInc, float[] values) { 200 198 201 199 // create chart data 202 createDataset( start, stop,bins, timeInc, values);200 createDataset(bins, timeInc, values); 203 201 204 202 // make a horizontal axis … … 235 233 * Creates the data set for the chart 236 234 * 237 * @param start time bin238 * @param stop time bin239 235 * @param bins number of time bins 240 236 * @param timeInc time increment per time bin 241 237 * @param data from the fit 242 238 */ 243 private void createDataset(int start, int stop, intbins, double timeInc, float[] values) {239 private void createDataset(int bins, double timeInc, float[] values) { 244 240 XYSeries series = new XYSeries("Data"); 245 241 double yData, yFitted; -
trunk/projects/slim-plugin/src/main/java/loci/slim/ui/IUserInterfacePanelListener.java
r7668 r7671 36 36 37 37 /** 38 * TODO 39 * 40 * <dl><dt><b>Source code:</b></dt> 41 * <dd><a href="http://dev.loci.wisc.edu/trac/software/browser/trunk/projects/slim-plugin/src/main/java/loci/slim/ui/IUserInterfacePanelListener.java">Trac</a>, 42 * <a href="http://dev.loci.wisc.edu/svn/software/trunk/projects/slim-plugin/src/main/java/loci/slim/ui/IUserInterfacePanelListener.java">SVN</a></dd></dl> 38 * Listens for user input that triggers changes external to the ui panel. 43 39 * 44 40 * @author Aivar Grislis grislis at wisc.edu … … 60 56 */ 61 57 public void quit(); 58 59 /** 60 * Loads an excitation curve from file. 61 * 62 * @param fileName 63 * @return whether successful 64 */ 65 public boolean loadExcitation(String fileName); 66 67 /** 68 * Creates an excitation curve from currrent X, Y and saves to file. 69 * 70 * @param fileName 71 * @return whether successful 72 */ 73 public boolean createExcitation(String fileName); 74 75 /** 76 * Cancels the current excitation curve, if any. 77 * 78 */ 79 public void cancelExcitation(); 62 80 } -
trunk/projects/slim-plugin/src/main/java/loci/slim/ui/UserInterfacePanel.java
r7668 r7671 64 64 import ij.gui.GenericDialog; 65 65 66 import loci.slim.Excitation;67 import loci.slim.ExcitationFileHandler;68 66 import loci.slim.ui.IUserInterfacePanel.FitAlgorithm; 69 67 import loci.slim.ui.IUserInterfacePanel.FitFunction; 70 68 import loci.slim.ui.IUserInterfacePanel.FitRegion; 71 import loci.slim.analysis.SLIMAnalysis;72 import loci.slim.binning.SLIMBinning;73 69 74 70 /** 75 * TODO 76 * 77 * <dl><dt><b>Source code:</b></dt> 78 * <dd><a href="http://dev.loci.wisc.edu/trac/software/browser/trunk/projects/slim-plugin/src/main/java/loci/slim/ui/UserInterfacePanel.java">Trac</a>, 79 * <a href="http://dev.loci.wisc.edu/svn/software/trunk/projects/slim-plugin/src/main/java/loci/slim/ui/UserInterfacePanel.java">SVN</a></dd></dl> 71 * Main user interface panel for the fit. 80 72 * 81 73 * @author Aivar Grislis grislis at wisc.edu … … 127 119 128 120 public IUserInterfacePanelListener m_listener; 129 130 private ExcitationPanel m_excitationPanel;131 121 132 122 int m_fittedParameterCount = 0; … … 381 371 } 382 372 383 float[] m_values = null;384 385 373 /* 386 374 * Creates a panel that has some settings that control the fit. … … 434 422 new ActionListener() { 435 423 public void actionPerformed(ActionEvent e) { 436 Excitation excitation = null;437 438 424 String selectedItem = (String) m_excitationComboBox.getSelectedItem(); 439 System.out.println("selected " + selectedItem);425 boolean isExcitationLoaded = false; 440 426 if (EXCITATION_NONE.equals(selectedItem)) { 441 if (null != m_excitationPanel) { 442 m_excitationPanel.quit(); 443 m_excitationPanel = null; 427 if (null != m_listener) { 428 m_listener.cancelExcitation(); 444 429 } 445 430 } 446 431 else if (EXCITATION_FILE.equals(selectedItem)) { 447 432 String fileName = getFileName("Load Excitation File", ""); 448 if (null != fileName) { 449 excitation = ExcitationFileHandler.getInstance().loadExcitation(fileName); 450 } 451 if (null != excitation) { 452 m_values = excitation.getValues(); 433 if (null != fileName && null != m_listener) { 434 isExcitationLoaded = m_listener.loadExcitation(fileName); 453 435 } 454 436 } 455 437 else if (EXCITATION_CREATE.equals(selectedItem)) { 456 438 String fileName = getFileName("Save Excitation File", ""); 457 if (null != fileName) { 458 if (null != m_values) { 459 excitation = ExcitationFileHandler.getInstance().createExcitation(fileName, m_values); 460 } 439 if (null != fileName && null != m_listener) { 440 isExcitationLoaded = m_listener.createExcitation(fileName); 461 441 } 462 442 } 463 443 464 if ( null == excitation) {465 m_excitationComboBox.setSelectedItem(EXCITATION_ NONE);444 if (isExcitationLoaded) { 445 m_excitationComboBox.setSelectedItem(EXCITATION_FILE); 466 446 } 467 447 else { 468 m_excitationComboBox.setSelectedItem(EXCITATION_FILE); 469 m_excitationPanel = new ExcitationPanel(excitation); 448 m_excitationComboBox.setSelectedItem(EXCITATION_NONE); 470 449 } 471 450 }
Note: See TracChangeset
for help on using the changeset viewer.