Segmentation to labelmap via commandline

Hi all,
is there a way for converting a segmentation into a labelmap via command line?
The labelmap should fit the shape of an anatomical image, so this would be another parameter to specify.

In addition: can I apply (via command line, again) a transformation to a segmentation?

Basically, I would first apply one (or more) transformation to the segmentation, then convert the contours to fit the final image shape.

Thanks a lot.

Paolo

See examples here: Documentation/Nightly/ScriptRepository - Slicer Wiki

Thanks @lassoan .

Since I need to do all this via command line, I have to run slicer specifying the reference volume, the segmentation, and the python script with the code for conversion.

Am I right?

Paolo

Yes. You can pass all the code that loads inputs, runs processing, and exports output to files. Or, you can create a small script and just specify the script and input/output file paths as command-line arguments.

1 Like