Content uploaded by Volker Bäcker
Author content
All content in this area was uploaded by Volker Bäcker on Mar 20, 2015
Content may be subject to copyright.
ImageJ Macro Tool Sets for Biological Image Analysis
Volker Baeckera
aMontpellier RIO Imaging, CNRS, 1919, route de Mende, 34293 MONTPELLIER CEDEX 5,
France
ABSTRACT
At the imaging facility Montpellier RIO Imaging we create custom solutions for image analysis and automation
tasks based on ImageJ. We provide these solutions in the form of ImageJ macro tool sets. Macro tool sets are
easy to install, provide a simple graphical interface, allow to set options and can call plugins for more complex
tasks. The first button of each tool set opens the help and installation page of the tool set on the wiki of
the facility’s project management and task-tracking tool. The wiki contains installation and usage instructions,
the tool set macro, links to plugins and other dependencies and example images. A tool set often contains a
manual version of the macro that can be used to test the macro on the current image and a batch version that
will run the same macro on a set of images. The general approach and a number of available tool sets will be
presented here. The tool sets for biological image analysis include: the segmentation of adipocytes, the analysis
of multi-well arabidopsis seedling images, the counting of segment like objects, the analysis of virus infections in
leaves, the measurement of the interdigitation index and the thickness in skin images and the analysis of wound
healing. The tool sets concerning the workflow include: the cropping of regions from big images, the conversion
of image formats, the navigation within a set of images, the transformation of ROIs and the order of ROIs in
the ROI-manager.
Keywords: ImageJ, microscopy, image analysis, macros, tool sets, automation
1. INTRODUCTION
At the facility Montpellier RIO Imaging we provide the creation of custom image analysis and automation
solutions on demand as a service. The biologist contacts us and we find a protocol that solves the image analysis
problem. If the protocol can not be executed using existing software packages, we create the necessary tools based
on ImageJ.1The protocol and the tools are evaluated in cooperation with the biologist, using data provided by
him. Once the evaluation done the biologist uses the provided tools by himself to solve the image analysis task.
While in the past we used the ImageJ based MRI Cell Image Analyzer (CIA) framework,2we switched to
the usage of ImageJ macro tool sets3as the main user interface more recently. The reason for this is that, on
the one hand a certain number of features that where missing in ImageJ when the CIA was written are now
available. On the other hand macro tool sets are a standard ImageJ feature and need less adaptations as the
versions of ImageJ advance. Among the now available features are:
•the switchable tool bars allow to provide a set of tools that solve a given problem
•the options of a tool on the toolbar, accessible via a right-click, can be set independent from running
a macro
•the waitForUser macro command allows to have interactive macro tools
Further points that the CIA handled, like for example the independence of the ImageJ operation from the
user interface will be solved in ImageJ2.4What is still missing in ImageJ is a more convenient way to specify
a list of input images and output folders. We solved this with a plugin Macro IO Settings,5that we use in
combination with the macro tool sets.
Send correspondence to volker.baecker@mri.cnrs.fr
It has to be noted that the requirements for tools that are mainly intended for the usage of one research
group are different from the requirements for tools that are made available to the users of a facility or to a wider
community. In the first case a number of macro files with an explanation of how to use them can be enough.
Needed in the second case are:
•a possibility to discover the tool
•documentation that is accessible from the tool
–installation instructions
–usage instructions
–meaning and influence of the options
–a description of the method used
–an explanation of the results
•the tool must be easy to install and easy to use
•a way to try it on data on which it is known to work
•an easy way to change options
•a way to try it on the data of the user
•a possibility to change default values
•a possibility to adapt the tool
ImageJ tool sets are a simple way to provide tools that can fulfill the above requirements. At the facility we
developed a number of tool sets for biological image analysis applications from different areas. Besides of this we
wrote a number of tool sets that do not solve biological image analysis problems directly. These are either there
to optimize the workflow of a protocol or they make available a functionality used in another tool set which can
be interesting in its own right.
2. MATERIALS AND METHODS
We use the web-based project management and task-tracking tool Redmine6to manage the image analysis
projects of the facility∗. For a new image analysis project an issue is created. Biologists can subscribe to issues
and follow the advancement of the work. The tool set macro files and other resources are uploaded to the files-
part of the Redmine and ordered by releases. Releases are numbered by the year and the month of the release.
The wiki part of the Redmine contains a help page for each macro tool set.
The help page of a tool set starts with a general description of the tool. It contains one or more example images
for which the tools work well, using the default options. It explains how to install the tool set and eventually its
dependencies and how to get started with it. The meaning of the options of each tool are explained. For each
tool the algorithms and methods applied are described. The page can contain hints for the usage of the tools or
a description of the workflow. Finally examples of the results of the tools are shown.
The first button of each tool set contains either an image that helps to identify the tool set or a questionmark.
Pressing the first button opens the help page of the tool set in the web-browser. There can be one version of
the macro that runs on the active image and a batch version that runs on a set of images. The tools can have
options that can be set by right-clicking on the button of the tool. The default values of the options are defined
as variables at the beginning of the tool set macro file. This way they can easily be changed. The user can
open the tool set macro file by pressing the shift-key while selecting the tool set, change the default values and
save the modified file. Macros run in batch mode, by using the setBatchMode macro command. Processing in
∗http://dev.mri.cnrs.fr/projects/imagej-macros
batch mode is faster and safer. Each macro should show the current activity and the progress in a log-window.
The ImageJ-progress bar is not appropriate to show the overall progress of the macro, since single commands
called from the macro are likely to interfere with it. The macro should clearly show when the processing ended.
If the macro worked on a set of files it should list the files that have been processed and those that have been
skipped. Macros running on file sets will usually write the measurement results and control images that show
the measured objects into a result folder. We use the Macro IO Settings plugin to conveniently specify input
images and output folders and to access them from macros. Since at the facility the user pays for the time that
he uses the image analysis workstations, a batch macro tool can have an option to close the workstation session
after the processing finished. This is implemented by running a shell command that closes the operating system
session from within the macro. More complex tasks or user interfaces are better implemented as plugins. Macro
tool sets can still be used to set the options and to start the tool.
3. RESULTS
In this section a number of macro tool sets developed at Montpellier RIO Imaging will be described. In the first
part tool sets that help optimize the workflow or make conversions are presented. In the second part tool sets
that solve biological image analysis tasks are described.
3.1 Tool sets for conversions and workflow optimizations
3.1.1 Crop 4D Cells
Figure 1. The Crop 4D Cells tool set.
This tool set allows to copy the interesting parts of big images and to save them to separate image files.
Only one region of interest needs to fit into the memory of the machine at a time. The tool set displays a
number of buttons to navigate within a defined list of images. These images can be in any format handled by
loci-bioformats.7The list of images can be set as an option of the tools of the tool set. Images are opened as
virtual stacks. The user makes a selection and the regions of interest are saved when he adds a new one and
automatically loaded into the ROI-manager when he opens an image. Once all interesting parts selected on all
images the user can run the export, that saves the result images in ics-format8into the results folder.
3.1.2 Image Conversion Tools
The tool converts all images in a folder from the formats lif, lsm and zvi†into tif-images.9Each channel of
a multichannel image is saved separately and an RGB-snapshot is saved as well. The options allow to apply
a z-projection of either all slices or a subset of the slices and to select the channels that will be used in the
RGB-snapshot image. The colors of the converted images will correspond to the colors of the original images
including for the conversion of the zvi-images.
3.1.3 NDPI Tools
This tool set is useful for the work with images from histological slices. The first tool converts images in the ndpi
format‡used by the Hamamatsu Nanozoomer into tif-images. The user can select a resolution present in the
ndpi-image for the export. The highest resolution is not supported. The second tool tries to select automatically
the different cuts on a slide. The arrangement of the cuts can be set in the options of the tool. The selections
are added to the ROI-manager and can be corrected by the user. The last tool exports the cuts according to the
ROIs in the ROI-manager, each one as a separate image.
†Leica Image File Format (lif ) is a file format owned by Leica Microsystems GmbH, the Laser Scanning Microscope
(lsm) file format and the Zeiss Axio Vision file format are owned by the Carl Zeiss MicroImaging GmbH
‡The NanoZoomer Digital Pathology Image format is owned by Hamamatsu
3.1.4 Next Image as Hyperstack Tool
This tool set has two tools. The first converts the current RGB-image into a hyperstack. The second opens the
next image in the current folder as a hyperstack. In the options the display mode of the hyperstack and the
channel selected by default can be changed. The tool set allows to work conveniently on a given channel in a
series of RGB-images.
3.1.5 ROI Converter Tools
These tools have been developed in the context of the Skin Tools§. The first tool creates a one-dimensional ROI
from an area ROI. The resulting ROI consists of the upper border between the leftmost and rightmost points
of the area ROI. With the help of this conversion the tool allows to measure the length of the upper border of
an area ROI. The second tool creates a point ROI from a one-dimensional ROI. The resulting points are the
local extrema of the original ROI. The options allow to exclude small local extrema. The third tool takes a
multiple-point ROI, traces for each point a vertical line from the first pixel above with intensity bigger than zero
to the next pixel with intensity zero and adds it to the ROI-manager.
3.1.6 Roi Shuffle Tools
This tool set has been developed for the Leaf Infection Tools¶. It allows to easily change the order of the ROIs
in the ROI-manager. The up-button moves the selected ROIs one position up in the ROI-manager if possible
and the down-button moves them one position down. It is possible to open a separate window containing the
two buttons.
3.2 Tool sets for biological image analysis
3.2.1 Adipocytes Tool
Figure 2. Adipocites segmented with the Adipocytes Tool.
The Adipocytes Tools help to analyze fat cells in images from histological sections in which the membranes
are stained. The preprocessing excludes regions that clearly do not contain fat cells. It is integrated into the
two other tools. It is nevertheless available as a separate tool in order to allow to find the right options more
easily. The simple method uses automatic thresholding and the particle analyzer to detect the cells. The options
allow to apply a binary watershed10 to separate touching cells. The last method uses a grayscale watershed
algorithm. After the exclusion of background areas, a find edges command is called and the result is smoothed
with a Gaussian blur filter11 before the watershed is applied. As a result a ROI for each detected cell is added
to the ROI-manager.
3.2.2 Arabidopsis Seedlings Tool
The tool allows to measure the surface of green pixels per well in images containing seedlings in multiple wells.
It uses color-thresholding in the CIELAB color space12 for the segmentation. The options allow to change the
threshold values and to adapt the macro to the distribution of the wells. It can be run in batch mode on a series
of images. The result is a spreadsheet file with the measured area per well and a control image showing the
detected surface for each input image.
Figure 3. The count segments tool finds the end points of segments.
3.2.3 Count Segments
This tool estimates the number of filament like segments in an image. The segments can cross each other. The
idea is to count the end point of segments rather than trying to separate and to count the segments themselves.
A blurred version of the image is subtracted from the original image. A Gaussian-blur filter is applied to the
result and the image is segmented by using the IsoData-auto-threshold. The result is converted into a mask and
skeletonized. The end points of the segments are detected as pixels that have exactly one neighbour.
3.2.4 Leaf Infection Tools
The aim of these tools is to measure the areas of two different epifluorescent stainings and the area of the overlap
region of the stainings in images of plant leaves. Each image contains multiple leaves. There is one image for
each channel. For each leaf the user adds a rectangular selection in the larger image and the exact selection
of the leaf in the cropped region to the ROI-manager. The tool calculates for each leaf the regions of the red
staining, the region of the green staining, the region of the overlap of the stainings and Pearson’s correlation
coefficient13 between the two channels. The aim of the experiment is to show that there is mutual exclusion of
the two stainings in some cases and not in other cases.
3.2.5 Skin Tools
Figure 4. The tool selected the lower border of the epidermis in 3 parts and drew perpendicular line segments to the other
side.
The skin tools measure the thickness of the epidermis and the interdigitation index.14 The input images are
masks that represent the epidermis and that have been created from images of stained histological sections. The
mask must touch the left and right border of the image. The dermal-epidermal border must be on the lower site
of the image. The interdigitation index can be measured for one or more segments per image. As a measure of
the thickness of the epidermis the lengths of a number of random line segments are measured. The line segments
start at the lower border, are perpendicular to the lower border and end at the opposite border of the mask.
§see section 3.2.5
¶see section 3.2.4
3.2.6 Wound Healing Tool
The wound healing tool measures the area of a wound in a time series of images of cellular tissue. The tool will
measure the area of the wound, i.e. the area that does not contain tissue, in each image. The segmentation is
based on the fact that the image is more homogeneous in the region of the wound as in the region of the tissue.
Via the options, one of two methods to detect the empty area, can be selected. The first uses edge detection,
the second a variance filter. Holes in the detected tissue are filled using morphological operations.
4. CONCLUSIONS
We provide solutions for image analysis and automation tasks in the form of ImageJ macro tool sets to the users
of our facility. We found the macro tool sets to be an appropriate tool for this purpose. For project management
and documentation we use the Redmine project management tool. A number of macro tool sets to for conversions
and workflow optimizations and a number of tool sets for biological image analysis have been developed by us
and are publicly available.
In the future we plan to combine this work with our central image database project ”Web Image and Data
Environment” and the project ”Remote ImageJ” in order to run batch image processing from client machines
and from a web application on distant server machines.
ACKNOWLEDGMENTS
I want to thank all scientists and engineers who participated in developing the biological image analysis tool sets.
REFERENCES
[1] M. D. Abramoff, P. J. Magelhaes, and S. J. Ram, “Image processing with ImageJ,” Biophotonics Interna-
tional 11, pp. 36–42, 2004.
[2] V. Baecker and P. Travo, “Cell image analyzer - a visual scripting interface for ImageJ and its usage at the
microscopy facility montpellier RIO imaging,” in Proceedings of the ImageJ User and Developer Conference,
pp. 105–110, Centre de Recherche Public Henri Tudor, (Luxembourg), 2006.
[3] T. A. Ferreira and W. Rasband, “The ImageJ user guide,” Tech. Rep. IJ 1.46, June 2012.
[4] “Technical proposal |developer.imagej.net.” http://developer.imagej.net/proposal.
[5] V. Baecker and P. Travo, “Remote ImageJ - running macros on a distant machine,” in Proceedings of
the ImageJ User and Developer Conference 2010, pp. 205–210, Centre de Recherche Public Henri Tudor,
(Luxembourg), 2010.
[6] “Overview - redmine.” http://www.redmine.org/.
[7] M. Linkert, C. T. Rueden, C. Allan, J. Burel, W. Moore, A. Patterson, B. Loranger, J. Moore, C. Neves,
D. Macdonald, A. Tarkowska, C. Sticco, E. Hill, M. Rossner, K. W. Eliceiri, and J. R. Swedlow, “Metadata
matters: access to image data in the real world,” The Journal of Cell Biology 189, pp. 777–782, May 2010.
PMID: 20513764.
[8] P. Dean, L. Mascio, D. Ow, D. Sudar, and J. Mullikin, “Proposed standard for image cytometry data files,”
Cytometry 11(5), pp. 561–569, 1990.
[9] “TIFF revision 6.0,” tech. rep., Adobe Developers Association, 1992.
[10] S. Beucher, “The watershed transformation applied to image segmentation,” Scanning Microscopy Interna-
tional 6, pp. 299–314, 1992.
[11] R. Fisher, S. Perkins, A. Walker, and E. Wolfart, “Spatial filters - gaussian smoothing.”
http://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm, 2003.
[12] J. Schanda, Colorimetry : understanding the CIE system, Wiley ; John Wiley [distributor], Hoboken, N.J.;
Chichester, 2007.
[13] E. M. M. Manders, F. J. Verbeek, and J. A. Aten, “Measurement of co-localization of objects in dual-colour
confocal images,” Journal of Microscopy 169, pp. 375–382, Mar. 1993.
[14] Y. Wang, K. Lee, and W. R. Ledoux, “Histomorphological evaluation of diabetic and non-diabetic plantar
soft tissue,” Foot & Ankle International / American Orthopaedic Foot and Ankle Society [and] Swiss Foot
and Ankle Society 32, pp. 802–810, Aug. 2011. PMID: 22049867.