Parse CARTO study .xml file
Full example code: examples/parser/carto_study.py
The CARTO Study xml file contains all mapping data of the case. Apart from general metadata, the file contains a section for each map with all point data for that specific map.
from dgmr.parser import CartoReader
map_name = "name_of_your_map" # Map you want to parse
studyfile = "path_to_your_study_file" # Ex: Study 1 03_23_2023 14-36-21.xml
xml_data = CartoReader.load_study_file(studyfile)
map_data = CartoReader.load_map(xml_data, map_name)
idx = map_data["tags"] # Used for filtering points by type
Map tag data
A generic table containing tags to indicate point types.
tag_data = CartoReader.load_tag_info(xml_data)
print(tag_data) # Full list
print(tag_data.iloc[10]) # Details of tag with id 10
Output:
ID Short_Name Full_Name Color Radius
0 4 None None [1.0, 1.0, 1.0, 1.0] 2.0
1 204 IVC OS IVC OS [0.603922, 0.0235294, 0.47451, 1.0] 2.0
2 12 TE Transient Event [0.752941, 0.752941, 0.752941, 1.0] 2.0
3 201 LSPV OS LSPV OS [0.298039, 0.239216, 0.819608, 1.0] 2.0
4 9 ABL Ablation [0.517647, 0.0, 0.0, 1.0] 2.0
5 5 HIS His [0.937255, 0.709804, 0.129412, 1.0] 2.0
...
ID 10
Short_Name SCR
Full_Name Scar
Color [0.419608, 0.388235, 0.388235, 1.0]
Radius 1.0
Name: 10, dtype: object
Point data
Each map xml section contains a list of all points. Each point can have a tag field with id from the above list to indicate the type of point (scar, good PPI, bad PPI, ...). We can obtain sets of specific points using a mask checking for a certain id.
measured_points = map_data["points"][idx == 0]
scar_points = map_data["points"][idx == 10]
green_ppi_points = map_data["points"][idx == 26]
Anatomical points
Points can also be anatomically annotated in their own section in the xml.
Output: