Thanks Andras. Your suggestion helped a lot and we were able to generate a 3D stl file. However a new issue has arisen.
The stl file so obtained does not have a smooth surface. It is composed of blocks (like a pixelated image) and is therefore unsuitable for printing. Can you tell us how to overcome this problem.
You have three options, you can use all, but the first one is the most important:
crop your input volume to the region of interest & resample to have sufficiently high resolution using the Crop volume module: specify your ROI, select Isotropic spacing, select sufficiently low spacing scale value (the lower the value, the more details you can preserve during segmentation, but more memory and processing time you will need; typically 0.5 … 0.2 should work), select bspline interpolator
smooth the labelmap representation using Smoothing effect in Segment editor module
smooth the generated surface: in Segment editor module, click on the small arrow on the “Show 3D” button, choose Set surface smoothing, and increase the smoothing value. (in older Slicer versions, this setting was only available in Segmentations module: click Update button in the row of Closed surface representation in Representations section, click on Binary labelmap -> Closed surface rule, increase Smoothing factor value)