No need for a module, you can run
slicer.util.saveNode to save an image in nifti format.
I’m not sure this is the best idea: you cannot implement complete applications in Matlab, it is only affordable for academic use, and in general you just make your life harder by not using the same toolsets that most machine learning experts . For example, if you use tensorflow, pytorch, etc. then you can run training or inference directly within Slicer’s Python environment. You can interface Slicer with Matlab, too, but there are several additional layers and inconveniences.
If you segment an image then the resulting segmentation will be spatially aligned with it in physical space (and in most cases, you choose the segmentation to have the exact same geometry as the input image). Therefore, there should be no need for any additional registration step.