diff --git a/openep/data_structures/surface.py b/openep/data_structures/surface.py index 8fe633a9..bb9988d1 100644 --- a/openep/data_structures/surface.py +++ b/openep/data_structures/surface.py @@ -195,10 +195,15 @@ def extract_surface_data(surface_data): pacing_site = None try: - conduction_velocity = surface_data['conduction_velocity'].astype(float) + conduction_velocity = surface_data['signalMaps']['conduction_velocity_field']['value'].astype(float) except KeyError as e: conduction_velocity = None - + + try: + cv_divergence = surface_data['signalMaps']['divergence_field']['value'].astype(float) + except KeyError as e: + cv_divergence = None + try: mesh_normals = surface_data['mesh_normals'].astype(float) except KeyError as e: @@ -253,8 +258,6 @@ def empty_fields(n_points=0, n_cells=0): longitudinal_fibres, transverse_fibres, pacing_site, - conduction_velocity, - mesh_normals, ) return fields diff --git a/openep/io/writers.py b/openep/io/writers.py index 2fe36b5f..7b503371 100644 --- a/openep/io/writers.py +++ b/openep/io/writers.py @@ -211,6 +211,7 @@ def export_openep_mat( oned_as='column', ) + def _add_surface_maps(surface_data, **kwargs): cv_field = kwargs.get('cv_field') div_field = kwargs.get('divergence_field') @@ -218,24 +219,24 @@ def _add_surface_maps(surface_data, **kwargs): if not surface_data.get('signalMaps'): surface_data['signalMaps'] = {} - # TODO: connect propSetting from user setting - # TODO: handle with None values as matlab cannot handle + # TODO: connect propSetting from user setting in UI if cv_field is not None: surface_data['signalMaps']['conduction_velocity_field'] = { - 'name' : 'Conduction Velocity Field', + 'name': 'Conduction Velocity Field', 'value': cv_field, - # 'propSettings':None, + 'propSettings': {}, } if div_field is not None: surface_data['signalMaps']['divergence_field'] = { - 'name' : 'Divergence Field', + 'name': 'Divergence Field', 'value': div_field, - # 'propSettings':None, + 'propSettings': {}, } return surface_data + def _add_electric_signal_props(electric_data, **kwargs): conduction_velocity = kwargs.get('conduction_velocity') divergence = kwargs.get('divergence') @@ -249,7 +250,6 @@ def _add_electric_signal_props(electric_data, **kwargs): signal_props = electric_data['annotations']['signalProps'] if conduction_velocity: - #TODO: connect propSetting from user setting signal_props['conduction_velocity'] = { 'name' : 'Conduction Velocity Values', 'value': conduction_velocity.values, @@ -260,7 +260,6 @@ def _add_electric_signal_props(electric_data, **kwargs): } if divergence: - #TODO: connect propSetting from user setting signal_props['divergence'] = { 'name' : 'Divergence Values', 'value': divergence.values, @@ -268,6 +267,7 @@ def _add_electric_signal_props(electric_data, **kwargs): return electric_data + def export_vtk( case: Case, filename: str, @@ -366,7 +366,6 @@ def _extract_surface_data( surface_data['longitudinal'] = fields.longitudinal_fibres if fields.longitudinal_fibres is not None else empty_float_array surface_data['transverse'] = fields.transverse_fibres if fields.transverse_fibres is not None else empty_float_array surface_data['pacing_site'] = fields.pacing_site if fields.pacing_site is not None else empty_int_array - surface_data['conduction_velocity'] = fields.conduction_velocity if fields.conduction_velocity is not None else empty_int_array surface_data['mesh_normals'] = fields.mesh_normals if fields.mesh_normals is not None else empty_int_array # Remove arrays that are full of NaNs