```{index} single: Filters; Erode/Dilate Mask
```
# Erode/Dilate Mask

## Group (Subgroup)

Processing (Cleanup)

## Description

If the mask is _dilated_, the **Filter** grows the _true_ regions by one **Cell** in an iterative sequence for a user
defined number of iterations. During the _dilate_ process, the classification of any **Cell** neighboring a _false_ *
*Cell** will be changed to _true_. If the mask is _eroded_, the **Filter** shrinks the _true_ regions by one **Cell** in
an iterative sequence for a user defined number of iterations. During the _erode_ process, the classification of the
*false* **Cells** is changed to _true_ if one of its neighbors is _true_. The **Filter** also offers the option(s) to
turn on/off the erosion or dilation in specific directions (X, Y or Z).

This filter will ONLY change the _Mask_ data array and not any of the other data arrays in the same attribute matrix.

The example images below were generated **AFTER** the execution of the filter and essentially any black pixel is where the **Mask** was false and any other color is where the **Mask** is true. (The colors are the typical IPF Colors using a <001> reference direction)

| Before Dilatation                      | After Dilation                       |
|--------------------------------------|--------------------------------------|
| ![](Images/ErodeDilateMask_Before.png) | ![](Images/ErodeDilateMask_Dilate.png) |

| Before Erosion                      | After Erosion                       |
|--------------------------------------|--------------------------------------|
| ![](Images/ErodeDilateMask_Before.png) | ![](Images/ErodeDilateMask_Erode.png) |


### Input Parameter(s)

| Parameter Name | Parameter Type | Parameter Notes | Description |
|----------------|----------------|-----------------|-------------|
| Operation | Choices |  | Whether to dilate (0) or erode (1) |
| Number of Iterations | Scalar Value |Int32 | Number of erode/dilate iterations to perform |
| X Direction | Bool |  | Whether to erode/dilate in the X direction |
| Y Direction | Bool |  | Whether to erode/dilate in the Y direction |
| Z Direction | Bool |  | Whether to erode/dilate in the Z direction |

### Input Cell Data

| Parameter Name | Parameter Type | Parameter Notes | Description |
|----------------|----------------|-----------------|-------------|
| Selected Image Geometry | Geometry Selection | Image | The target geometry |
| Mask Array Path | Array Selection | Allowed Types: boolean Comp. Shape: 1 | Boolean array where true voxels are used. False voxels are ignored. |

## Example Pipelines

## 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.
