# Surface mesh with multiple scalar data

**URL:** <https://discourse.slicer.org/t/surface-mesh-with-multiple-scalar-data/20868>\
**Category:** Support\
**Tags:** registration\
**Created:** [December 1, 2021, 6:35pm UTC](https://discourse.slicer.org/t/surface-mesh-with-multiple-scalar-data/20868 "2021-12-01T18:35:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [December 2, 2021, 5:46pm UTC](https://discourse.slicer.org/t/surface-mesh-with-multiple-scalar-data/20868/2 "2021-12-02T17:46:35Z")

</div>

Slicer supports loading of surface meshes (polydata) and volumetric meshes (unstructured grid).

The data set that you get from from the EP mapping system is just a point cloud (earlier CartoEP versions were also able to export the reconstructed surface but more recent ones just provide the points).

The simplest way to store a point cloud is to use a POLYDATA. You can fix test1.vtk by replacing

```auto
DATASET STRUCTURED_GRID
DIMENSIONS 49328 1 1 

```

by

```auto
DATASET POLYDATA 

```

You can load this file into Slicer and visualize by applying a vtkGlyph3D filter - by copy-pasting this into the Python console:

```python
pointsModelNode = getNode('test1')
glypher = vtk.vtkGlyph3D()
glypher.SetInputConnection(pointsModelNode.GetPolyDataConnection())
glyph = vtk.vtkSphereSource()
glypher.SetSourceConnection(glyph.GetOutputPort())
glypher.SetScaleModeToDataScalingOff()
glypher.Update()
glyphedModel = slicer.modules.models.logic().AddModel(glypher.GetOutputPort())

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/b/ab85c317a1d0fed7b980ca32aa31b03a7a841684.jpeg)

You can also reconstruct a surface:

```python
pointsModelNode = getNode('test1')
numberOfSamples = 256.0
normalSamplingFactor = 5e-5

polyData = pointsModelNode.GetPolyData()

sampleSize = max(polyData.GetNumberOfPoints() * normalSamplingFactor, 10)
normals = vtk.vtkPCANormalEstimation()
normals.SetInputData(polyData)
normals.SetSampleSize(sampleSize)
normals.SetNormalOrientationToGraphTraversal()
normals.FlipNormalsOff()

distance = vtk.vtkSignedDistance()
distance.SetInputConnection(normals.GetOutputPort())

boundingBox = vtk.vtkBoundingBox()
boundingBox.SetBounds(polyData.GetBounds())

radius = boundingBox.GetMaxLength() / numberOfSamples * 4.0 # about 4 voxels
distance.SetRadius(radius)
boundingBox.Inflate(boundingBox.GetLength(0) * .1, boundingBox.GetLength(1) * .1, boundingBox.GetLength(2) * .1)
distance.SetDimensions(int(numberOfSamples), int(numberOfSamples), int(numberOfSamples))
bounds = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
boundingBox.GetBounds(bounds)
distance.SetBounds(bounds)

surface = vtk.vtkExtractSurface()
surface.SetInputConnection(distance.GetOutputPort())
surface.SetRadius(radius * .99)
surfaceModel = slicer.modules.models.logic().AddModel(surface.GetOutputPort())

```

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/4/949d931974111992d020df8af6d10bb7bbade37c.png)

We also have a small [Slicer extension that can import EP maps](https://github.com/stephan1312/SlicerEAMapReader) that you might find useful. They could be improved to reconstruct the surface, etc. as has been discussed [here](https://discourse.slicer.org/t/import-carto-electroanatomic-maps-to-slicer/19316/6), so you might do without Matlab and just do all your analysis and visualization in Python.

What kind of visualization and analysis would you like to do?

---

_[View the full topic](https://discourse.slicer.org/t/surface-mesh-with-multiple-scalar-data/20868)._
