Category
Function
Filters a field.
Syntax
output = Filter(input, filter, component, mask);
Inputs
Name  Type  Default  Description 

input  field  none  data to be filtered 
filter  value or string  "gaussian"  filter to be used 
component  string  "data"  component to be operated on 
mask  value or string  "box"  rankvalue filter mask 
Outputs
Name  Type  Description 

output  field  filtered data 
Functional Details
The specified filter can be convolution or rankvalue type.
Convolution filters, as the name implies, perform a convolution of the filter coefficients with the input data (i.e., the output value at a given point is the sum of the product of the filter coefficients and the corresponding values neighboring the point in question).
Rankvalue filters sort all of the elements under a mask surrounding the point in question and either select or interpolate the value specified by the given rank. For "min," "max," and "median" (special cases of rankvalue filters), the rank values are respectively 1, n, and (n + 1)/2, where n is the number of nonzero elements in the mask.
Convolution filters are useful for neighborhood smoothing, edge detection, and other gradientbased operations. Rankvalue filters are useful for randomnoise removal and morphological operations.
input  is the object to be filtered. Each field containing the component to be filtered must also contain both a "positions" and a "connections" component. The "connections" component must be regular. 
filter  specifies, by name, the filter to be used on input. See Table 2 for valid names. 
component  specifies the field component to be filtered. By default, Filter operates on "data." To filter an image, this parameter should specify "colors." If the component to be filtered contains several channels (e.g., red, green, and blue in an image), each channel is filtered independently. 
Table 2 defines the filters and masks that can be
specified by name.
While most of these are 2dimensional, some are also available in 1 and
3dimensional versions (as indicated by "1d" or "3d" after
their names).
If possible, the module selects a filter that matches the dimensionality
of input.
However, if a filter of lower dimensionality is available, it can (and
must) be specified by appending "1d" or "2d"
to the name.
That is, to specify a filter of lower dimensionality, the specification
must be explicit.
The names listed here are all valid specifications for the filter parameter. The specification is not case sensitive.  
Filter Name  Description 

4connected  [ [0 1 0] [1 1 1] [0 1 0] ] / 5 
8connected  [ [ 1 1 1 ][ 1 1 1 ][ 1 1 1 ] ] / 9 = box:2d 
6connected  3D analog of 4connected 
26connected  3D analog of 8connected 
box  Box filter 
box:1d 

box:2d 

box:3d 

compass:e  
compass:n  
compass:ne  
compass:nw  
compass:s  
compass:se  
compass:sw  
compass:w  
gaussian  Same as gaussian:3x3 
gaussian:2d  Same as gaussian:3x3; can be used to force a 2D gaussian to be applied to 3D data. 
gaussian:3x3  3 × 3 Gaussian, σ. = 1.0 
gaussian:5x5  5 × 5 Gaussian, σ. = 1.0 
gaussian:7x7  7 × 7 Gaussian, σ. = 1.0 
isotropic  
kirsch  
laplacian  Same as laplacian:2d 
laplacian:1d  
laplacian:2d  
laplacian:3d  
line:ew  
line:ns  
line:nesw  
line:nwse  
prewitt  
roberts  
smoothed  Same as prewitt 
sobel

Notes:
Masks, like filters, must have odd dimensions (e.g., 5 × 5). When specifying a mask, remember that nonzero elements in the mask matrix signify inclusion; zeros signify exclusion. In this way, the builtin matrices (e.g., "box") can be used interchangeably as filters or masks.
Components
Modifies the component specified by component. All other input components are propagated to the output.
Example Visual Program
UsingFilter.net
See Also
[ OpenDX Home at IBM  OpenDX.org ]