List of my modules...
Module: Fill_Holes
Description:
From an input 3D grayscale image and a threshold parameter, which defines which pixels belong to the object represented in the picture (i.e. if a pixel's intensity is greater of equal to the threshold, then this pixel belongs to the object. Otherwise, it belongs to the background), this module fills the cavities (or holes) in the image with the specified fill value. A cavity, loosely speaking, is a connected component of the background inside a connected component of the foreground.
Left : original image. Right : image with the holes filled in.
A size interval can be specified so that only holes with a given amount of pixels are filled. The connectivity type is also specified for the background (6-, 18-, or 26- connectivity). If you're not sure about this, choose 6-connectivity.
Now a cavity has no contact with the oustide of the object or foreground, but in certain cases, in certain images, there are holes to be filled that are either on the side of image or, more generally, in contact with the image border. So an "Border contact" option is given in case these connected component of the background need to be considered in the computation.
NOTE
This is a 3D process only. Which means that if you try to use it on a 2D image, i.e. a 3D image of depth 1, all the "cavities" in 2D are actually connected to the outside background, so you have to tick the border contact option.
Connections:
Image
[required]
The input image comes in through this port. For now, the only input type that has been implemented is HxUniformScalarField3.
Ports:
Threshold

This is the threshold on the gray values that seperates the pixels of the object from the pixels of the background.
Comparison

How the threshold value is used to define pixels of the object. If it satisfied the comparison with the threshold, then it defined the pixels of the object.
Note that the pixels of the holes to fill do NOT satisfy this condition, it is the object that has holes in it that does.
Hole size

Specifies an interval of size of holes to fill. If 0 is specified as maximum, then the holes to fill can be as big as possible.
Connectivity

Specifies the connectivity, which can be either 4- or 8-connectivity, either 6- or 18- or 26-connectivity, depending whether a 2D or 3D process was chosen.
Illustration of the different connectivities in 3D. (a): 6-, (b): 18-, and (c): 26-connectivity (in case you didn't figure it out, n-connectivity means n pixels in the neighbourhood. It should be trivial in 2D).
Border contact

Tick this option if you want holes that "touch" the image border to be filled.
Warning : If you specify any size of hole to fill, and you tick this option, then all pixels of the background will be affected !
Fill value

The new intensity of the pixels in the hole to fill.
Fill

Press this button to start the computation.
Commands:
Additional options can be accessed when typing in the console Fill_Holes COMMAND_NAME. Typing the command again usually reverts back to original settings.
verbose
Displays timing information after the computation. Retype to hide info.
create
Runs the computation. Returns the name of the output, so it can be used in a script, such as set RESULT [Fill_Holes create].