Skip to content

opencarp_reader

OpencarpReader

OpencarpReader can load and parse any type of data from OpenCARP simulations.

load(vtk_filepath, igb_filepath, scale=1000, scar=True) staticmethod

Load coordinates, triangles and scalars.

Parameters:

Name Type Description Default
vtk_filepath str

The path to the mesh file.

required
igb_filepath str

The path to the mesh file.

required
scale int

Conversion factor to ms. Defaults to 1000.

1000
scar bool

Remove scar tissue from mesh or not. Defaults to True.

True

Returns:

Name Type Description
tuple tuple[ndarray, ndarray, ndarray]

A tuple containing a list of coordinates, triangle ids and scalars

load_elem_file(filepath, element_type='Tr') staticmethod

Load mesh elements from file.

Parameters:

Name Type Description Default
filepath str

Filepath to the input file.

required
element_type str

Mesh element type. Defaults to 'Tr'.

'Tr'

Returns:

Type Description
DataFrame

dataframe with elements data.

load_igb_file(filepath) staticmethod

Parse OpenCARP .igb file.

Parameters:

Name Type Description Default
filepath str

Filepath to the igb file.

required

Returns:

Type Description
DataFrame

np.ndarray with parsed simulation data.

load_mesh(pts_filepath, elem_filepath, scale=1000, element_type='Tr') staticmethod

Load mesh from .pts and .elem files. By defaults, elements are triangles.

Parameters:

Name Type Description Default
pts_filepath str

The path to the points file.

required
elem_filepath str

The path to the elements file.

required
scale int

Conversion factor to ms. Defaults to 1000.

1000
element_type str

Type of geometric elements of the mesh. Defaults to "Tr".

'Tr'

Returns:

Name Type Description
tuple (DataFrame, DataFrame)

Dataframes of points and triangles.

load_pts_file(filepath, scale=1) staticmethod

load_signal(signals, index, tag='unipolar') staticmethod

load_signals(igb_data, tag='unipolar') staticmethod

load_vtk_file(filepath, scale=1000) staticmethod

Load OpenCARP .vtk file.

Parameters:

Name Type Description Default
filepath str

Filepath to the vtk file.

required
scale int

Conversion factor to ms. Defaults to 1000.

1000

Returns:

Name Type Description
dict dict

Mesh data.

signal_to_lat(data, voltage=-40) staticmethod

Convert opencarp signal data to lats.

Parameters:

Name Type Description Default
data ndarray

Data from parsed igb file.

required
voltage optional

Voltage threshold. Defaults to -40.

-40

Returns:

Type Description
ndarray

lat values.