skimage2.morphology.diameter_opening#
- skimage2.morphology.diameter_opening(image, diameter_threshold=8, connectivity=1, parent=None, tree_traverser=None)[source]#
Perform a diameter opening of the image.
Diameter opening removes all bright structures of an image with maximal extension smaller than diameter_threshold. The maximal extension is defined as the maximal extension of the bounding box. The operator is also called Bounding Box Opening. In practice, the result is similar to a morphological opening, but long and thin structures are not removed.
Technically, this operator is based on the max-tree representation of the image.
- Parameters:
- imagendarray
The input image for which the area_opening is to be calculated. This image can be of any type.
- diameter_thresholdunsigned int
The maximal extension parameter (number of pixels). The default value is 8.
- connectivityunsigned int, optional
The neighborhood connectivity. The integer represents the maximum number of orthogonal steps to reach a neighbor. In 2D, it is 1 for a 4-neighborhood and 2 for a 8-neighborhood. Default value is 1.
- parentndarray, int64, optional
Parent image representing the max tree of the image. The value of each pixel is the index of its parent in the ravelled array.
- tree_traverser1D array, int64, optional
The ordered pixel indices (referring to the ravelled array). The pixels are ordered such that every pixel is preceded by its parent (except for the root which has no parent).
- Returns:
- outputndarray
Output image of the same shape and type as the input image.
See also
References
[1]Walter, T., & Klein, J.-C. (2002). Automatic Detection of Microaneurysms in Color Fundus Images of the Human Retina by Means of the Bounding Box Closing. In A. Colosimo, P. Sirabella, A. Giuliani (Eds.), Medical Data Analysis. Lecture Notes in Computer Science, vol 2526, pp. 210-220. Springer Berlin Heidelberg. DOI:10.1007/3-540-36104-9_23
[2]Carlinet, E., & Geraud, T. (2014). A Comparative Review of Component Tree Computation Algorithms. IEEE Transactions on Image Processing, 23(9), 3885-3895. DOI:10.1109/TIP.2014.2336551
Examples
We create an image (quadratic function with a maximum in the center and 4 additional local maxima.
>>> w = 12 >>> x, y = np.mgrid[0:w,0:w] >>> f = 20 - 0.2*((x - w/2)**2 + (y-w/2)**2) >>> f[2:3,1:5] = 40; f[2:4,9:11] = 60; f[9:11,2:4] = 80 >>> f[9:10,9:11] = 100; f[10,10] = 100 >>> f = f.astype(int)
We can calculate the diameter opening:
>>> open = diameter_opening(f, 3, connectivity=1)
The peaks with a maximal extension of 2 or less are removed. The remaining peaks have all a maximal extension of at least 3.