# Segment-Meshing multiple segments

**URL:** <https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595>\
**Category:** Support\
**Tags:** extensions-manager, fem, segmentmesher\
**Created:** [September 21, 2020, 8:56pm UTC](https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595 "2020-09-21T20:56:12Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shajia\_Ali](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shajia_ali/32/3425_2.png) [@Shajia\_Ali](https://discourse.slicer.org/u/Shajia_Ali)\
**Post date:** [September 21, 2020, 8:56pm UTC](https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595/1 "2020-09-21T20:56:12Z")

</div>

Hi,

I discovered segment-mesher quite recently and my goal is to create a mesh of a nutshell and the vascular bundles within it. My attempt is to have two meshes. One for the shell (with holes) and one only for the vascular bundles. It works when I seperate the segments into different ‘segmentation-files’. If i have two regions in one segmentation, it will mesh beautifully and the regions are showed by different colours. But there is no way to export them for example, as one part, but with two regions (for example element sets). If I could export it like that, I would make sure that the nodes of both regions match perfectly. It would be also easier to work with the element-sets in abaqus, giving them different material-properties.

Can someone help me out on that?

---

<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:** [September 21, 2020, 10:06pm UTC](https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595/2 "2020-09-21T22:06:46Z")

</div>

Cleaver provides a single mesh that contains multiple regions. Each element has an associated value that defines which region it belongs to.

How did you import the mesh into abaqus?

---

<div class="post-metadata">

**Author:** ![Shajia\_Ali](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shajia_ali/32/3425_2.png) [@Shajia\_Ali](https://discourse.slicer.org/u/Shajia_Ali)\
**Post date:** [September 22, 2020, 12:13am UTC](https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595/3 "2020-09-22T00:13:53Z")

</div>

I just save it as a vtk and then convert it to an inp. File with meshio. How can I see which element belongs to which region? It would simplify a lot. When I import it to abaqus, I only have ONE orphan mesh with ONE region.

---

<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:** [September 22, 2020, 12:24am UTC](https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595/4 "2020-09-22T00:24:13Z")

</div>

It seems that region information is lost during meshio conversion. Submit an issue in the meshio repository about this (include a link to an example vtk file) and see what the developers say.

---

<div class="post-metadata">

**Author:** ![Shajia\_Ali](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shajia_ali/32/3425_2.png) [@Shajia\_Ali](https://discourse.slicer.org/u/Shajia_Ali)\
**Post date:** [September 22, 2020, 12:32am UTC](https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595/5 "2020-09-22T00:32:19Z")

</div>

Is it even inside the vtk.file? If so, how do I check it? I opened it in paraview, it looked like ONE region to me, but I have never used paraview before, so that’s on me probably.

I do the following:

1. Define regions
2. Mesh with segment mesher
3. Save the model of the coloured mesh as vtk. Maybe the saving process is wrong?

---

<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:** [September 22, 2020, 2:22am UTC](https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595/6 "2020-09-22T02:22:14Z")

</div>

> [@Shajia\_Ali](#):
>
> Is it even inside the vtk.file?

Yes, the region number is stored in cell data array called `label`.

In Slicer, it is listed in Models module / Display / Scalars / Active Scalar (and it is used by default to display each region with a different color).

In Paraview, it is shown in Information tab / Data Arrays (and you can use that to color the model by selecting it in Properties tab / Display / Coloring):

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/a/5ac692f4418041b118e6de0d50936d88bbe89b64.png)

---

<div class="post-metadata">

**Author:** ![Shajia\_Ali](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shajia_ali/32/3425_2.png) [@Shajia\_Ali](https://discourse.slicer.org/u/Shajia_Ali)\
**Post date:** [September 22, 2020, 7:48am UTC](https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595/7 "2020-09-22T07:48:20Z")

</div>

Maybe the solution would be to split the submeshes, and merge them back in abaqus, after assigning the material properties.

I will look into the meshio thing as well.

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![Shajia\_Ali](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shajia_ali/32/3425_2.png) [@Shajia\_Ali](https://discourse.slicer.org/u/Shajia_Ali)\
**Post date:** [September 29, 2020, 7:23pm UTC](https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595/8 "2020-09-29T19:23:54Z")

</div>

A different question, I see the description about adjusting the cleaver mesh, There are three options: scale, multiplier and grading. What if I want to have a mesh which is coarser on simple structures and finer on complex ones? I feel like it gets finer or coarser everywhere when i only want to work with those three parameters. Is there a way to create a solid out of that generated mesh? Then I could adjust it outside of 3d slicer.

Kind regards

Shajia

---

<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:** [September 30, 2020, 1:05am UTC](https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595/9 "2020-09-30T01:05:25Z")

</div>

> [@Shajia\_Ali](#):
>
> which is coarser on simple structures and finer on complex ones

This is how the Cleaver adaptive meshing works.

In addition, you can specify a sizing field (an image) that you can use to specify regions where you want to have finer/coarser resolution. You need to create and this sizing field image and specify as additional input to Cleaver.

---

<div class="post-metadata">

**Author:** ![Shajia\_Ali](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shajia_ali/32/3425_2.png) [@Shajia\_Ali](https://discourse.slicer.org/u/Shajia_Ali)\
**Post date:** [September 30, 2020, 7:56am UTC](https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595/10 "2020-09-30T07:56:43Z")

</div>

Yes I know, but I thought maybe I have more control over it. Where do I find the sizing field image thing? I will look into it by myself later this day. But maybe you can give me a hand in advance. Like is there a small example on that? Thank you a lot for the fast answers.

Kind regards

Shajia

---

<div class="post-metadata">

**Author:** ![Shajia\_Ali](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shajia_ali/32/3425_2.png) [@Shajia\_Ali](https://discourse.slicer.org/u/Shajia_Ali)\
**Post date:** [September 30, 2020, 8:04am UTC](https://discourse.slicer.org/t/segment-meshing-multiple-segments/13595/11 "2020-09-30T08:04:52Z")

</div>

Or is it possible to mesh both of the meshes seperately and merge them and only adapt the coarser mesh to the finer mesh? Like somehow overlapping them without having holes in between (wishful thinking from my point of view).  
I have like one structure which doesn’t need to be fine, the other part needs to be really fine. So if I adjust with those three parameters either it’s too fine with the bigger structure or too coarse with the finer structure.
