# How to extract 2d flat surface from contour planes 

**URL:** <https://discourse.slicer.org/t/how-to-extract-2d-flat-surface-from-contour-planes/40592>\
**Category:** Support\
**Created:** [December 9, 2024, 7:26pm UTC](https://discourse.slicer.org/t/how-to-extract-2d-flat-surface-from-contour-planes/40592 "2024-12-09T19:26:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![v.p.r](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/v.p.r/32/78790_2.png) [@v.p.r](https://discourse.slicer.org/u/v.p.r)\
**Post date:** [December 9, 2024, 7:26pm UTC](https://discourse.slicer.org/t/how-to-extract-2d-flat-surface-from-contour-planes/40592/1 "2024-12-09T19:26:47Z")

</div>

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 :

 ![Captura de pantalla 2024-12-09 201933](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/e/6e82ea9ff1ee69af48ef919a975a37fbb9b12143.png)

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:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/0/f0842bef44f94d49910db034db719f663f4b1a5b.png)  
Thank you in advance.

---

<div class="post-metadata">

**Author:** ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)\
**Post date:** [December 9, 2024, 8:29pm UTC](https://discourse.slicer.org/t/how-to-extract-2d-flat-surface-from-contour-planes/40592/2 "2024-12-09T20:29:19Z")

</div>

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

1. [https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData/](https://examples.vtk.org/site/Cxx/Filtering/ContoursFromPolyData/)
2. [VTK: vtkContourTriangulator Class Reference](https://vtk.org/doc/nightly/html/classvtkContourTriangulator.html#details)
3. [SlicerSurfaceToolbox/SurfaceToolbox/SurfaceToolbox.py at 172c9d917ae695d14a3f1ad456e5bf61997b6231 · Slicer/SlicerSurfaceToolbox · GitHub](https://github.com/Slicer/SlicerSurfaceToolbox/blob/172c9d917ae695d14a3f1ad456e5bf61997b6231/SurfaceToolbox/SurfaceToolbox.py#L396-L402)

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [December 10, 2024, 12:46pm UTC](https://discourse.slicer.org/t/how-to-extract-2d-flat-surface-from-contour-planes/40592/3 "2024-12-10T12:46:04Z")

</div>

This is the pipeline that Slicer uses for this:

> <https://github.com/Slicer/Slicer/blob/main/Modules/Loadable/Segmentations/MRMLDM/vtkMRMLSegmentationsDisplayableManager2D.cxx#L134>
