# Do projection from polydata to a model surface

**URL:** <https://discourse.slicer.org/t/do-projection-from-polydata-to-a-model-surface/18451>\
**Category:** Support\
**Tags:** 3d-model\
**Created:** [July 1, 2021, 9:24am UTC](https://discourse.slicer.org/t/do-projection-from-polydata-to-a-model-surface/18451 "2021-07-01T09:24:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandyaa0313](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sandyaa0313/32/11566_2.png) [@sandyaa0313](https://discourse.slicer.org/u/sandyaa0313)\
**Post date:** [July 1, 2021, 9:24am UTC](https://discourse.slicer.org/t/do-projection-from-polydata-to-a-model-surface/18451/1 "2021-07-01T09:24:41Z")

</div>

Operating system: windows10  
Slicer version:4.11.20200930  
I want to do the orthogonal projection (or just the simplest projection) from a polydata array to a model surface. The input polydata is the edge of another model.  
My goal is to receive the new coordinates of polydata after the projection, but I don’t know how to do the projection.  
Now I only know how to get the coordinates from polydata, just like the code below. Thanks!

Here is my code:

PolyData = modelNode.GetPolyData()  
Point\_coordinates = PolyData.GetPoints().GetData()  
numpy\_coordinates = numpy\_support.vtk\_to\_numpy(Point\_coordinates)

---

<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:** [July 2, 2021, 4:59am UTC](https://discourse.slicer.org/t/do-projection-from-polydata-to-a-model-surface/18451/2 "2021-07-02T04:59:10Z")

</div>

It is not yet completely clear what you would like to achieve. A model node already stores a polydata. Maybe it would be easier if you attached an image.

If you want to transfer scalar values from one model to another then you use the method described here:

> [@Merge scalars of two models](https://discourse.slicer.org/t/merge-scalars-of-two-models/15682/3):
>
> If you want to keep the models separate and just copy the scalar data then you can achieve it by following these steps: install ModelToModelDistance extension and use Model to model distance module to compute vector that moves points of one surface to the other (based on closest point of one surface on the other) - result will be stored in PointToPointVector point array of the output mesh use vtkWarpVector filter with PointToPointVector to warp the model to match the surface of the other model …

---

<div class="post-metadata">

**Author:** ![sandyaa0313](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sandyaa0313/32/11566_2.png) [@sandyaa0313](https://discourse.slicer.org/u/sandyaa0313)\
**Post date:** [July 2, 2021, 3:42pm UTC](https://discourse.slicer.org/t/do-projection-from-polydata-to-a-model-surface/18451/3 "2021-07-02T15:42:35Z")

</div>

I have three input models. One is the chest wall model(3d), and others are breast models(surfaces).  
My goal is to calculate the breast volume. These three models are already in the correct relative positions. So I need to closing each breast model to the chest wall model.  
I have no idea now, so I think getting the new coordinates of breast model after projection(red dotted line on the chest wall) may helps. Thanks!

 ![3d_slicer](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/f/2fd9b19df7bbe47207d4860c42fc0e9e4ecf6fda.jpeg)

---

<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:** [July 2, 2021, 3:58pm UTC](https://discourse.slicer.org/t/do-projection-from-polydata-to-a-model-surface/18451/4 "2021-07-02T15:58:55Z")

</div>

We have come up with a complete workflow for measuring breast volume from surfaces, which may be exactly what you need:

- [Master thesis describing all the details](https://qspace.library.queensu.ca/jspui/bitstream/handle/1974/26146/House_Rachael_M_201904_MSc.pdf?sequence=3&isAllowed=y)
- [Slicer extension implementing all the computations](https://github.com/PerkLab/BreastReconstruction)

---

<div class="post-metadata">

**Author:** ![sandyaa0313](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sandyaa0313/32/11566_2.png) [@sandyaa0313](https://discourse.slicer.org/u/sandyaa0313)\
**Post date:** [July 4, 2021, 5:57am UTC](https://discourse.slicer.org/t/do-projection-from-polydata-to-a-model-surface/18451/5 "2021-07-04T05:57:16Z")

</div>

I’ve tried, but this module seems not to suit for my case.  
I already have chest model so I don’t have to use markup points to create the chest wall.  
Because the chest wall in breast reconstruction module is created by markup points, and markup points are situated on the breast model, it can create a closed model obviously.  
However, in my module, the chest wall model is from CT, and the breast model is from 3d scan, they are aligned but with some distance.  
I think these two modules have different ideas. The breast reconstruction model focus on the volume difference between the breasts, but I focus on the exact volume.  
So, I still want to ask how to project a breast model on the chest wall model and get its new position.  
Thank you! Sorry to ask so many questions.

I try to draw their difference. In the breast reconstruction model, the chest wall latter sticks to the surface model of 3d scan.

 ![B124BDE3-BD02-44A8-B87A-D5B10FC74262](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/3/e339ce9df1e14da8248b50d48ae4aa9d0064b9c2.jpeg)

Here is how my chest model built. The picture is in the paper you sent.  
 ![chest_wall](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/e/9ebbc573110846c0ab1afef330e81ae04fc08fab.jpeg)

---

<div class="post-metadata">

**Author:** ![sandyaa0313](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sandyaa0313/32/11566_2.png) [@sandyaa0313](https://discourse.slicer.org/u/sandyaa0313)\
**Post date:** [July 4, 2021, 4:50pm UTC](https://discourse.slicer.org/t/do-projection-from-polydata-to-a-model-surface/18451/8 "2021-07-04T16:50:28Z")

</div>

Sorry. I want to explain my goal explicitly.  
Actually I want to close these 3 models and their junctions are situated on the  
projection coordinates.  
 ![c](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/0/6026af7e900813a246dacccfe36781ce9795a210.jpeg)

---

<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:** [July 9, 2021, 2:56pm UTC](https://discourse.slicer.org/t/do-projection-from-polydata-to-a-model-surface/18451/9 "2021-07-09T14:56:56Z")

</div>

You can segment the skin surface, subtract the chest wall segment from it (using Logical operators effect), then trim the resulting segment using Scissors effect.
