|
4 | 4 | import time |
5 | 5 |
|
6 | 6 | from ij import IJ # pylint: disable-msg=import-error |
7 | | -from ij.measure import ResultsTable # pylint: disable-msg=import-error |
8 | | -from ij.plugin.frame import RoiManager # pylint: disable-msg=import-error |
9 | 7 |
|
| 8 | +from . import prefs |
10 | 9 | from ..log import LOG as log |
11 | 10 |
|
12 | 11 |
|
@@ -198,30 +197,24 @@ def get_free_memory(): |
198 | 197 | return free_memory |
199 | 198 |
|
200 | 199 |
|
201 | | -def setup_clean_ij_environment(rm=None, rt=None): |
| 200 | +def setup_clean_ij_environment(rm=None, rt=None): # pylint: disable-msg=unused-argument |
202 | 201 | """Set up a clean and defined ImageJ environment. |
203 | 202 |
|
| 203 | + Clean active results table, roi manager and log, close any open image. |
| 204 | +
|
| 205 | + "Fresh Start" is described here: https://imagej.nih.gov/ij/notes.html following this suggestion: https://forum.image.sc/t/fresh-start-macro-command-in-imagej-fiji/43102 |
| 206 | +
|
204 | 207 | Parameters |
205 | 208 | ---------- |
206 | 209 | rm : RoiManager, optional |
207 | | - A reference to an IJ-RoiManager instance. |
| 210 | + Will be ignored (kept for keeping API compatibility). |
208 | 211 | rt : ResultsTable, optional |
209 | | - A reference to an IJ-ResultsTable instance. |
| 212 | + Will be ignored (kept for keeping API compatibility). |
210 | 213 | """ |
211 | | - # FIXME: use function(s) from the "roimanager" module! |
212 | | - if not rm: |
213 | | - rm = RoiManager.getInstance() |
214 | | - if not rm: |
215 | | - rm = RoiManager() |
216 | | - |
217 | | - if not rt: |
218 | | - rt = ResultsTable.getInstance() |
219 | | - if not rt: |
220 | | - rt = ResultsTable() |
221 | | - |
222 | | - rm.runCommand("reset") |
223 | | - rt.reset() |
224 | | - IJ.log(r"\\Clear") |
225 | | - |
226 | | - # FIXME: integrate commands from method below |
227 | | - # fix_ij_options() |
| 214 | + |
| 215 | + IJ.run("Fresh Start", "") |
| 216 | + IJ.log("\\Clear") |
| 217 | + |
| 218 | + prefs.fix_ij_options() |
| 219 | + |
| 220 | + return |
0 commit comments