Login  Register

Re: Disabling the ROI pop-up menu

Posted by Wayne Rasband-2 on Dec 19, 2020; 5:40pm
URL: http://imagej.273.s1.nabble.com/Disabling-the-ROI-pop-up-menu-tp5024287p5024290.html

> On Dec 18, 2020, at 11:03 PM, Stein Rørvik <[hidden email]> wrote:
>
> I have a related question regarding pop-up menus:
>
> The macro Wayne posted shows an example of how to make a custom pop-up menu. This is very useful; I have added something similar to my startup macro file, to present a custom list of what to do with an image.
>
> This approach works well when there is no ROI, but if you click inside an ROI, the recently added ROI pop-up menu shows instead. This is not always desirable, especially when you want to use your custom menu and the ROI is covering all or the majority of the image area.
>
> So, is there any way to disable the built-in ROI pop-up menu, to use the image pop-up menu instead?  Perhaps one could use a modifier key for this; e.g. the image pop-up would show also inside an ROI if the shift key is held down.

With the 1.53h11 daily build, alt-right-click or shift-right-click inside an ROI and ImageJ will show the image pop-up menu instead of the ROI pop-up menu.

-wayne


> -----Original Message-----
> Sent: 16. desember 2020 18:16
> Subject: Re: calling macros or functions from within a macro
>
>> On Dec 16, 2020, at 9:44 AM, Cammer, Michael <[hidden email]> wrote:
>>
>> I would like to use the pull down menu to run a macro that is in the same text file or a function in the same file.  runMacro() requires a file on disk and trying to call a function I defined returns an error message.
>
> The following macro code, when saved as a file and installed using Plugins>Macros>Install, creates an image popup menu that with a "My Function" command that calls the function myFunction().
>
> -wayne
>
>  var pmCmds = newMenu("Popup Menu",
>      newArray("My Function","Fire","Invert LUT"));
>
>  macro "Popup Menu" {
>     cmd = getArgument();
>     if (cmd=="My Function")
>        myFunction();
>      else
>        run(cmd);
>  }
>
>  function myFunction() {
>     print("successful");
>  }
>
>
>> For instance, based on https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimagej.nih.gov%2Fij%2Fmacros%2FCustomPopupMenu.txt&amp;data=04%7C01%7Cstein.rorvik%40sintef.no%7Cb07634b77f3e4a91787008d8a1e67726%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637437358518535936%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=00eCiXUdNGBuoXh1dAI9%2Bf2GfAKCX4n5fjKFm6nooCM%3D&amp;reserved=0, I tried the following with my function testPulldownMenu().  The other commands in the list are mostly macros in the same file.  And the B&C commands works fine.
>>
>>
>> Is there a way to call my own functions or macros?  Any help greatly appreciated.
>>
>>
>> var pmCmds = newMenu("Popup Menu",
>>      newArray("testPulldownMenu", "Prepare image for markup", "Mark Distal", "Mark Nucleus", "Add Line Segment", "Grays LUT", "Color LUT",
>>      "Brightness/Contrast..."));
>>
>> macro "Popup Menu" {
>>     cmd = getArgument();
>>     run(cmd);
>>     //runMacro(cmd);
>> }
>>
>> function testPulldownMenu() {
>> print("successful");
>> }
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html