Hello,
I am trying to call the ROI Manager command below from a macro: roiManager("Show All with labels"); However it does not show the labels of the points. Labels only appear if I activate the Edit Mode check box manually. Recording this activation outputs: roiManager("Show All with labels"); roiManager("Show All"); Using these two commands in sequence in the macro does not activate the labels, also. I am using: java.version: 1.6.0_24 java.vendor: Sun Microsystems Inc. os.name: Linux IJ.getVersion: 1.45l Any ideas? Thanks! bruno -- Bruno C. Vellutini organelas.com |
Hi Bruno,
I suggest you update to the latest daily build (m26 I think), and then you'll have a new menu: Image -> Overlay -> Overlay options There you'll be able to specify whether you want labels or label names, and do the same in a macro, e.g.: run("Overlay Options...", "stroke=yellow width=1 fill=none show"); Hope this helps, Emmanuel On 15 August 2011 13:50, Bruno C. Vellutini <[hidden email]> wrote: > Hello, > > I am trying to call the ROI Manager command below from a macro: > > roiManager("Show All with labels"); > > However it does not show the labels of the points. Labels only appear if I > activate the Edit Mode check box manually. Recording this activation > outputs: > > roiManager("Show All with labels"); > roiManager("Show All"); > > Using these two commands in sequence in the macro does not activate the > labels, also. I am using: > > java.version: 1.6.0_24 > java.vendor: Sun Microsystems Inc. > os.name: Linux > IJ.getVersion: 1.45l > > Any ideas? Thanks! > > bruno > > > > > -- > Bruno C. Vellutini > organelas.com > |
Hello Emmanuel,
Thanks for the suggestion. The new overlay method did work, but it does not fit well into my macro because labels remain static when the user drags the landmarks. Let me explain in more detail: The macro should open the ROI Manager, import a set of pre-defined ROIs (points), display the points over the open image, display the name of each point as label, and finally activate the Edit Mode to allow the user to modify the position of the points. Showing labels appears to be bundled into the Edit Mode activation. So the problem really is activating the Edit Mode via macro command. The recorder says roiManager("Show All with labels"); is the command, but it does not work via macro (and thus, no label is shown). I just looked at ImageJ source and found the bug at the RoiManager class: public boolean runCommand(String cmd) { ... else if (cmd.startsWith("show all")) { if (WindowManager.getCurrentImage()!=null) { showAll(SHOW_ALL); showAllCheckbox.setState(true); } } else if (cmd.startsWith("show none")) { if (WindowManager.getCurrentImage()!=null) { showAll(SHOW_NONE); showAllCheckbox.setState(false); } } else if (cmd.equals("show all with labels")) { labelsCheckbox.setState(true); showAll(LABELS); if (Interpreter.isBatchMode()) IJ.wait(250); } else if (cmd.equals("show all without labels")) { labelsCheckbox.setState(false); showAll(NO_LABELS); if (Interpreter.isBatchMode()) IJ.wait(250); } ... } The cmd.startsWith("show all") is capturing the "show all with labels" command before it reaches the cmd.equals("show all with labels"). Simply putting both cmd.equals before both cmd.startsWith else if conditionals should solve the issue, I think. bruno On Mon, Aug 15, 2011 at 3:33 PM, Emmanuel Levy <[hidden email]>wrote: > Hi Bruno, > > I suggest you update to the latest daily build (m26 I think), and then > you'll have a new menu: > Image -> Overlay -> Overlay options > > There you'll be able to specify whether you want labels or label > names, and do the same in a macro, e.g.: > run("Overlay Options...", "stroke=yellow width=1 fill=none show"); > > Hope this helps, > > Emmanuel > > > > On 15 August 2011 13:50, Bruno C. Vellutini <[hidden email]> wrote: > > Hello, > > > > I am trying to call the ROI Manager command below from a macro: > > > > roiManager("Show All with labels"); > > > > However it does not show the labels of the points. Labels only appear if > I > > activate the Edit Mode check box manually. Recording this activation > > outputs: > > > > roiManager("Show All with labels"); > > roiManager("Show All"); > > > > Using these two commands in sequence in the macro does not activate the > > labels, also. I am using: > > > > java.version: 1.6.0_24 > > java.vendor: Sun Microsystems Inc. > > os.name: Linux > > IJ.getVersion: 1.45l > > > > Any ideas? Thanks! > > > > bruno > > > > > > > > > > -- > > Bruno C. Vellutini > > organelas.com > > > -- Bruno C. Vellutini organelas.com |
On Aug 17, 2011, at 3:41 PM, Bruno C. Vellutini wrote:
> Hello Emmanuel, > > Thanks for the suggestion. The new overlay method did work, but it does not > fit well into my macro because labels remain static when the user drags the > landmarks. Let me explain in more detail: > > The macro should open the ROI Manager, import a set of pre-defined ROIs > (points), display the points over the open image, display the name of each > point as label, and finally activate the Edit Mode to allow the user to > modify the position of the points. > > Showing labels appears to be bundled into the Edit Mode activation. So the > problem really is activating the Edit Mode via macro command. The recorder > says roiManager("Show All with labels"); is the command, but it does not > work via macro (and thus, no label is shown). > > I just looked at ImageJ source and found the bug at the RoiManager class: Bruno's proposed fix, which does fix this problem, is in the 1.45m daily build. -wayne > public boolean runCommand(String cmd) { > ... > else if (cmd.startsWith("show all")) { > if (WindowManager.getCurrentImage()!=null) { > showAll(SHOW_ALL); > showAllCheckbox.setState(true); > } > } else if (cmd.startsWith("show none")) { > if (WindowManager.getCurrentImage()!=null) { > showAll(SHOW_NONE); > showAllCheckbox.setState(false); > } > } else if (cmd.equals("show all with labels")) { > labelsCheckbox.setState(true); > showAll(LABELS); > if (Interpreter.isBatchMode()) IJ.wait(250); > } else if (cmd.equals("show all without labels")) { > labelsCheckbox.setState(false); > showAll(NO_LABELS); > if (Interpreter.isBatchMode()) IJ.wait(250); > } > ... > } > > The cmd.startsWith("show all") is capturing the "show all with labels" command > before it reaches the cmd.equals("show all with labels"). Simply putting > both cmd.equals before both cmd.startsWith else if conditionals should solve > the issue, I think. > > bruno > > > On Mon, Aug 15, 2011 at 3:33 PM, Emmanuel Levy <[hidden email]>wrote: > >> Hi Bruno, >> >> I suggest you update to the latest daily build (m26 I think), and then >> you'll have a new menu: >> Image -> Overlay -> Overlay options >> >> There you'll be able to specify whether you want labels or label >> names, and do the same in a macro, e.g.: >> run("Overlay Options...", "stroke=yellow width=1 fill=none show"); >> >> Hope this helps, >> >> Emmanuel >> >> >> >> On 15 August 2011 13:50, Bruno C. Vellutini <[hidden email]> wrote: >>> Hello, >>> >>> I am trying to call the ROI Manager command below from a macro: >>> >>> roiManager("Show All with labels"); >>> >>> However it does not show the labels of the points. Labels only appear if >> I >>> activate the Edit Mode check box manually. Recording this activation >>> outputs: >>> >>> roiManager("Show All with labels"); >>> roiManager("Show All"); >>> >>> Using these two commands in sequence in the macro does not activate the >>> labels, also. I am using: >>> >>> java.version: 1.6.0_24 >>> java.vendor: Sun Microsystems Inc. >>> os.name: Linux >>> IJ.getVersion: 1.45l >>> >>> Any ideas? Thanks! >>> >>> bruno >>> >>> >>> >>> >>> -- >>> Bruno C. Vellutini >>> organelas.com >>> >> > > > > -- > Bruno C. Vellutini > organelas.com |
Free forum by Nabble | Edit this page |