# Skull segmentation (Mimics 22.0)

**URL:** <https://community.materialise.com/t/skull-segmentation-mimics-22-0/75>\
**Category:** MIS - Demo Scripts\
**Tags:** mimics, cmf, segmentation\
**Created:** [May 21, 2019, 12:50pm UTC](https://community.materialise.com/t/skull-segmentation-mimics-22-0/75 "2019-05-21T12:50:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtls\_jdeckx](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.materialise.com/mtls_jdeckx/32/14_2.png) [@mtls\_jdeckx](https://community.materialise.com/u/mtls_jdeckx)\
**Post date:** [May 21, 2019, 12:50pm UTC](https://community.materialise.com/t/skull-segmentation-mimics-22-0/75/1 "2019-05-21T12:50:27Z")

</div>

In this tutorial some basic segmentation features of Mimics are presented using the project Mimi.mcs, as available in `C:\MedData\DemoFiles` .

```
# Tutorial: Perform segmentation, region growing and calculate 3D to Mimi.mcs
# Open the project
input_dir = r'C:\MedData\DemoFiles\Mimi.mcs'
mimics.file.open_project(input_dir)
# Create an empty mask        
mask_a = mimics.segment.create_mask()
mask_a.name = "Bone"
# Perform thresholding with selected min and max values
mimics.segment.threshold(mask=mask_a, threshold_min=1250, threshold_max=2800) # thresholds are set in gray values
# Create a point that will be used fot the region growing operation
point_1 = mimics.analyze.indicate_point(title="Region growing point",
										message="Please indicate a point on the part of interest")
point_2 = point_1.coordinates
point_2 = tuple(point_2)
# Region growing. The original mask is preserved
mask_b = mimics.segment.region_grow(point=point_2, input_mask=mask_a, target_mask=None, slice_type="Axial",
									keep_original_mask=True)
mask_b.name = "Segmented skull"
# Calculation of the 3D part
part_a = mimics.segment.calculate_part(mask=mimics.data.masks.find("Segmented skull"), quality="High")
# Export the STL
mimics.file.export_part(object_to_convert=part_a, file_name=r"C:\MedData\skull_of_Mimi.stl")
# Save the project
mimics.file.save_project()
```
