(1) Overview
Introduction
Connected Component Analysis is a central part of many image processing pipelines. After object segmentation (e.g. by grey tone thresholding), the image is divided into foreground (object) and background pixels. For further processing, the connected regions of foreground pixels (called “blobs”) often have to be “extracted.” This process of labeling regions of connected foreground pixels is called “connected component labeling.” IJBlob implements the contour labeling algorithm described by Chang et al.[] and each region is described by its outer contour and inner contours (holes). This is useful since as soon as each object is defined individually by its contours, its properties can be easily described and processed separately. For this purpose, IJBlob provides some shape features to describe a blob like circularity, thinness ratio, elongation, orientation, Feret’s diameter, fractal box dimension, and the number of holes and region-based moments. It is possible to extend the provided features by its own features using the IJBlob extensions framework. With the inbuilt filter functionality, the connected region in an image scene can be filtered by the inbuilt and extended features. An ImageJ Plugin provides a GUI (Figure 1) for this functionality and is also available at http://code.google.com/p/ijblob. It is worth noting that the plugin also works with the ImageJ [] distribution Fiji [].
Filtering Blobs by Shape Features
If the filter is applied to a binary scene of several blobs, a resulting image is generated containing a set of remaining blobs. For each remaining blob, the features are calculated and filled into an ImageJ results table. A simple example illustrates the principal usage. In the following figure, all blobs with less than two holes should be removed.
The option ‘Num. of Holes’ is therefore set to ’2-infinity.’ Figure 3 gives the resulting image after the filter has been applied.
Figure 4 demonstrates the filtering of elongated blobs. The ImageJ sample image (Fig. 4a) is filtered with the objective of retaining only elongated blobs. In the first step, the image is segmented by thresholding it. Second, the border objects are removed because their shape cannot be meaningfully described. Finally, the Shape Filter is applied using an elongation range of 0.7-1.
In our working group the IJBlob library is a basic part of the development of new ImageJ Plugins for (i) diffraction pattern analysis of freely diffusing, as well as sedimented (possibly agglomerated), nanoparticles [][], (ii) leucocyte classification (in preparation) and (iii) particle form analysis [].
Implementation/architecture
The library was implemented in Java (1.7) using ImageJ Version 1.47h. The connected component labeling algorithm of Chang et al. [] is used to identify connected components. Most of the shape features are defined in Luciano’s “Shape Classification and Analysis” []. There is direct dependence between IJBlob and ImageJ, because the library works with the internal image representation used by ImageJ. However, the image representation is simple, making it easy to develop a simple converter which allows for the use of IJBlob in other projects. The features provided by IJBlob are:
- Centre of Gravity
- Enclosed Area
- Perimeter
- Perimeter of the Convex Hull
- Circularity & Thinness Ratio
- Feret Diameter
- Area/Perimeter Ratio
- Temperature of the Outer Contour
- Fractal Box Dimensions
- Moments and Central Moments
- Eigenvalue Major & Minor Axis
- Elongation
- Orientation
- Outer Contours as Freeman-Chain-Code
Please note, that all the features are defined online (https://code.google.com/p/ijblob/wiki/BasicFeatures).
The IJBlob extension framework allows for the increase of existing features by its own features. Therefore, a class has to be derived from the CustomBlobFeature class. The class can also contain multiple features. Using the “getBlob()” method, it is possible to obtain a reference to the Blob and gain full access to the contour data and the other features of the Blob. Finally, an instance of the feature class has to be added to the Blob class using the static method “addCustomFeature(...).” The feature is now accessible using the Blob method “evaluateCustomFeature.” If the return type of the custom feature methods is “Integer” or “Double,” these features could be used with inbuilt filter functionality.
Quality Control
Unit and functional testing have been carried out in Archlinux (64 bit), Ubuntu 13.04 (32 bit / 64 bit), Windows XP (32 bit), Windows Vista (32 bit) and Windows 7 (64 bit).
(2) Availability
Operating system
Linux, Windows XP / Vista / 7
Programming Language
Java 1.7
Dependencies
ImageJ 1.47
List of contributors
- Thorsten Wagner
- Hans-Gerd Lipinski
Archive
Name
Google Code
Persistent identifier
License
GNU General Public License version 3
Publisher
Thorsten Wagner
Date published
11/02/2012
Code repository
Name
Google Code
Identifier
License
GNU General Public License version 3
Date published
11/02/2012
Language
English
(3) Reuse potential
Connected component labeling is a central part of many image processing pipelines, such as object tracking, object matching or classification. Due to the broad range of possible application fields, the reuse potential seems to be high. Possible “general” fields are:
- Object tracking in image series: In segmented image series, it is often required to track an object over time [][] . Therefore, it is necessary to link an object from image to image. This can be done using the (i) distance (centroid to centroid), (ii) shape features or (iii) other texture based features. Imagine an image scene composed of moving rectangles and a single moving circle. It is easy to identify and track the circle using the circularity feature of its blob.
- Classification of blobs using their shape features: It is necessary to find suitable features for classification of the blobs. It is possible to use the inbuilt shape features of IJBlob or use own features via the extension framework for that purpose.
- Removing segmentation artefacts using shape features, e.g. removing blobs which are too elongated to be a “blob of interest”: This can be seen as a kind of classification; one class is “objects of interest” and the other is “artefacts.”
- Searching for all blobs with similar features (see the example presented in the introduction).