# Workflow to compare two models based on their respective associated scalars

**URL:** https://discourse.slicer.org/t/workflow-to-compare-two-models-based-on-their-respective-associated-scalars/23204
**Category:** Support
**Tags:** registration, python, 3d-model
**Created:** [April 29, 2022, 10:38pm UTC](https://discourse.slicer.org/t/workflow-to-compare-two-models-based-on-their-respective-associated-scalars/23204 "2022-04-29T22:38:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tristan421](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tristan421/32/14964_2.png) [@tristan421](https://discourse.slicer.org/u/tristan421)
#### Post date: [April 29, 2022, 10:38pm UTC](https://discourse.slicer.org/t/workflow-to-compare-two-models-based-on-their-respective-associated-scalars/23204/1 "2022-04-29T22:38:52Z")

</div>

Hi, fantastic work here. Slicer is great.  
I have advanced on my own but could do with a kind and helping hand for the last step.

Very quickly :

I have two models. The fist one has been created from a segmented volume and “painted” by probevolumefrommodel. The other model is a polydata model imported from an electro-anatomical CARTO® map. **I need to compare the values associated with those two models on a “point by point” basis** , to draw some correlation.

What I did :

1. I created 5000 fiducials points on the first model,

2. I registered the model to the other one by means of non rigid transformation, and applied this transformation to the fiducials.

3. I projected the 5000 transformed points to the second model using nearest distance projection. I now have 2 sets of related fiducials, one on each model surface, that i would like to compare in term of the underlying scalar data.

How should I proceed in order to sample each model at each and every fiducial point ?

Alternativly I could use another approach if more practical.

Regards, and again many thanks for this gem of a software.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [April 30, 2022, 5:15pm UTC](https://discourse.slicer.org/t/workflow-to-compare-two-models-based-on-their-respective-associated-scalars/23204/2 "2022-04-30T17:15:33Z")

</div>

Hi - great that you are finding Slicer useful 👍

A couple thoughts - if you are trying to find the values you painted onto the module with ProbeVolumeFromModel, you could just look up the points in the volume, [like this](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#get-volume-voxel-coordinates-from-markup-control-point-ras-coordinates).

Or if you are going the other way and want to sample on the carto volume, you can use a [locator](https://vtk.org/doc/nightly/html/classvtkPointLocator.html) to get the point indices and look up the scalar data.

---

<div class="post-metadata">

### Author: ![tristan421](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/tristan421/32/14964_2.png) [@tristan421](https://discourse.slicer.org/u/tristan421)
#### Post date: [May 7, 2022, 10:24pm UTC](https://discourse.slicer.org/t/workflow-to-compare-two-models-based-on-their-respective-associated-scalars/23204/3 "2022-05-07T22:24:25Z")

</div>

Thank you, it works like a charm. I did something like that to iterate on the fiducials. Perfect

> Blockquote

for i in range(numControlPoints):

```
ras = vtk.vtkVector3d(0,0,0)
pointListNode.GetNthControlPointPosition(i,ras)
closestPointId = pointsLocator.FindClosestPoint(ras)
ras = modelNode.GetPolyData().GetPoint(closestPointId)
closestPointValue = modelPointValues.GetTuple(closestPointId)
measurements.append(str(closestPointValue[0]))

```

slicer.app.clipboard().setText(“\n”.join(measurements))
