Waving Your Wand

Often, image analysis involves the measurement of objects, be they nuclei, cells or bacteria. There are plenty of good ways to select the boundaries of these objects, using freehand or segmented selections, and we’ve covered segmentation based on thresholding before.

This post is going to take a step back and look at how the magic wand tool works. It’s quick and simple, but sometimes that’s all you need. Let’s wave our wands!

In Fiji, the oft-overlooked tool that we’re going to be using today is the magic wand (or tracing) tool (8th from the left):


Here’s how it works. When you click a pixel in the image with the magic wand, the selection that is produced includes the pixel you clicked and any adjacent pixel whose intensity is within a tolerance value of that original pixel. Confused? Below is a schematic image with three intensity values:


If we select the starred pixel below with the wand tool. All of the adjacent pixels of the same intensity are selected (our tolerance is zero).


Now if we increase the tolerance and click again, all of the darker grey pixels are also selected.


Finally, if we increase the tolerance even further we will get to a point when all of the pixel intensities (including the background) are within the tolerance range of the original pixel.


NOTE: in Fiji, the intensity range is specified by: [initial value – tolerance] to [initial value + tolerance].

Magic in the real world

The principle is the same in actual data although the threshold value may not always be obvious. The best way to approach the problem is to get an idea of the signal and of the background (I use the tool tip in the Fiji status bar) and pick something similar to the difference between them. In the image below (of a DAPI-stained nucleus) the signal is on average about 7500 and the background is around 1600.


If you double click on the wand tool, you will get the options whereby you can set the tolerance. Below are three different thresholds all based on the same magic-wand selection (somewhere in the middle of the nucleus).


As this is a selection you can hit ‘m’ to measure parameters of the nucleus, ‘t’ to add it to the ROI manager and save it for later or just feel smug that you didn’t waste time drawing it manually.

Well connected

The astute among you may have noticed that in the tool options you also have the choice of 4-connected or 8-connected selections. This simply defines whether you want to count diagonals when looking at adjacent pixels:




Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.