# Relative Area Fraction for Amira-Avizo2D

This Xtra provides a module to help compute the area fraction of a label over the area of another label in Amira-Avizo2D.

This Xtra provides a Python module * Label to Area* that, combined with the custom measure

**Area/Maximum**(let's just call it

*), enable the user to compute the area fraction of a label over the area of another label.*

**CustomAreaFraction****Definitions**

- Native measure
**Area Fraction**of**Analysis****A**, using**Image**as the*Intensity Image*input, will compute:

area of**A**/ area of**Image**. - Custom measure CustomAreaFraction, using the result of
*Label to Area*of**B***Intensity Image*input, will compute:

area of**A**/ area of**B**.__Note__: if**A**is completely included in**B**then the measure is equivalent to the relative area fraction of**A**to**B**.

**Example**

A 2D data *grains.png*, as well as an recipe *recipe.hxisp*, are provided to illustrate the combined use of these two tools to compute the custom area fraction through a very comprehensive use case.

The 2D data represents several grains of highly variable brightness.

The recipe will generate two segmentations out of this image:

- One segmentation contains only bright grains (grayscale value is greater than 127).
- One segmentation contains all the grains (grayscale value is greater than 2).

The label image with all the grains is then converted into a grayscale image by the module * Label to Area*.

Finally, by applying the measure

*CustomAreaFraction*to both the label image of the bright grains (

*Data*) and the grayscale image of all grains (

*Intensity Image*), the user will compute the area fraction of bright grains relatively to all grains.

One can eventually generalize this technique to compute any area fraction relatively to any binary image.

The Python module *Label to Area *has no specific port; it is just a single push button conversion module.

The custom measure Area/Maximum (aka *CustomAreaFraction*) must be created manually by the user.