# Is it possible to register two meshes then subtract away the overlapping region?

**URL:** <https://discourse.slicer.org/t/is-it-possible-to-register-two-meshes-then-subtract-away-the-overlapping-region/24571>\
**Category:** Support\
**Tags:** registration, segmentation, 3d-model\
**Created:** [July 29, 2022, 11:23pm UTC](https://discourse.slicer.org/t/is-it-possible-to-register-two-meshes-then-subtract-away-the-overlapping-region/24571 "2022-07-29T23:23:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsalas424](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jsalas424](https://discourse.slicer.org/u/jsalas424)\
**Post date:** [July 29, 2022, 11:23pm UTC](https://discourse.slicer.org/t/is-it-possible-to-register-two-meshes-then-subtract-away-the-overlapping-region/24571/1 "2022-07-29T23:23:23Z")

</div>

Hi all,

TLDR: I want to register two meshes and find the corresponding points/indices so that I can compare a derived value within and outside my region of interest.

I have mesh A generated by one modality, I then performed calculations at each vertex. The data looks like this:

```auto
calculated_value X Y Z
0.596 -65.355 15.519 190.760
0.601 -64.811 17.557 190.816
0.602 -66.040 17.290 191.835
0.598 -64.785 16.570 190.624
0.598 -64.020 16.604 190.632
..... ..... ..... .....

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/1/917a8f2c6cb7c89d4456cbce3b8c14281bc857d6.jpeg)

Mesh B was then generated from an MRI of the same organ using a different modality, and only corresponds to a region of interest relative to Mesh A. Looks something like this:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/5/95fd3548542aded4228f525e4849d380c38ad062.jpeg)

Mesh C was generated using the same methodology/modality as B and putatively corresponds to the full surface volume of mesh A.

 ![Screen Shot 2022-07-29 at 7.17.14 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/0/90427b1a35254d1c0770748592e0a84808faa821.jpeg)

I want to proceed to register the subset mesh with Mesh A for which I have calculations, with the intent of finding the coordinates (or index position) of the vertices so that I can subset out the calculated\_values both inside and outside the region of interest.

Ultimately I need to derive a data table that looks like this:

```auto
region calculated_value X Y Z
mesh_a 0.596 -65.355 15.519 190.760
mesh_a 0.601 -64.811 17.557 190.816
mesh_b 0.602 -66.040 17.290 191.835
mesh_b 0.598 -64.785 16.570 190.624
mesh_b 0.598 -64.020 16.604 190.632
..... ..... ..... ...... .....

```

Is this possible?

---

<div class="post-metadata">

**Author:** ![jsalas424](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jsalas424](https://discourse.slicer.org/u/jsalas424)\
**Post date:** [July 30, 2022, 3:25am UTC](https://discourse.slicer.org/t/is-it-possible-to-register-two-meshes-then-subtract-away-the-overlapping-region/24571/2 "2022-07-30T03:25:34Z")

</div>

I’ve used the IGT Model Registration module to perform a rigid registration of the region of interest (blue) onto the mesh (yellow) and am now wondering if it’s possible to get all the points corresponding to the surface area directly underneath the blue, on the yellow.

I’m thinking perhaps I can export both point lists and then perform a K nearest neighbors classification algorithm to fill in which point number on the yellow mesh each blue mesh vertex point corresponds to best. I’ve never tried anything like this before though.

![Screen Shot 2022-07-29 at 11.22.04 PM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/5/25d7bdae45f261c636c45cf9d5fb0a704f5b02b1.png)

---

<div class="post-metadata">

**Author:** ![mau\_igna\_06](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mau_igna_06/32/9056_2.png) [@mau\_igna\_06](https://discourse.slicer.org/u/mau_igna_06)\
**Post date:** [July 30, 2022, 12:19pm UTC](https://discourse.slicer.org/t/is-it-possible-to-register-two-meshes-then-subtract-away-the-overlapping-region/24571/3 "2022-07-30T12:19:24Z")

</div>

I would try to customize this filter inputs:  
[https://vtk.org/doc/nightly/html/classvtkWarpVector.html](https://vtk.org/doc/nightly/html/classvtkWarpVector.html)

So you get the desired result

Hope it helps
