# Automatic non-rigid (elastic) registration between 2 stl files

**URL:** <https://discourse.slicer.org/t/automatic-non-rigid-elastic-registration-between-2-stl-files/3298>\
**Category:** Support\
**Tags:** registration, volume, stl\
**Created:** [June 26, 2018, 10:26am UTC](https://discourse.slicer.org/t/automatic-non-rigid-elastic-registration-between-2-stl-files/3298 "2018-06-26T10:26:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavideBassano](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@DavideBassano](https://discourse.slicer.org/u/DavideBassano)\
**Post date:** [June 26, 2018, 10:26am UTC](https://discourse.slicer.org/t/automatic-non-rigid-elastic-registration-between-2-stl-files/3298/1 "2018-06-26T10:26:22Z")

</div>

Hello,

I have 2 .stl volumes (let’s call them fixed and moving).  
I would like to warp the moving volume above the fixed volume with an automatic registration (so without fiducials, landmarks, … or with a very small number of points).  
These 2 volumes are already aligned and overlapped, so I just need to warp the moving volume to fit (or adapt) the fixed volume.

Does exist a way I can do it?

Thanks,

Davide Bassano

---

<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:** [June 26, 2018, 11:36am UTC](https://discourse.slicer.org/t/automatic-non-rigid-elastic-registration-between-2-stl-files/3298/2 "2018-06-26T11:36:51Z")

</div>

you can transform under 3d view with handly and the models should be transparent.

---

<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:** [June 26, 2018, 11:52am UTC](https://discourse.slicer.org/t/automatic-non-rigid-elastic-registration-between-2-stl-files/3298/3 "2018-06-26T11:52:07Z")

</div>

If you have anatomical volumes as well, you can use the SegmentRegistration extension. You need to load the STLs as segmentations, not models. You can change it in the loading screen.

If you only have the STLs then you can use the ModelRegistration module in the SlicerIGT extension.

Let us know how it goes.

---

<div class="post-metadata">

**Author:** ![DavideBassano](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@DavideBassano](https://discourse.slicer.org/u/DavideBassano)\
**Post date:** [June 26, 2018, 12:34pm UTC](https://discourse.slicer.org/t/automatic-non-rigid-elastic-registration-between-2-stl-files/3298/4 "2018-06-26T12:34:23Z")

</div>

Thanks for your fast reply.

I only have the STLs, so I used the ModelRegistration Module in IGT.  
The problem is that it only gives linear transformations as output, but I need to warp/adapt my moving volume to the fixed one, so I’d like a non-linear transformation because I’m trying to do a non-rigid registration.  
How can I do?

Thanks

Davide

---

<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:** [June 26, 2018, 3:10pm UTC](https://discourse.slicer.org/t/automatic-non-rigid-elastic-registration-between-2-stl-files/3298/5 "2018-06-26T15:10:06Z")

</div>

Good point. In this case the only way I can think of is to create two volumes for each model, and use Segment Registration. You only need the volumes to have a grid that the volume-based distance map registration can use.

I don’t have time now but the first idea that comes to mind is to load a sample dataset, and move it to overlap the models (create transform, set as parent, show volume in volume rendering, show ROI, see if it overlaps). Then harden the transform, clone that volume in Data module, and use those two for Segment Registration.

I’m in the process of implementing an easy way to specify volume geometry from segmentations/models/etc, but it’s not ready yet and will be even more time before we can use it to create empty reference volumes, so for the time being we have to use an existing volume for example as I described above.

Others feel free to chime in.  
Good luck!

---

<div class="post-metadata">

**Author:** ![DavideBassano](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@DavideBassano](https://discourse.slicer.org/u/DavideBassano)\
**Post date:** [June 26, 2018, 3:24pm UTC](https://discourse.slicer.org/t/automatic-non-rigid-elastic-registration-between-2-stl-files/3298/6 "2018-06-26T15:24:12Z")

</div>

> [@cpinter](#):
>
> create two volumes

I have a problem when importing .stl files as “volume”: I can select “volume” when importing, but then they don’t appear in the Data Module, thus in Volume Rendering Module I can’t select them. If I import them as module, instead, it works.  
Why does this happen?

> [@cpinter](#):
>
> to load a sample dataset,

With “dataset” you mean the stl files?

Thank you

Davide

---

<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:** [June 26, 2018, 3:41pm UTC](https://discourse.slicer.org/t/automatic-non-rigid-elastic-registration-between-2-stl-files/3298/7 "2018-06-26T15:41:59Z")

</div>

You cannot open STL as volume, as they are surface meshes. You can only open them as model or segmentation. When I said sample dataset I meant volumes from the Sample Data module (you can find it in the Welcome module too).

---

<div class="post-metadata">

**Author:** ![jkearns](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jkearns](https://discourse.slicer.org/u/jkearns)\
**Post date:** [June 23, 2021, 4:45am UTC](https://discourse.slicer.org/t/automatic-non-rigid-elastic-registration-between-2-stl-files/3298/8 "2021-06-23T04:45:27Z")

</div>

Davide,

```
 Did you ever come to a resolution for this problem? I am interested in a mapping that is similar to what you describe (I believe) so that I can get a series of transformation coordinates to inform the moving mesh of a simulation of the Left Ventricle in COMSOL. 

 I am a new user to this software, so any guidance is greatly appreciated. 

```

Cheers,  
John

---

<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:** [June 23, 2021, 1:05pm UTC](https://discourse.slicer.org/t/automatic-non-rigid-elastic-registration-between-2-stl-files/3298/9 "2021-06-23T13:05:17Z")

</div>

Once you loaded the STL file as segmentation, you can convert it to a volume by two clicks in Data module (right-click and choose to convert to labelmap).
