(FileInfo fi)
| 2443 | } |
| 2444 | |
| 2445 | void revertStack(FileInfo fi) { |
| 2446 | String path = null; |
| 2447 | String url2 = null; |
| 2448 | if (url!=null && !url.equals("")) { |
| 2449 | path = url; |
| 2450 | url2 = url; |
| 2451 | } else if (fi!=null && !((fi.directory==null||fi.directory.equals("")))) { |
| 2452 | path = fi.getFilePath(); |
| 2453 | } else if (fi!=null && fi.url!=null && !fi.url.equals("")) { |
| 2454 | path = fi.url; |
| 2455 | url2 = fi.url; |
| 2456 | } else |
| 2457 | return; |
| 2458 | IJ.showStatus("Loading: " + path); |
| 2459 | ImagePlus imp = IJ.openImage(path); |
| 2460 | if (imp!=null) { |
| 2461 | int n = imp.getStackSize(); |
| 2462 | int c = imp.getNChannels(); |
| 2463 | int z = imp.getNSlices(); |
| 2464 | int t = imp.getNFrames(); |
| 2465 | if (z==n || t==n || (c==getNChannels()&&z==getNSlices()&&t==getNFrames())) { |
| 2466 | setCalibration(imp.getCalibration()); |
| 2467 | setStack(imp.getStack(), c, z, t); |
| 2468 | } else { |
| 2469 | ImageWindow win = getWindow(); |
| 2470 | Point loc = null; |
| 2471 | if (win!=null) loc = win.getLocation(); |
| 2472 | changes = false; |
| 2473 | close(); |
| 2474 | FileInfo fi2 = imp.getOriginalFileInfo(); |
| 2475 | if (fi2!=null && (fi2.url==null || fi2.url.length()==0)) { |
| 2476 | fi2.url = url2; |
| 2477 | imp.setFileInfo(fi2); |
| 2478 | } |
| 2479 | ImageWindow.setNextLocation(loc); |
| 2480 | imp.show(); |
| 2481 | } |
| 2482 | } |
| 2483 | } |
| 2484 | |
| 2485 | /** Returns a FileInfo object containing information, including the |
| 2486 | pixel array, needed to save this image. Use getOriginalFileInfo() |
nothing calls this directly
no test coverage detected