Close all images, empty ROI Manager, clear the Results table, clears the Log window and sets "Black background" 'true'.
()
| 239 | "Black background" 'true'. |
| 240 | */ |
| 241 | private void freshStart() { |
| 242 | String options = Macro.getOptions(); |
| 243 | boolean keepImages = false; |
| 244 | boolean keepResults = false; |
| 245 | boolean keepRois = false; |
| 246 | if (options!=null) { |
| 247 | options = options.toLowerCase(); |
| 248 | keepImages = options.contains("images"); |
| 249 | keepResults = options.contains("results"); |
| 250 | keepRois = options.contains("rois"); |
| 251 | } |
| 252 | if (!keepImages) { |
| 253 | if (!Commands.closeAll()) |
| 254 | return; |
| 255 | } |
| 256 | if (!keepResults) { |
| 257 | if (!Analyzer.resetCounter()) |
| 258 | return; |
| 259 | } |
| 260 | if (!keepRois) { |
| 261 | RoiManager rm = RoiManager.getInstance(); |
| 262 | if (rm!=null) |
| 263 | rm.reset(); |
| 264 | } |
| 265 | if (WindowManager.getWindow("Log")!=null) |
| 266 | IJ.log("\\Clear"); |
| 267 | Prefs.blackBackground = true; |
| 268 | } |
| 269 | |
| 270 | // Delete preferences file when ImageJ quits |
| 271 | private void reset() { |
no test coverage detected