BLOB Function
Standard Library function that identifies a homogeneous region in an array.
Usage
result = BLOB(a, i, b)
Input Parameters
a—An n-dimensional array.
i—A vector of n integers defining a seed element for the region.
b—A two-element vector defining bounds for values in the region.
Returned Value
result—An (m,n) array of m n-dimensional indices into a. result defines the maximal region, containing i, whose values lie in the range [b(0), b(1)]. If no such region exists then result is returned as –1.
Keywords
K—A positive integer (less than or equal to n) controlling connectivity: Two cells are connected if they share a common boundary point, and if their centroids are within the square root of K of each other. K = 1 by default, which implies connected cells share a common face.
Ulim—Scalar defining upper limit for the number of elements in the region: The region growing algorithm stops and returns –1 if the region becomes bigger than Ulim elements. This keyword limits wasted computation in cases where regions of limited size are sought.
In1d—If In1d is set then the output is in 1-dimensional instead of n-dimensional indices.
Discussion
BLOB generalizes the common image processing operation of region growing to ND arrays. Given an ND array A and element R(0) such that A(R(0)) is contained within some specified closed interval I, the algorithm recursively finds the connected region R(i) which consists of the array elements R(i – 1) and their neighboring elements whose values lie in the interval I. The algorithm stops when no new neighbors are found, e.g. when R(i) = R(i – 1). Connectivity is defined by representing the array as a collection of unit N-cubes, where by default connected array cells share a common face: that is, their centroids are unit distance apart. Higher values of keyword K relax the definition of connectivity. In a 3D array for example, K = 2 admits both face-wise and edge-wise connectivity, and K = 3 admits face-wise, edge-wise, and corner-wise connectivity. For maximum efficiency, use keyword In1d so that the output is in 1D indices.
Example 1
; Create and display a 2-d array c, and color the element
; (300,200)
c = DIST(640,512)
TVSCL, c
PLOTS, 300, 200, /Device, Color=255, Psym=2
; Grow the region containing (300,200), in range
; c(300,200)-[4,-4]
j = BLOB( c, [300,200], c(300,200)-[4,-4] )
; Display the region
PLOTS, j(*,0), j(*,1), /Device, Color=255, Psym=3
Example 2
See wave/lib/user/examples/blob_grow.pro
This 2D example is similar to the previous one, but here the user can choose the input image and the connectivity parameter and can interactively select the seed and bounding interval.
See Also