# Operators/Features/MorphologyAnalyzer2D: Difference between revisions

The MorphologyAnalyer2D operator implements a large collection of features to characterize the shape of image regions.

#### Name of Plugin/Operator

 de.unihalle.informatik.MiToBo.features.MorphologyAnalyzer2D 

#### Latest News

The MorphologyAnalyzer2D is currently under active development. Some of the features already documented below will become available
in the next version 1.8.6 of MiToBo which is to be released soon.

#### Main features

• extracts a large collection of features to characterize region shape and morphology
• handles different types of input, i.e., label images and ImageJ ROIs
• optionally provides visualization of extracted features

#### Usage

To run the MorphologyAnalyzer2D perform the following steps:

• install MiToBo by following the instructions on the Installation page
• run MiToBo and start the operator runner by selecting the menu item MiToBo Runner from Plugins -> MiToBo
• in the selection menu navigate to 'de.unihalle.informatik.MiToBo.features' and select the operator MorphologyAnalyzer2D

This will bring up the operator window of the MorphologyAnalyzer2D.

##### Input data

The operator supports two different types of input data:

• label image: an image where for each region the pixels are expected to be uniquely labeled, i.e. all have the same intensity value; all pixels being labeled with 0 are treated as background
• regions (in ImageJ ROI format): here regions can directly be imported from ImageJ's ROI manager or be read from ROI files in specific formats from disk; also manual input of region data is supported
##### Calibration information

Many of the features refer to measuring lengths or areas of region entities. The units to be used for these measurements can freely be configured.
If appropriate calibration data is available from the given input data, e.g., as meta information in a label image, this data is automatically used and displayed.
But, the user can overwrite the calibration by manually specifiying the size of a pixel in the desired units.
E.g., with regard to microscopy images a common unit are microns and a proper calibration requires to provide information on the size of a pixel in microns.

Important note:
The operator always assumes square pixels, i.e. the pixel lengths in x and y dimension are assumed to be equal.
If this does not hold for an image or ROI data some of the feature values will be incorrect!

Lengths are first measured in pixels by the operator and areas in square pixels. Subsequently the numbers are then converted to the specified units, e.g., converted to microns or square microns based on the given size of a pixel.

##### Configuration of features to extract

The configuration window allows to select and configure the set of features to be extracted:

 Name of Option Description Calculate area Activates area feature $\scriptstyle A(R)$ which is measured in terms of the number of pixels in a region. Calculate perimeter Activates perimeter feature $\scriptstyle P(R)$ which is calculated from the 8-neighborhood contour of the region; the contour is extracted and then traced pixel by pixel where each horizontal or vertical step yields a distance of 1 and each diagonal step a distance of $\scriptstyle \sqrt{2}$; the result for the region perimeter is given by the sum of all distances between pairs of neighboring pixels along the contour. Calculate length and width Activates calculation of length $\scriptstyle L(R)$ and width $\scriptstyle W(R)$ of a region. The length and width of a region can be interpreted as twice the lengths of the major and minor axes of an ellipse fit to the region pixels. They are calculated as follows:$\scriptstyle L(R) = 2 \cdot \sqrt{\frac{2\cdot \left( \mu_{2,0} + \mu_{0,2} + \sqrt{ (\mu_{2,0}-\mu_{0,2})^2+4\mu_{1,1}^2}\right)}{\mu_{0,0}}}$ and $\scriptstyle W(R) = 2 \cdot \sqrt{\frac{2\cdot \left( \mu_{2,0} + \mu_{0,2} - \sqrt{(\mu_{2,0}-\mu_{0,2})^2+4\mu_{1,1}^2}\right)}{\mu_{0,0}}}$The $\scriptstyle \mu_{k,l}$ are central moments, $\scriptstyle \mu_{k,l} = \sum_{(x,y) \in R} (x- \bar{x})^k (y-\bar{y})^l$, with $\scriptstyle (\bar{x},\bar{y})$ being the centroid of the region. For further details refer to R. Prokop/A. Reeves, A Survey of Moment-Based Techniques for Unoccluded Object Representation and Recognition, Graphical Models and Image Processing (CVGIP), pp. 438-460, 1992. Calculate circularity Activates the circularity feature $\scriptstyle C(R)$ which is calculated from region area and perimeter as follows: $\scriptstyle C(R) = \frac{4 \pi A(R)}{P(R)^2}$. Calculate eccentricity Activates the eccentricity feature $\scriptstyle E(R)$ which is calculated based on region moments as follows: $\scriptstyle E(R) = \frac{(\mu_{2,0}-\mu_{0,2})^2+4\mu_{1,1}^2}{\mu_{2,0} + \mu_{0,2}}$. Calculate solidity Activates the solidity feature which is defined as $\scriptstyle S(R) = \frac{A(R)}{A_{CH}(R)}$ where $\scriptstyle A_{CH}$ is the area of the convex hull of the region. Calculate margin roughness Activates the margin roughness feature which quantifies the deviation of the average curvature of the region contour compared to a perfect circle. For further details refer to T. McLellan, J. Endler, The Relative Success of Some Methods for Measuring and Describing the Shape of Complex Objects, Systematic Biology, Vol. 47, No. 2, pp. 264-281, June 1998. Analyze protrusions and indentations Activates the analysis of convex sections (indentations) and concave sections (protrusions) along a contour. This analysis results in 12 features: NumberOfProtrusions - number of protrusions (and also indentations) along the contour NonProtrusionArea - area of region not belonging to any protrusion AvgLengthProtrusions - average height of all protrusions, the height is measured as maximal distance from baseline to contour AvgLengthApicalProtrusions - average height of upper parts of protrusions, i.e. average distances between equators and contours AvgLengthBasalProtrusions - average height of lower parts of protrusions, i.e. average distances between baselines and equators AvgLengthBaselineProtrusions - average length of the baselines of all protrusions AvgLengthEquatorProtrusions - average length of the equators of all protrusions AvgLengthIndentations - average height of all indentations, the height is measured as maximal distance from baseline to contour AvgLengthApicalIndentations - average height of upper parts of indentations, i.e. average distances between equators and contours AvgLengthBasalIndentations - average height of lower parts of indentations, i.e. average distances between baselines and equators AvgLengthBaselineIndentations - average length of the baselines of all indentations AvgLengthEquatorIndentations - average length of the equators of all indentations The analysis can be configured with additional configuration parameters: Minimal curvature: pixels with a local curvature below this value are not considered Gaussian standard deviation in curvature analysis: extracted curvature values are smoothed for robustness, here you can adjust the Gaussian kernel used for that Minimal length of a protrusion section: a concave contour segment is only accepted as real protrusion if its length exceeds this number of pixels Minimal length of an indentation section: a concave contour segment is only accepted as real indentation if its length exceeds this number of pixels Calculate skeleton branch features Activates extraction of various features from the skeleton of a region. This analysis results in 6 features: BranchCount - number of branches in the skeleton AvgBranchLength - average length of all branches AvgDistBranchEndpointsToBackground - average distance of end-points of the skeleton to the background LongestPathLength - length of the longest path in the skeleton between any two end-points MinCoreRegionWidth - approximation for the width of the region at the narrowest part (in the core region) MaxCoreRegionWidth - approximation for the height of the region at the widest part (in the core region) Calculate concavity information Activates the extraction of two features based on a local concavity measure: AvgConcavity - average value of the concavity along the complete contour StdDevConcavity - standard deviation of the concavity along the complete contour The analysis can be configured with additional configuration parameters: Concavity Masksize: size of local neighborhood considered for estimating local concavity at a certain position For further details refer to H. Freeman, L.S. Davis, "A Corner-Finding Algorithm for Chain-Coded Curves," IEEE Transactions on Computers, vol. 26, no. 3, pp. 297-303, March 1977. Calculate convex hull measures Activates the extraction of some features based on the convex hull of a region: ConvexHullArea - area $\scriptstyle A_{CH}(R)$ of the convex hull of the region ConvexHullPerimeter - perimeter $\scriptstyle P_{CH}(R)$ of the convex hull ConvexHullConvexity - convexity of the region, defined as $\scriptstyle conv(R) = \frac{P_{CH}(R)}{P(R)}$ ConvexHullRoundness - roundness of the region, i.e. the circularity of the region but related to its convex hull: $\scriptstyle round(R) = \frac{4 \pi A(R)}{P_{CH}(R)^2}$. The convex hull of a region is calculated using the Jarvis-March-Algorithm.

In addition to these parameters for configuring which features to extract some more optional parameters are provided which do not have any influence on the feature extraction, i.e. do not change the results:

 Name of Option Description Fractional digits allows to specify the accuracy in calculating features, i.e. the number of decimal places used in the result tables Show curvature analysis info image? if enabled, an additional result image is generated visualizing features based on curvature Show skeleton analysis info image? if enabled, an additional result image is generated visualizing skeleton features Verbose turns on output of additional debug messages; the messages are shown in the console

Note that some of the features depend on others, e.g., extracting the circularity automatically results in extracting region area and perimeter as well.

##### Result data

The operator basically returns a data table. Each row in the table refers to one region, each column to a certain feature.
Note that the first column contains the index of the region as it is extracted from the label image or region set.
If additional result data, e.g. images for visualizing curvature or skeleton information, have been requested, these are also generated by the operator.