Use masking module in segmentation

i have a script to create segmentation of the given dicom data, how can i add some code to make segmentation more perfect using masking module.
i have tried the new masking in seed grow technique its really helpful.