IJ Blob
IJBlob (ImageJ/Fiji) | |
---|---|
Author | Thorsten Wagner |
Maintainer | Thorsten Wagner (wagner@biomedical-imaging.de) |
File | ij-blob.jar [1] |
Source | Github [2] |
Latest version | v1.4.5 (21 Sep 2015) (API) |
Development status | active |
Contents
Purpose
The IJBlob library indentifying connected components in binary images. The algorithm used for connected component labeling is:
Chang, F. (2004). A linear-time component-labeling algorithm using contour tracing technique. Computer Vision and Image Understanding, 93(2), 206–220. doi:10.1016/j.cviu.2003.09.002
A connected component is a set of pixels which are connected by its 8-neigherhood and is often called a "blob". An Example:
The image above contains 8 marked blobs. Also the holes (and the contours of the holes) of the two Bs and the O are identified. It is also possible to get a color labeled image:
In addition ijblob identifies nested objects:
If you are using IJBlob in a scientific publication, please cite:
Wagner, T and Lipinski, H 2013. IJBlob: An ImageJ Library for Connected Component Analysis and Shape Analysis. Journal of Open Research Software 1(1):e6, DOI: http://dx.doi.org/10.5334/jors.ae
The Shape Filter plugin uses the ij-blob library to characterize and filter objects in binary scenes by its shape. Therefore, several features are calculated as shown below.
Features of IJBlob
- Filter Framework
- Extract the outer contour of each blob.
- Extracts also all inner contours of each blob (holes).
- Detects nested objects (blob in blob).
- Many shape features
Shape Features
- Area (): The area enclosed by the outer contour of an object.
- Area Convex Hull (): The area enclosed by the convex hull of the outer contour of an object.
- Perimeter (): The perimeter of the outer contour of an object.
- Perimeter Convex Hull (): The perimeter of the convex hull of the particle.
- Feret Diameter: The maximum distance between the two parallel tangents touching the particle outline in all directions.
- Min. Feret Diameter: the minimum distance between the two parallel tangents touching the particle outline in all directions.
- Max. Inscr. Circle Diameter: The diameter of the maximum inscribed circle.
- Long Side Minimum Bounding Rectangle: The larger side of the minimum bounding rectangle.
- Short Side Minimum Bounding Rectangle: The smaller side of the minimum bounding rectangle.
- Aspect Ratio: Defined as
- Area to Perimeter Ratio: Defined as
- Circularity: Defined as
- Elongation: Defined as
- Convexity: Defined as
- Solidity: Defined as
- Number of Holes: The number of holes inside an object.
- Thinnes Ratio: Inverse proportional to the circularity. Furthermore it normed. It is defined as
- Contour Temperatur: It has a strong relationship to the fractal dimension, defined as
- Orientation: The orientation of the major axis from in grad (measured counter clockwise from the positive x axis).
- Fractal Box Dimension: Estimated fractal dimension by the box count algorithm. The default box-sizes are “2,3,4,6,8,12,16,32,64”.
Examples
Example 1: Extract the connected components of an image and read the perimeter of a blob
import ij.blob.*;
...
private ManyBlobs allBlobs;
...
public void someMethod(ImagePlus imp) {
ManyBlobs allBlobs = new ManyBlobs(imp); // Extended ArrayList
allBlobs.findConnectedComponents(); // Start the Connected Component Algorithm
allBlobs.get(0).getPerimeter(); // Read the perimeter of a Blob
}
Example 2: Example 2: Filter blobs by blob features
In IJBlob 1.1 a filter framework was introduced. Each build-in blob feature has a static identifier (in this example "GETENCLOSEDAREA") which contains the method name.
import ij.blob.*;
...
private ManyBlobs allBlobs;
...
public void someMethod(ImagePlus imp) {
/* Extended ArrayList */
ManyBlobs allBlobs = new ManyBlobs(imp);
/* Start the Connected Component Algorithm */
allBlobs.findConnectedComponents();
/* Return all blobs with an area between 20 and 100 pixel² */
ManyBlobs filteredBlobs = allBlobs.filterBlobs(20,100,
Blob.GETENCLOSEDAREA);
}
Example 3: Add your own features
IJBlob 1.1 is easily expandable by your own features. First you have to derive a feature class from the "CustomBlobFeature" class. The feature class can also contain multiple features. With the "getBlob()" method you get the reference to the Blob and have full access to the contour data and the other features. Please note: If your feature method have primitive data types (int/float/double) as parameters you have to use the wrapper classes (Integer/Float/Double).
import ij.blob.*;
public class ExampleBlobFeature extends CustomBlobFeature {
public double myFancyFeature(Integer a, Float b){
double feature = b*getBlob().getEnclosedArea()*a;
return feature;
}
public int mySecondFancyFeature(Integer a, Double b){
int feature = (int)(b*getBlob().getAreaToPerimeterRatio() *a);
return feature;
}
}