1. Click Binary»Adv. Morphology or click Adv. Morphology in the Binary tab of the Processing Functions palette.
  2. Select Remove large objects.
  3. Specify the number of 3 x 3 erosions to apply in Iterations. The particles that remain after the erosion operations are removed from the image and the rest of the particles are restored.
  4. Click OK to remove large objects and add this step to the script.