# Get normal vector of a model mesh at fiducial marker

**URL:** https://discourse.slicer.org/t/get-normal-vector-of-a-model-mesh-at-fiducial-marker/16192
**Category:** Support
**Created:** [February 24, 2021, 8:55pm UTC](https://discourse.slicer.org/t/get-normal-vector-of-a-model-mesh-at-fiducial-marker/16192 "2021-02-24T20:55:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![apparrilla](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/apparrilla/32/9230_2.png) [@apparrilla](https://discourse.slicer.org/u/apparrilla)
#### Post date: [February 24, 2021, 8:55pm UTC](https://discourse.slicer.org/t/get-normal-vector-of-a-model-mesh-at-fiducial-marker/16192/1 "2021-02-24T20:55:10Z")

</div>

Hi everyone!  
I´d like to get the normal vector of a model surface at a marked point with a fiducial.  
Is there any example in the script repository for this task?

Thanks on advance…

---

<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: [February 24, 2021, 11:27pm UTC](https://discourse.slicer.org/t/get-normal-vector-of-a-model-mesh-at-fiducial-marker/16192/2 "2021-02-24T23:27:33Z")

</div>

Here is the code:

```auto
fiducial = getNode('F')
model = getNode('Model')

point = [0,0,0]
fiducial.GetNthFiducialPosition(0,point)

normalsOfModel = slicer.util.arrayFromModelPointData(model, 'Normals')

modelMesh = model.GetMesh()

pointID = modelMesh.FindPoint(point)

normalAtPointID = normalsOfModel[pointID]

```

It gives the normal of the nearest-model-point to the fiducial-point

---

<div class="post-metadata">

### Author: ![apparrilla](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/apparrilla/32/9230_2.png) [@apparrilla](https://discourse.slicer.org/u/apparrilla)
#### Post date: [February 27, 2021, 12:36am UTC](https://discourse.slicer.org/t/get-normal-vector-of-a-model-mesh-at-fiducial-marker/16192/3 "2021-02-27T00:36:00Z")

</div>

It gives me some kind of problem @mau_igna_06 :

> AppData\Local\NA-MIC\Slicer 4.13.0-2021-02-16\bin\Python\slicer\util.py", line 1505, in \_vtkArrayFromModelData  
> location, arrayName, “', '”.join(availableArrayNames)))  
> ValueError: Input modelNode does not contain point data array ‘Normals’. Available array names: ‘RegionId’

It look like modelNode hasn´t normals info…

---

<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: [February 27, 2021, 1:20am UTC](https://discourse.slicer.org/t/get-normal-vector-of-a-model-mesh-at-fiducial-marker/16192/4 "2021-02-27T01:20:36Z")

</div>

You can compute normals using Surface Toolbox module.
