# Calculating cross section on a set plane

**URL:** <https://discourse.slicer.org/t/calculating-cross-section-on-a-set-plane/32664>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [November 8, 2023, 9:54am UTC](https://discourse.slicer.org/t/calculating-cross-section-on-a-set-plane/32664 "2023-11-08T09:54:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![AKue](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@AKue](https://discourse.slicer.org/u/AKue)\
**Post date:** [November 8, 2023, 9:54am UTC](https://discourse.slicer.org/t/calculating-cross-section-on-a-set-plane/32664/1 "2023-11-08T09:54:56Z")

</div>

Hello!

I have a segmentation (here in blue) and I would like to calculate the cross section with a preset plane.  
Is there a quick way to do so?

 ![Bildschirmfoto 2023-11-08 um 10.50.10](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/2/823fc262855ca051093c6c42087b6ba7c633ec82.png)

---

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rafaelpalomar/32/1436_2.png) [@RafaelPalomar](https://discourse.slicer.org/u/RafaelPalomar)\
**Post date:** [November 8, 2023, 1:57pm UTC](https://discourse.slicer.org/t/calculating-cross-section-on-a-set-plane/32664/2 "2023-11-08T13:57:19Z")

</div>

@AKue a segmentation has different representations (most notably binary labelmap image and closed surface mesh). Cross-section in different representations will typically be different and require different methods. For instance, the cross-section of a 3D surface mesh woud look like a contour and the cross-section of a binary image would look like a blob. The output datatype will be also different in 3D mesh you will get a polydata where in a binary image you would get an image.

What is what you want to achieve?

---

<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:** [November 8, 2023, 1:58pm UTC](https://discourse.slicer.org/t/calculating-cross-section-on-a-set-plane/32664/3 "2023-11-08T13:58:23Z")

</div>

Maybe try this:

> <https://github.com/SlicerIGT/SlicerBoneReconstructionPlanner/blob/30ff1275fb4cbff0ae09ca0fdb8d4edb0569cd01/BoneReconstructionPlanner/BRPLib/helperFunctions.py#L8-L23>

Hope it helps

---

<div class="post-metadata">

**Author:** ![RafaelPalomar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rafaelpalomar/32/1436_2.png) [@RafaelPalomar](https://discourse.slicer.org/u/RafaelPalomar)\
**Post date:** [November 8, 2023, 2:00pm UTC](https://discourse.slicer.org/t/calculating-cross-section-on-a-set-plane/32664/4 "2023-11-08T14:00:43Z")

</div>

That would be for cross-sections of 3D surfaces. Thanks @mau_igna_06!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 8, 2023, 2:58pm UTC](https://discourse.slicer.org/t/calculating-cross-section-on-a-set-plane/32664/5 "2023-11-08T14:58:56Z")

</div>

You may also use the [“Cross-Section Analysis” module](https://github.com/vmtk/SlicerExtension-VMTK/tree/master#the-vmtk-extension-for-3d-slicer) in VMTK extension. It does not just compute the cross-sectional area in two planes but many planes along a line or curve.

---

<div class="post-metadata">

**Author:** ![AKue](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@AKue](https://discourse.slicer.org/u/AKue)\
**Post date:** [November 9, 2023, 9:26am UTC](https://discourse.slicer.org/t/calculating-cross-section-on-a-set-plane/32664/6 "2023-11-09T09:26:32Z")

</div>

Thanks for all your input!!  
My aim is to get the exact size (square millimeter) of the cross section between plane and segmentation. For me it doesn’t matter if by 3D surface mesh or binary labelmap.  
It should be fast, accurate and reproducible.

Thanks for all your help!

---

<div class="post-metadata">

**Author:** ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)\
**Post date:** [November 9, 2023, 7:50pm UTC](https://discourse.slicer.org/t/calculating-cross-section-on-a-set-plane/32664/7 "2023-11-09T19:50:01Z")

</div>

> [@AKue](#):
>
> 3D surface mesh or binary labelmap.

You may install SlicerVMTK extension using the extension manager to use the '[Stenosis measurement: 2D’ module](https://github.com/vmtk/SlicerExtension-VMTK/tree/master/StenosisMeasurement2D). It can calculate the cut surface area of a segment using the orientation of a slice view that you specify. Of course, you should reformat the slice view to be that of your planes.

To help you quickly reformat a slice view to a plane, you may install [this](https://gitlab.com/chir-set/RcHacks7) project. It’s a manual step, done once only. If you don’t know what is the ‘.slicerrc.py’ file, the [online manual](https://slicer.readthedocs.io/en/latest/user_guide/settings.html#application-startup-file) will help you.

You must of course restart Slicer after the installations.
