Default to tool other than "Rectangular Selections" at start up

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Default to tool other than "Rectangular Selections" at start up

kacollins
Is is possible to set ImageJ to default to a tool other than "Rectangular Selections" when ImageJ starts?
Reply | Threaded
Open this post in threaded view
|

Re: Default to tool other than "Rectangular Selections" at start up

dscho
Hi,

On Tue, 3 Aug 2010, kacollins wrote:

> Is is possible to set ImageJ to default to a tool other than
> "Rectangular Selections" when ImageJ starts?

See
http://imagejdocu.tudor.lu/doku.php?id=gui:plugins:macros#startupmacros 
(look out for AutoRun()).

Ciao,
Johannes
Reply | Threaded
Open this post in threaded view
|

Re: Default to tool other than "Rectangular Selections" at start up

kacollins
Hi Johannes,
      When I use AutoRun() to run the plugin that is installed in the toolbar at startup, I get the error message "There are no images open" in a window labeled "No Image", and the tool selected on the toolbar is still the Rectangular Selections tool. The error message seems to appear after the plugin's setup method and before the run method. Is there anyway to avoid this issue or another approach to setting the default toolbar tool (that is a plugin) prior to opening an image?
     
Thanks,   Karen
Reply | Threaded
Open this post in threaded view
|

Re: Default to tool other than "Rectangular Selections" at start up

Gabriel Landini
On Wednesday 04 August 2010, you wrote:
>       When I use AutoRun() to run
the plugin that is installed in the
> toolbar at startup, I get the error
message "There are no images open" in a
> window labeled "No Image", and the
tool selected on the toolbar is still
> the Rectangular Selections tool. The
error message seems to appear after
> the plugin's setup method and before
the run method. Is there anyway to
> avoid this issue or another approach to
setting the default toolbar tool
> (that is a plugin) prior to opening an
image?

Please show what your code is, otherwise it is impossible to guess
what you are doing and why it does not work.

To change the default tool,
which is what you asked in the first instance, open the StartupMAcros.txt
file which is in the /macros folder.
After the 3 lines with a preceeding
comment "//Global variables"
you type:

macro "AutoRun" {
 
setTool("hand");
}

Save the file.
When you restart IJ, the tool selected
should be the hand instead of the rectangle tool.
You can do similarly for
the other buttons.
To know how to call the other tools, run the macro
recorded and press the buttons.

G.
Reply | Threaded
Open this post in threaded view
|

Re: Default to tool other than "Rectangular Selections" at start up

kacollins
Thank you. The setTool command in the autoRun macro does select the desired tool at startup, although for custom tools, apparently one needs to determine the tool number and use that rather than the name (thanks Wayne). Other tips from Wayne were to return "NO_IMAGE_REQUIRED" from the pluginfilter's setup method to avoid the "No Image" error message or to just use a plugin (as opposed to pluginfilter) and implement an Imagelistener to grab an image as it is being opened. ImageListener works beautifully, and with filetype associations setup appropriately in the OS along with the AutoRun macro, a double click on a file from the OS directory window (Windows Explorer in my case) opens ImageJ, loads the file, and runs the plugin with no additional keyboard commands or mouse clicks.

Thanks to all for your help,
Karen