Hello @debapriya,
There is no specific function in ITK/SimpleITK to remove the bed from the image. This usually involves multiple steps. I highly recommend you follow @lassoan’s advice and use the module from 3D Slicer.
p.s. The morphology module, is an skimage module, not ITK/SimpleITK. Its documentation does say it has a dilation
method (the code in the other post did not include all the imports).