Table of Contents

Versatile Wand Tool

An ImageJ magic wand

Features: Selectable tolerance, variable hue or grayscale preference for RGB, gradient detection for grayscale, 4-connected, 8-connected or non-contiguous operation and preview.

See also: The built in wand tool, which supports 4-conected and 8-connected mode and has a 'tolerance' slider.

Versative Wand Tool screenshot

Tool Options

Versatile Wand Tool iconSelect the options by right-clicking on the tool icon. If the Versatile Wand tool has been used before, you will get a preview, showing how the options affect the selection, with the position of the last click on an image.

Value Tolerance

Color

Gradient Tolerance

Eyedropper Color

Connectedness

Include Holes

Use in Macros

In Macros, you can call the Versatile Wand Tool using its static doWand method.

    call("Versatile_Wand_Tool.doWand", x, y, tolerance, colorSensitivity, gradientTolerance, "options");

If you don't need the colorSensitivity and gradientTolerance, you can also use the shorter version

    call("Versatile_Wand_Tool.doWand", x, y, tolerance, "options");

Enter the numbers or variables directly as arguments, not in the notation for options of run commands (do not use &x etc.)
The String options should contain the connectedness (8-connected, 4-connected, or non-contiguous) and it may contain the keywords eydropper and include, for using the foreground color (eydropper color), and for including holes, respectively.

You can also use Plugins>Macros>Record.

For adding to the current selection, precede the call by setKeyDown(“shift”);
For subtracting from the selection, use setKeyDown(“alt”);

Installation

Note: For large images and complex selections, it is recommended to use ImageJ 1.50d10 or later; otherwise lengthy wand operations during preview may not be interruptible as they should.

Update History


Old Version

In contrast to the current version, which is an ImageJ Tool, the old version had to be called from a macro tool. Its dialog has had the following additional items:

Install Tool

x, y

Do Wand on OK

Preview

Installation of the old version

    macro 'Versatile Wand Tool-Cf00Lee55O2233' {
        getCursorLoc(x, y, z, flags);
        call('Versatile_Wand.mousePressed', x, y);
    }
    macro 'Versatile Wand Tool Options' {
        call('Versatile_Wand.setOptions');
    }

If you like a more fancy icon, this one has a gradient in the background:

    macro 'Versatile Wand Tool-C333F8082C555F8282C777F8482C999F8682CbbbF8882CdddF8a82C00fLee44O1133' {

Manual use of the old version

Use of the old version in macros

You can use the Macro Recorder (Plugins>Macros>Record) to record Versatile Wand selections; this will result in code like the following:

    call("Versatile_Wand.mousePressed", 150, 125);

If you want to record the Options Menu, you must not double-click (or right-click) the icon in the Toolbar; in that case it won't be recorded (because it is called by a macro). Instead, call the Versatile Wand from the Plugins Menu to record the options.

Update History of the old version