Hi together,
I’m trying to write a code snippet in Python for a pipeline that should generate a .seg.nrrd file by using the actual DICOM and the segmented STLs. In Slicer, I have performed this by using the module ‘Segmentations’ → Import models (one by one) → Right-click on the created segmentation node and export it as a .seg.nrrd file. Are there any existing python modules or functions, which can perform exactly this operation?
I’ve tested the module in slicer and it does exactly what I need, but I can just load one STL at once. Is there a way to load mutliple STLs and create a segmentation tree out of this STLs instead of a single segmenation node? In other words, I have the right and left femur as well as the left and right tibia and fibula saved in separated STL files. Now I need one segmentation (-tree) which I can export as a .seg.nrrd file.
You can copy/paste segments from different segmentations. Our module doesn’t do that, but you can look into the script library for examples. Script repository — 3D Slicer documentation