Surface mesh with multiple scalar data

Hello Slicer community,
I am trying to load a Polydata vtk file that I created using Matlab that contains a surface mesh with multiple scalar variables associated. I am able to load the file (test1.vtk) in Paraview and play with the scalar values using the “Find data” option but I can not load it in Slicer because it gives me the following error:

“Failed to load model from VTK file […] test1.vtk as it does not contain polydata nor unstructured grid. The file might be loadable as a volume”.

I can not load it as a volume and I have also tried to create a different VTK file that contains the scalar values but displays the anatomy in a rare fashion in Slicer (test2.vtk).

Here are the files:
test1.vtk: test1.vtk - Google Drive
test2.vtk: test2.vtk - Google Drive

Any help would be appreciated!

Thanks in advance,

Gerard

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

DATASET STRUCTURED_GRID
DIMENSIONS 49328 1 1 

by

DATASET POLYDATA 

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

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())

You can also reconstruct a surface:

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

We also have a small Slicer extension that can import EP maps that you might find useful. They could be improved to reconstruct the surface, etc. as has been discussed here, 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?

1 Like

Dear Andras,
Thanks for your help and suggestions. I will definitely take a look at the SlicerEAMapReader extension as I am sure it will simplify my workflow.
In our project we have LA infarcted pigs with EP maps and histology studies. I am using Slicer to segment the fibrosis of the histology sections and to merge this information with the EP maps. I want to correlate the regions of fibrosis to the values of bipolar voltage, etc.
Thanks again!

1 Like

What do you mean by “correlate the regions of fibrosis”?

Do you want to just visualize the regions or you need quantitative analysis, too?

How do you plan to align the histology sections? Do you have some landmarks that are visible in both of them that you can use for registration?

I would like to visualize and also perform a quantitative analysis (if I can).
I am aligning the histology sections with the tool of TrakEM2 of Image J. I am now segmenting the histology sections to create two 3D volumes, one with the scar and one with the healthy regions. My plan is to use visual landmarks in both techniques for registration.
Once this is done I want to study the bipolar values inside and outside the areas of fibrosis.