Use segmentations in CAD or FEM software

Operating system: windows 8.1 Pro
Slicer version: 4.3.1
Expected behavior: to have the possibility to transform surface models (mesh in stl format) to smooth geometry models (nurbs e.g. in IGES format)
Actual behavior: 3D models are surface meshes, not real geometries

Hi Gregorio,

First of all, please use Slicer 4.8 (or 4.8.1 as it’ll be released in a few days), there have been a great amount of improvements in the four years since 4.3.

You can smooth models in the Surface Toolbox module.

What do you mean by “real geometry”?

If you need volumetric meshes instead of surface meshes, use Segment Mesher extension. It can create tetrahedral meshes using Cleaver 2 or TetGen.

Thank you for the prompt reply.

For geometry, I mean a surface/volume that I can use with CAD and/or Finite Element Analysis, and eventually mesh it only in a second moment.

It is a common but not simple problem, to segment anatomical images and to work with surfaces that are not meshes (i.e. triangles and nodes, such as the .stl format or .vtk format in 3D slicer).

The procedure is well faced by the Mimics program, segmentation --> mesh --> CAD surface, but it is a pay program.

Thanks again

For getting a surface mesh, segment a structure using Segment Editor, then export it to a model node in Segmentations module, then save as .STL file.

For getting a volumetric mesh with tetrahedral elements, segment a structure using Segment Editor, then create a mesh using Segment Mesher module (available in Segment Mesher extension), then save it as a VTK unstructured grid file.

Thank you. But in this way, we are always talking about just meshes. I would need CAD geometries, it is something different, that can eventually be meshed in a second moment. I mean, if you know CAD or FEM softwares, when you start with them you begin with a “part”, that is something before “mesh”.

Volumetric meshes are “solid” objects. You may have to convert the volumetric mesh to a format that is recognized by your CAD software as a solid (it’s a trivial file format conversion operation). For example, you can load your volumetric mesh into Paraview and see if it can save it into a suitable format.

I’m afraid it is something more difficult, after I had make different tests in the past for conversion. The point is that with the conversion you maintain a “tessellated” surface, with all the triangles/tetrahedrals faces, so it changes the format but not the substance, mesh is not really overcame in favour of a smooth, “unmeshed”, surface

Hello Gregorio,
for getting the valid surface model from STL data you have to use the specialized software - and some experience - we’re doing that job when scanning the parts and need to modified them in CAD software or machine them (and need to get the IGES or STEP format). in case you are interested please contact me on my email -

@gregorio it’s true Slicer doesn’t support making nurbs from medical image data. The reason is that these representations are typically used to make more “abstract” or “idealized” (smoother) models whereas many Slicer applications would rather stick with more “granular” or “data driven” representations such as volumes or dense locally linear models (triangles). Thus we use filtering operations to trade off data fidelity with model smoothness.

None of the options (nurbs, triangles, volumes, etc) are perfect for all situations so developers need to choose where to put the effort to best solve particular kinds of use cases. In the past I know that people have had good luck performing image segmentation in Slicer and then using the generated model as a framework for creating nurbs or other models in something like Blender or SolidWorks, but it’s not automatic.

1 Like

Thank you at all.

@pieper I agree, but to do the job with free softwares is still an open challenge, the discussion confirms it to me

According to my limited experience with CAD software (used for designing solid parts) is that they usually don’t cope well with complex free-form objects created from medical images. They either just show it as a mesh and you cannot do much with them, and/or it really slows them down. Some software have special add-ons for processing meshes, I guess those try to fit nurbs, etc., but I haven’t tried those. However, these are inherently very limited, because they cannot efficiently simplify very complex shapes and they may assume that material properties are uniform in the whole object.

For medical images, usually the workflow is something like this:

  • In CAD design software:
    • design your mechanical parts
    • export parts as mesh (STL)
  • In medical imaging/modeling software (such as 3D Slicer or Mimics):
    • import CAD models
    • import patient images
    • create patient-specific models by segmenting patient images
    • combine CAD models with patient-specific models (in Slicer: using Segment editor, see simple video tutorial here)
    • create volumetric mesh suitable for FEA (in Slicer: Segment mesher extension, use Probe volume with model module to set material properties inside the volumetric mesh)
  • In FEA software:
    • In preprocessor: define boundary conditions, material properties, etc.
    • In solver: run FEA
    • In post-processor: view data, export relevant information to meshes
  • In medical imaging/modeling software:
    • Import FEA result meshes
    • Perform final patient-specific analysis

Note that in this workflow CAD design software does not have to deal with complex meshes.


I regularly have to to do FEM analysis on 3D images of biological tissues obtained my microscopy. And I agree with gregorio it is somewhat a mess.

My workflow is now:
ImageJ for segmenting, create a volume mesh the resulting images with iso2mesh, import the mesh in COMSOL (commercial FEM solution), convert the mesh in comsol back to a geometry (fails often, as comsol is not good at it), then make a mesh again.

It is slightly better that going through STL (which cause far more problems), but it is still silly. It would be preferable to have software that could produce NURBS from the 3D stacks directly. I think the reason why some FEM packages prefer to work with geometry instead of meshes is that it makes defining boundaries( faces ) and boolean operations simpler.

Of course I can use a mesh directly for FEM, but it will prevent me from using quite powerful geometry operations that are sometimes necessary for building a model.

Going through a mesh and then NURBS and then mesh again creates far far more artefacts than a simple “smooth” would do. And I disagree on principle anyway that making a tetrahedal mesh for tissue is somehow more precise than using NURBS. Cells are far more smooth than even the finest mesh… Especially when working with internal boundaries or defining contact pairs, having a geometry is a must.

But I have yet to find any software that can do this well. Just fitting/filling my cell structures with overlapping spheres would be better than what I get with some meshes. I have seen vtk plugins that get nurbs from pointclouds, so it must be possible to whip something up, but I am not sure if/when I have the time for this.

1 Like

Have you tried Segment Mesher extension in Slicer? Cleaver2 generates high-quality volumetric meshes directly from segmentation (from binary labelmap representation; and if needed we can make it work from fractional labelmap representation, too). There are no unnecessary conversions.

The workflow that we have envisioned with Slicer is that you create your models in CAD modeling software, import them into Slicer, combine them with free-form anatomical shapes obtained from 3D images, and then you can export labelmap, surface mesh, or volumetric mesh for 3D printing, visualization, or further processing in other software.

Segment Editor module has several tools for combining CAD models with anatomical shapes in various ways, but it you are not sure how certain operations can be achieved then let us know.

Andras: thanks for the reply. I will look again, but it looks like you admit that the Slicer is not the right tool for what gregorio and I want to do: import 3D structures of segmented tissue in some FEM packages. This is fine ofcourse! But I just hoped there would be some interest in seeing this as a valid problem.

We do not want high quality volumetric meshes. They all get converted to NURBS again in the FEM package (and sometimes badly at that). So why bother? We would like segmentation->NURBS->FEM. Not segmentation->mesh->nurbs->mesh->FEM.

slicer’s mesh may be leagues better than COMSOL’s mesher, and it is probably a shortcoming of COMSOL that it does not allow boolean/boundary definitions, assemblies, etc etc with imported meshes. And I will complain to them about this.

But it seems to me there is a valid use for segmentation->NURBS as well. And we are merely looking for a tool that lets us do this. The features of Slicer are nice, and it would be wonderful to have this ability. But I also understand you cannot support everything.

It seems that recent versions of InVesalius may be able to do this better. So I am going to check that out.

Thanks for the additional information. What is still not clear for me that if you can do all compositing of CAD models with anatomical structures in Slicer then why do you need NURBS export? Why cannot you use the volumetric mesh that Slicer generates directly in the FEM solver? I don’t think that FEM solvers represent structures as NURBS. Modeling programs do, but the idea is that the output of Slicer does not need further modeling.

@gregorio and @moondrake99

is it possible to provide some images/videos showing comparison cases e.g slicer output and output from other tools.

By FEM package, do you mean modeling tool, where you edit/combine 3D models? It is their limitation that they can only work with NURBS representation, and not with arbitrary segmented labelmaps (and not very well with complex triangle meshes).

This is the problem that Slicer solves, as it can edit/combine surface meshes and arbitrarily complex segmented labelmaps. Of course, modeling capabilities of Slicer are very limited compared to what modeling tools can do, but should be powerful enough so that you can use it as the last step of your workflow. Slicer’s output should not need further editing (so no NURBS representation is needed), you can feed it directly into FEM solvers/pre-processors.

It could be still nice to have NURBS-based editing in Slicer for simple, smooth shapes; but this is a special case and it is not very high on the priority list.

brhoom: yes. But this will take me some time (which I am rather short of atm). Will try.

By FEM package i mean a tool that does both the solving, but also preprocessing. And yes, it has some CAD ability in that it can edit and combine models. This has good reasons. One could for example examine the effect of a change in structure on whatever physics one is interested in. To change the structure, it helps tremedously to have some 3D processing in this package. You can also use solver approaches that can refine the mesh based on the model solution (finer mesh in areas with steep gradients).

I have needed to use both things in the past. But the current problem is perhaps simpler:

A typical but simplified example would be to do a diffusion model inside a single cell. Images are e.g. from SBF-SEM. Imagine I have a cytoplasm and many mitochondria. I segment the cells and the mitochondria.

The main problem now is that for the FEM analysis, I need to define the surface of the mitochondria (the membrane) as a kind of flux discontinuity as it’s permeability is quite low, but it is only very thin. A way to deal with such thin elastic layers is to have a surface mesh on the outside of the mitochondria and on the “inside” of the cell (basically the holes you would get if you would substract the mito-volume from the cellular volume). These two meshes can be coupled (sometimes called contact or identity pairs) and given a simple relation (in this case, something like C1-C2=F/G, where C are concentrations on the contact mesh sides, G is a conductance and F is a normal diffusive flux). Such couplings put some constraints on the 2 surface meshes (I forgot the details, but I assume they have to be roughly matching to prevent errors).

The whole thing is than solved in what my current favourite FEM package calls “assembly mode”. It roughly means you actually have 2 separate FEM models that are coupled with some equation(the simple 1D permeability above). These may even be different physics.

I have not found a way to create such meshes with other tools. And if I had, I am not sure I could make my current FEM package use such mesh in assembly mode (as it would not know elements of the mesh are to be coupled without doing the operation itself or an exchange file-format that lists them).

A second problem is that a mesh of a blobby object like a cell is quite irregular. Now, I may want to define a boundary condition (e.g. an influx of stuff) on only part of this cell surface (for example, where it intersects with another shape). You are right I can do the compositing in Slicer, but a mesh is just a mesh and I have no idea what mesh elements are the ones that I need to define different boundary conditions on.

If I do the compositing in the FEM package, it keeps track of such boundaries and I can set different conditions on that.

The physics coupling and separation of mesh and geometry is the whole reason I use a bloody expensive FEM package instead of the quite good free solvers. But the disadvantage is that I have to use THEIR compositing (which is not that good). And you are right that it is their limitation that the compositing works with NURBS. The solution some people found is to pay even more and buy simpleware or mimics who are apparently good at creating a NURBS representation out of meshes. To be fair, even comsol provides a mesh->nurbs converter, but it is not an easy problem and does not work perfect for me (it is my main time sink).