MaskDilation<T>

Models & Types · AiDotNet.Diffusion.MaskUtilities

Dilates a mask by expanding masked regions, filling small holes and connecting nearby regions.

Implements: IDataTransformer<T, Tensor<T>, Tensor<T>>

For Beginners

Dilation makes the white (masked) area larger. If your mask has small gaps or holes, dilation fills them in. It’s like “padding” the edge of the masked region outward. Often used with erosion for mask cleanup.

How It Works

Morphological dilation expands white (masked) regions by taking the maximum value in a local neighborhood. This fills small holes, connects nearby components, and grows mask boundaries outward.

Constructors

Constructor Summary
MaskDilation(int kernelSize) Initializes a new instance of the MaskDilation class.

Properties

Property Summary
bool IsFitted { get; }
bool SupportsInverseTransform { get; }
int[] ColumnIndices { get; }

Methods

Method Summary
Tensor<T> Apply(Tensor<T> mask) Applies morphological dilation to a mask tensor.
Tensor<T> FitTransform(Tensor<T> data)
Tensor<T> InverseTransform(Tensor<T> data)
Tensor<T> Transform(Tensor<T> data)
string[] GetFeatureNamesOut(string[] inputFeatureNames)
void Fit(Tensor<T> data)