# Changes

## MorphoLibJ

, 13:03, 30 August 2016
Fix redundant code for references
[[Image:MorphoLibJ-Euler-number.png|thumb|400px|Illustration of Euler Number definition. Left: three particles with Euler numbers equal to 1, 0 and -1, respectively. Right: example of a 3D particle with an Euler number equal to -1, corresponding to the subtraction of 1 connected components minus two handles.]]The intrinsic volumes are a set of features with interesting mathematical properties that are commonly used for describing individual particles as well as binary microstructrues. In the planar case, they correspond to the area, the perimeter and the Euler number. The Euler number is a topological characteristic that equals the number of connected components minus the number of holes.
For 3D particles, intrinsic volumes correspond to the volume, the surface area, the mean breadth (a quantity proportional to the integral of the mean curvature over the surface) and the Euler number. In 3D the Euler number equals the number of connected components minus the number of "handles" or "tunnels" through the structure, plus the number of bubbles within the particles (Serra, 1982<ref name="Serra1982>{{ cite book| title = Image Analysis and Mathematical Morphology. Volume 1| author = Serra, Jean| publisher = Academic Press| year = 1982}}</ref>; Ohser ''et al.'', 2009<ref name="Osher2009>{{ cite conference
| title = 3D Images of Materials Structures: processing and analysis
| author = Joachim Ohser and Katja Schladitz
In image analysis, the '''estimation of area''' of 2D particles and of '''volume of 3D particles''' simply consists in counting the number of pixels or voxels that constitute it, weighted by the area of an individual pixel or the volume of an individual voxel.
The implemented method for '''perimeter measurement''' aims at providing a better estimate of the perimeter than traditional boundary pixel count. The principle is to consider a set of lines with various orientations, and to count the number of intersections with the region(s) of interest (see figure on the right). The number of intersections is proportional to the perimeter (Serra, 1982<ref name="Serra1982>{{ cite book| title = Image Analysis and Mathematical Morphology. Volume 1| author = Serra, Jean| publisher = Academic Press| year = 1982}}</ref>; Legland ''et al.'', 2007<ref name="Legland2007">
{{cite conference
|title = Computation of Minkowski measures on 2D and 3D binary images
|doi = 10.5566/ias.v26.p83-92
|url = http://www.ias-iss.org/ojs/IAS/article/view/811
}}</ref>; Ohser ''et al.'', 2009<ref name="Osher2009>{{ cite conference| title = 3D Images of Materials Structures: processing and analysis| author = Joachim Ohser and Katja Schladitz| publisher = WILEY-VCH Verlag GmbH \& Co. KGaA, Weinheim| year = 2009| isbn = 978-3-527-31203-0}}</ref>). By averaging over all possible directions, the estimate is unbiased.
Perimeter can be estimated using either two directions (horizontal and vertical), or four directions (by adding the diagonals). Restricting the number of directions introduces an estimation bias, with known theoretical bounds (Moran, 1966<ref name="Moran1966">
|doi = 10.1093/biomet/53.3-4.359
|URL = http://biomet.oxfordjournals.org/content/53/3-4/359.abstract
}}</ref>; Legland ''et al.'', 2007<ref name="Legland2007">{{cite conference|title = Computation of Minkowski measures on 2D and 3D binary images|author = Legland, David and Kiêu, Kiên and Devaux, Marie-Françoise|journal = Image Analysis and Stereology|year = 2007|month = June|number = 6|pages = 83-92|volume = 26|doi = 10.5566/ias.v26.p83-92|url = http://www.ias-iss.org/ojs/IAS/article/view/811}}</ref>), that is usually better than boundary pixel count (Lehmann ''et al.'', 2012<ref name="Lehmann2012">{{cite conferencejournal
|title = Efficient N-Dimensional surface estimation using [[wikipedia:Crofton formula|Crofton formula]] and run-length encoding
|author = Lehmann, Gaetan and Legland, David
}}</ref>).
The '''estimation of surface area''' follows the same principle. The number of directions is typically chosen equal to 3 (the three main axes in image), or 13 (by considering also diagonals). As for perimeter estimation, surface area estimation in usually biased, but is usually more precise than measuring the surface area of the polygonal mesh reconstructed from binary images (Lehmann ''et al.'', 2012<ref name="Lehmann2012">{{cite conference|title = Efficient N-Dimensional surface estimation using [[wikipedia:Crofton formula|Crofton formula]] and run-length encoding|author = Lehmann, Gaetan and Legland, David|journal = Insight Journal|year = 2012|pages = 1-11|url = http://hdl.handle.net/10380/3342}}</ref>).
=====Euler number=====
The measurement of Euler number depends on the choice of the connectivity. For planar images, typical choices are the 4-connectivity, corresponding to the orthogonal neighbors, and the 8-connectivity, that also considers the diagonal neighbors. In 3D, the 6-connectivity considers the neighbors in the three main directions within the image, whereas the 26 connectivity also considers the diagonals. Other connectivities have been proposed but are not implemented in MorphoLibJ (Ohser ''et al.'', 2009<ref name="Osher2009>{{ cite conference| title = 3D Images of Materials Structures: processing and analysis| author = Joachim Ohser and Katja Schladitz| publisher = WILEY-VCH Verlag GmbH \& Co. KGaA, Weinheim| year = 2009| isbn = 978-3-527-31203-0}}</ref>).
In the current implementation in MorphoLibJ, the Euler number is not taken into account for intersection of particles with image borders. This may result in non-integer result if the particle(s) of interest touches the image border.
::::::::$circularity=4\pi\frac{A}{P^{2}}$
While values of circularity range theoretically within the interval $[0;1]$, the measurements errors of the perimeter may produce circularity values above 1 (Lehmann ''et al.'', 2012<ref name="Lehmann2012">{{cite conference|title = Efficient N-Dimensional surface estimation using [[wikipedia:Crofton formula|Crofton formula]] and run-length encoding|author = Lehmann, Gaetan and Legland, David|journal = Insight Journal|year = 2012|pages = 1-11|url = http://hdl.handle.net/10380/3342}}</ref>). The MorphoLibJ library also considers the inverse of the circularity, referred to as "elongation index". The values of elongation range from 1 for round particles and increase for elongated particles.
::::::::$elongation = \frac{P^{2}}{4\pi\cdot A}$
* '''yi''': the y-coordinate of the inscribed circle.