The command line example in the post below should give you an idea. Yes, you can run it as a subprocess launched from Slicer. HTH.