How to extract 2d flat surface from contour planes

Hi, im trying to get a flattened slice from a nifty file , in order to mesh in 2d it later. My objective is to obtain something like this :

I have segmented the brain and obteined the contours with the slicer rt extension, but i dont know how to export the 2d slice contoured as a stl file, in order to mesh it later, and not the whole volume. This is where i am at:


Thank you in advance.

I think a pipeline using the following filters could help you:

  1. https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData/
  2. VTK: vtkContourTriangulator Class Reference
  3. SlicerSurfaceToolbox/SurfaceToolbox/SurfaceToolbox.py at 172c9d917ae695d14a3f1ad456e5bf61997b6231 · Slicer/SlicerSurfaceToolbox · GitHub

This is the pipeline that Slicer uses for this: