Post processing pixel level classification with weka trainable segmentation

Hello experts,
I am using weka trainable segmentation to do pixel level classification of tumor section images. The classifier works pretty well, but for some classes the pixel output is at too fine a granularity. I was thinking of whether it is possible to combine probability of neighboring pixels to make a call on a group of pixels as a whole belonging to one class.
I notice the trainableSegmentation.utils.Utils class seems to have some capability along these lines (i might be mistaken though).
These are static methods - erode, dilate, filterSmallObjectsAndHoles, postProcess which operate on the probability image.
Is this the right use of these methods, and if so is there any examples that explain how to do this?