```{index} single: Filters; Compute Euclidean Distance Map
```
# Compute Euclidean Distance Map

## Group (Subgroup)

Statistics (Morphological)

## Description

This **Filter** calculates the distance of each **Cell** from the nearest **Feature** boundary, **triple line** and/or **quadruple point**.  The following algorithm explains the process:

1. Find the **Feature** that owns each **Cell** and its six face-face neighbors of each **Cell**
2. For all **Cells** that have *at least 2* different neighbors, set their *GBEuclideanDistance* to *0*.  For all **Cells** that have *at least 3* different neighbors, set their *TJEuclideanDistance* to *0*.  For all **Cells** that have *at least 4* different neighbors, set their *QPEuclideanDistance* to *0*
3. For each of the three *EuclideanDistace* maps, iteratively "grow" out from the **Cells** identified to have a distance of *0* by the following sub-steps:

- Determine the **Cells** that neighbor a **Cell** of distance *0* in the current map.
- Assign a distance of *1* to those **Cells** and list the *0* **Cell** neighbor as their *nearest neighbor*
- Repeat previous two sub-steps, increasing the distances by *1* each iteration, until no **Cells** remain without a distance and *nearest neighbor* assigned.

    *Note:* the distances calculated at this point are "city-block" distances and not "shortest distance" distances.

4. If the option *Calculate Manhattan Distance* is *false*, then the "city-block" distances are overwritten with the *Euclidean Distance* from the **Cell** to its *nearest neighbor* **Cell** and stored in a *float* array instead of an *integer* array.


### Input Parameter(s)

| Parameter Name | Parameter Type | Parameter Notes | Description |
|----------------|----------------|-----------------|-------------|
| Output arrays are Manhattan distance (int32) | Bool |  | If Manhattan distance is used then results are stored as int32 otherwise results are stored as float32 |
| Calculate Distance to Boundaries | Bool |  | Whether the distance of each Cell to a Feature boundary is calculated |
| Calculate Distance to Triple Lines | Bool |  | Whether the distance of each Cell to a triple line between Features is calculated |
| Calculate Distance to Quadruple Points | Bool |  | Whether the distance of each Cell to a quadruple point between Features is calculated |
| Store the Nearest Boundary Cells | Bool |  | Whether to store the nearest neighbors of Cell |

### Input Cell Data

| Parameter Name | Parameter Type | Parameter Notes | Description |
|----------------|----------------|-----------------|-------------|
| Selected Image Geometry | Geometry Selection | Image | The target geometry |
| Cell Feature Ids | Array Selection | Allowed Types: int32 Comp. Shape: 1 | Specifies to which feature each cell belongs. |

### Output Cell Data

| Parameter Name | Parameter Type | Parameter Notes | Description |
|----------------|----------------|-----------------|-------------|
| Boundary Distances | DataObjectName |  | The name of the array with the distance the cells are from the boundary of the Feature they belong to. |
| Triple Line Distances | DataObjectName |  | The name of the array with the distance the cells are from a triple junction of Features. |
| Quadruple Point Distances | DataObjectName |  | The name of the array with the distance the cells are from a quadruple point of Features. |
| Nearest Boundary Cells | DataObjectName |  | The name of the array with the indices of the closest cell that touches a boundary, triple and quadruple point for each cell. |

## Example Pipelines

- (01) SmallIN100 Morphological Statistics

## License & Copyright

Please see the description file distributed with this **Plugin**

## DREAM3D-NX Help

If you need help, need to file a bug report or want to request a new feature, please head over to the [DREAM3DNX-Issues](https://github.com/BlueQuartzSoftware/DREAM3DNX-Issues/discussions) GitHub site where the community of DREAM3D-NX users can help answer your questions.
