Import Carto electroanatomic maps to slicer

I would like to ask for a little help with cardiac electroanatomic map importing.
There was a similar issue a while ago, where eventually a new module was born, however it looks like it won’t work with CARTO files.
I have the .txt files and a really nice explanation of the values, however I lack the skills to recreate a script that builds the models from the coordinates.
The attached screenshot shows what the different values refer to, and I’d like to create a model with the exact shape of the atrium and also the bipolar value (Which we will compare to segmentations).
As far as I know, that means I need the the E, F, G, and L columns to build the model.
Does someone have any idea where I could start to build a script, or if there is a module already published?
Screenshot 2021-08-23 at 15.01.17

Probably the existing Carto file reader can be fixed up to work with your file variant. Can you share a complete study that we can test with? (anonymized or phantom data set)

Thank you!
Here is the file
And the full table about the values
Screenshot 2021-08-23 at 9.38.02

Can you also get a mesh file (.vtk or .stl or other format) from Carto? The points could be used to reconstruct a mesh, but it is not completely trivial

The EA Map Reader expects a zip file from Carto, with the point list text file named as ..._car.txt, mesh file named as ....mesh, and ablation sites file named as VisiTagExport/Sites.txt. Do you get such zip file from your Carto system?

I could load your text file if I renamed as the extension expected it and could create a left atrium mesh using Markups to Model extension:

But it would be better to use the mesh the Carto creates, to be consistent. Also, we would need to find a VTK filter that can nicely map the bipolar or other values from the measurement points to the mesh - while this mapping is probably already available in the mesh file that Carto exported.

Unfortunately I only have these .txt files.
When I try to import the .zip file as you suggested, the EA Map Reader module starts to extract it, but stops at 10%.

Import of this file worked for me:
https://1drv.ms/u/s!Arm_AFxB9yqHxf4bPBvcr9SQKhzj8w?e=xm6aYW

You need to wait several minutes, because the module does block updates while placing points one by one. I’ve submitted a pull request that makes the import faster (still a few ten seconds).

Did you acquire the files yourself? Can you describe the steps of how you exported the data from Carto?

There is lots of room for improvements in the module. It should be possible to speed up the import, store all the values as measurements, maybe add an option to load the points as colored glyphs (can be generated from the fiducials), and of course it could be made a proper extension that can be installed from the Extensions manager by a few clicks.

@stephan are you still around? Would you be interested in making some improvements and submitting the extension to the Extensions index so that EA Map Reader shows up in the Extensions manager?

We don’t create them, we just receive them for further analysis.
The one you sent me works well, it imports as markup points in a few seconds.

However, the ones I have seem to crash Slicer at 10%.
I left it running for hours, but the whole program stopped responding.

I’ve just renamed the file that I got from you and zipped it.

Could you please ask the clinicians to describe how they export the files (what software version they use, what export options does the software offers and what they choose, what files are exported, what files they choose to share with you,…)? There is a good chance they can have the mesh files, too, they just might think that you don’t need it.

Hi everybody,
sorry for not responding earlier.
@lassoan : In general, I am still around, but since I am not longer on the research fellowship I was on 2 years ago (when I wrote the extension an learned Python in the process) I do not really have the time for maintenance and improvements. The fact that the extension was my first encounter with Python might also explain the huge room for improvement in efficiency and coding style. Please feel free :wink:
I’ve tried to figure out how to package the extension so that it can be submitted to the extension index, but I never really understood is (it seems you need a full-blown IDE with CMAKE and other version control stuff to package it, not to mention all the unit testing). Anyone wanting to adopt the project is very welcome.

@mk.kassai : Carto v7 exports should still be importable as anatomy only (without voltage and activation time data). You might want to point your clinicians to the following step-by-step export tutorial:

  1. On the start-up screen, select “Review Study”. Open study for review

  2. Select Study → Export Study Data… from the menu

  3. Close study review

  4. Back in the start-up screen, select “System”

  5. In the “System tools” menu, select the Export Data… button

  6. Select the correct patient. After the prior export (step 3), there should be a file called “Export_Study_[some numbers].zip” with today’s date and “RawData” in the “Type” column

  7. Select this file for export (by clicking the arrow to the right of the file list), select the export target at the bottom of the screen, and hit export. You have to chose a password for the export.

  8. The actual study data .zip file is exported inside another (encrypted) .zip file which needs to be unpacked first. So open the .zip file with any zip extractor using the password you chose in step 8. Inside this password-protected “container” zip file there should be the actual study zip (named “Export_Study_[some numbers].zip”). Extract this file out of the container, using the password you chose.

  9. This (unencrypted) .zip file which you just took out of the export container is ready for import using EAMapReader

The interpolated electric data which previously was part of the .mesh file is no longer exported in v7. However, electric data per point (NOT per anatomy vertex, but per catheter-acquired point in space) is available in the *_car.txt files. For more detail see here: Change in exported data in Carto3 v7 · Issue #4 · stephan1312/SlicerEAMapReader · GitHub
Thus, one could re-create interpolated electric (bipolar, unipolar voltage and LAT) data for each model vertex and add this as a scalar overlay, but this needs to be done in the plugin, since the interpolation is no longer available in the export (I think this is due to the so-called HD coloring feature which became available first in v6 and broke the export when active. In v7 this can no longer be turned off.)

The file you shared in post #3 is actually the _car.txt file (and I am pretty sure it was named 1-OG_car.txt when it was first exported). It should have come inside a .zip file, accompanied by (among others) a file named 1-OG.mesh. This entire zip file could be read by EAMapReader.

Let me know if there is anything else I could do

Stephan

1 Like

Dear Stephen and Andras,

Thank you for your replies.
So it seems that currently the only file that contains the electric values is the .txt file.
I’m still a beginner in python, but do you have some tips about where I could start to improve the module as Stephan explained, to re-create the interpolated electric data?

This is correct.
Depending on your use case, you might not even need the interpolation. The .txt file gives you “raw” electric and spatial data. If you need anatomy as well(e.g. for registration purposes), the .mesh file contains a triangulated mesh (same coordinate space as the txt file).
However, if you need to recreate the look of the map as seen on the CARTO workstation, the projection/interpolation needs to be calculated.

I found the .mesh file for the same patient, however for me it seems like its the newer version, that only contains the anatomic data as coordinates, but not the voltage, as @stephan explained.

The EA mapper can nicely read this mesh file. The mesh that “Markups to model” generated looks quite similar:

However, on one side VTK’s Delaunay triangulator was not able to follow the points as closely as Carto:

Therefore, for the registration you will benefit from importing the Carto-generated mesh. There are a number of other surface reconstruction filters in VTK that can create a surface from sparse points, but it is not an easy problem because the points are distributed very unevenly.

@mk.kassai What is your end goal with the bipolar value? Just visualization? Would showing the bipolar value as colored spheres (and not interpolated on the surface) be sufficient for you?

Our goal is to compare some segmentations to these points, so showing them as colored spheres (Or being able to threshold them by bipolar voltage value, and compare the segmentations to those) would be perfect for us.

Sounds very doable then. You can generate a model that contains colored spheres using vtkGlyph3D filter. You provide a vtkPolyData as input, you use the xyz coordinates as point positions, and you put the bipolar values into a vtkDoubleArray and you add that as point data.

Perfect, thank you!
I really appreciate your help with all of this @lassoan @stephan.

Dear Andras,

My python skills are close to zero, so I could not figure out a way to use the suggested solution.
For the analysis part, I’m ok with the thresholded bipolar voltages, but I would like to re-create the carto map in Slicer simply for visualization purposes.
Since all we have are these coordinates with values and the mesh, I’d like to “paint” the mesh the same way it looks like on the original carto map (attached screenshots from Carto).
Could you please show me a way to start, to understand the usage of vtkGlyph3D to re-create something like the carto map?

1 Like

Dear Andras,
Could you please let me know the way to import the txt file only? to which extension you renamed the text file?
When I try to import the .zip file as you suggested, the EA Map Reader module starts to extract it but stops at 10% or 30%. Do I need to keep only ..._car.txt , mesh file and …_car.txt inside the zip file to be imported by Slicer?
I can’t either import any [EA_map.zip] file as you explained above or find the Markups to Model extension.

Thank you for your help!
Raha

Hi,
I can see in some Carto files (.mesh), Group IDs are 0s and -1000000s. Does that mean something affecting for the map?
Cheers.

Hi,
When Wavefront Annotation is used, a “No valid LAT” points have a value of -10000