# Can I have a boolean operarion for STLs directly?

**URL:** <https://discourse.slicer.org/t/can-i-have-a-boolean-operarion-for-stls-directly/2133>\
**Category:** Support\
**Created:** [February 21, 2018, 1:09am UTC](https://discourse.slicer.org/t/can-i-have-a-boolean-operarion-for-stls-directly/2133 "2018-02-21T01:09:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)\
**Post date:** [February 21, 2018, 1:09am UTC](https://discourse.slicer.org/t/can-i-have-a-boolean-operarion-for-stls-directly/2133/1 "2018-02-21T01:09:26Z")

</div>

Operating system:  
Slicer version:  
Expected behavior:  
Actual behavior:  
I have established two cubes by points with the same axis.After changed into segments , this cubes can be boolean operation but there are many losed informations. I don’t know there are any way maybe some codes to bool-operate just stay in stl file?

---

<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:** [February 21, 2018, 2:03am UTC](https://discourse.slicer.org/t/can-i-have-a-boolean-operarion-for-stls-directly/2133/2 "2018-02-21T02:03:29Z")

</div>

Boolean operations directly on meshes is one of the most complicated problems in computer graphics and in Slicer we opted to have a solution that is very robust and quite fast. The method includes a step where the mesh is rasterized into a binary labelmap, therefore you have to make sure the binary labelmap representation of the segmentation has sufficiently small spacing so that all relevant details are preserved. You can use the `Crop volume` module to create a volume with sufficiently small spacing and use the resulting volume as master volume in the segmentation.

---

<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:** [February 21, 2018, 3:11pm UTC](https://discourse.slicer.org/t/can-i-have-a-boolean-operarion-for-stls-directly/2133/3 "2018-02-21T15:11:45Z")

</div>

There are two ways you can do this easily in Slicer:

- Segment Morphology module in SlicerRT extension (a good choice if you want to script it and not as part of a segmentation workflow)
- Logical operators effect in Segment Editor (I recommend this if you want to do this while segmenting, or if you want to script without relying on an extension)
