roiManager("Open", filename) does nto open the ROI manager when my
script has setBatchMode(true). Here is a minimal script that reproduces the problem: setBatchMode(true); roiManager("Open", <valid path to a zip file containing an roiset>); setBatchMode(false); This fails, but if I remove the setBatchMode(true) statement, it will succeed (ie, leaves me with an open roi manager containing the correctly loaded roi set). Aside -- it would really be nice to be able to deal with two independent ROI managers in a macro script. I see no way to do it, but wonder if it can be done using the API in Java, python, beanshell, etc by defining two roi manager objects? --aryeh -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Apr 29, 2014, at 1:48 PM, Aryeh Weiss wrote:
> roiManager("Open", filename) does nto open the ROI manager when my script has setBatchMode(true). > > Here is a minimal script that reproduces the problem: > > setBatchMode(true); > roiManager("Open", <valid path to a zip file containing an roiset>); > setBatchMode(false); To improve performance, the ROI Manager is not displayed in batch mode macros but other than this it works as expected. Run this version of your macro and you will see that the ROI set was opened: setBatchMode(true); roiManager("Open", <path to a zip file containing an ROI set>); print("count: "+roiManager("count")); > This fails, but if I remove the setBatchMode(true) statement, it will succeed (ie, leaves me with an open roi manager containing > the correctly loaded roi set). > Aside -- it would really be nice to be able to deal with two independent ROI managers in a macro script. > I see no way to do it, but wonder if it can be done using the API in Java, python, beanshell, etc by defining two roi manager objects? You can have multiple ROI Managers is Java, JavaScript, Python, etc. Here is a JavaScript example with two ROI Managers active at the same time: imp1 = IJ.openImage("http://imagej.nih.gov/ij/images/Dot_Blot.jpg"); IJ.setAutoThreshold(imp1, "Default"); rm1 = new RoiManager(true); ParticleAnalyzer.setRoiManager(rm1); IJ.run(imp1, "Analyze Particles...", " clear add"); imp2 = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif"); IJ.setAutoThreshold(imp2, "Default"); rm2 = new RoiManager(true); ParticleAnalyzer.setRoiManager(rm2); IJ.run(imp2, "Analyze Particles...", " clear add"); rois1 = rm1.getRoisAsArray(); rois2 = rm2.getRoisAsArray(); IJ.log(imp1.getTitle()+": "+rois1.length); IJ.log(imp2.getTitle()+": "+rois2.length); -wayne -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On 4/30/14, 2:39 AM, Rasband, Wayne (NIH/NIMH) [E] wrote:
> On Apr 29, 2014, at 1:48 PM, Aryeh Weiss wrote: > >> roiManager("Open", filename) does nto open the ROI manager when my script has setBatchMode(true). >> >> Here is a minimal script that reproduces the problem: >> >> setBatchMode(true); >> roiManager("Open", <valid path to a zip file containing an roiset>); >> setBatchMode(false); > To improve performance, the ROI Manager is not displayed in batch mode macros but other than this it works as expected. Run this version of your macro and you will see that the ROI set was opened: > > setBatchMode(true); > roiManager("Open", <path to a zip file containing an ROI set>); > print("count: "+roiManager("count")); > > I thought that this may be the case, but I was surprised that the ROI window did not come back when I switch batch mode to false, and was not available even after the macro terminated. After the macro terminated, opening the ROI manager through Analyze>Tools brought up a blank ROI manager, so I could not figure out how to get at my newly opened ROI set. --aryeh -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |