def _params_meg_sensors(self, meg_sensors, projection_surface=None, shell_surface=None): params = prepare_sensors_as_measure_points_params(meg_sensors) params.update({ 'shelfObject': prepare_shell_surface_urls(self.current_project_id, shell_surface), 'urlVertices': '', 'urlTriangles': '', 'urlLines': '[]', 'urlNormals': '', 'boundaryURL': '', 'urlRegionMap': '' }) if projection_surface is not None: params.update(self._compute_surface_params(projection_surface)) return self.build_display_result( "sensors/sensors_eeg", params, pages={"controlPage": "sensors/sensors_controls"})
def launch(self, view_model): # type: (TractViewerModel) -> dict from tvb.adapters.visualizers.surface_view import prepare_shell_surface_urls url_track_starts, url_track_vertices = view_model.tracts.get_urls_for_rendering( ) if view_model.tracts.region_volume_map is None: raise Exception( 'only tracts with an associated region volume map are supported at this moment' ) connectivity = view_model.tracts.region_volume_map.connectivity params = dict(title="Tract Visualizer", shelfObject=prepare_shell_surface_urls( self.current_project_id, view_model.shell_surface, preferred_type=CorticalSurface), urlTrackStarts=url_track_starts, urlTrackVertices=url_track_vertices) params.update( self.build_params_for_selectable_connectivity(connectivity)) return self.build_display_result( "tract/tract_view", params, pages={"controlPage": "tract/tract_viewer_controls"})
def _params_eeg_sensors(self, eeg_sensors, eeg_cap=None, shell_surface=None): params = prepare_mapped_sensors_as_measure_points_params( self.current_project_id, eeg_sensors, eeg_cap) params.update({ 'shelfObject': prepare_shell_surface_urls(self.current_project_id, shell_surface), 'urlVertices': '', 'urlTriangles': '', 'urlLines': '[]', 'urlNormals': '' }) if eeg_cap is not None: params.update(self._compute_surface_params(eeg_cap)) return self.build_display_result( "sensors/sensors_eeg", params, pages={"controlPage": "sensors/sensors_controls"})
def launch(self, tracts, shell_surface=None): url_track_starts, url_track_vertices = tracts.get_urls_for_rendering() if tracts.region_volume_map is None: raise Exception( 'only tracts with an associated region volume map are supported at this moment' ) connectivity = tracts.region_volume_map.connectivity params = dict(title="Tract Visualizer", shelfObject=prepare_shell_surface_urls( self.current_project_id, shell_surface, preferred_type=CorticalSurface), urlTrackStarts=url_track_starts, urlTrackVertices=url_track_vertices) params.update( self.build_template_params_for_subselectable_datatype( connectivity)) return self.build_display_result( "tract/tract_view", params, pages={"controlPage": "tract/tract_viewer_controls"})
def _params_internal_sensors(self, internal_sensors, shell_surface=None): params = prepare_sensors_as_measure_points_params(internal_sensors) params['shelfObject'] = prepare_shell_surface_urls(self.current_project_id, shell_surface) return self.build_display_result('sensors/sensors_internal', params, pages={'controlPage': 'sensors/sensors_controls'})
def _params_internal_sensors(self, internal_sensors, shell_surface=None): params = prepare_sensors_as_measure_points_params(internal_sensors) params['shelfObject'] = prepare_shell_surface_urls( self.current_project_id, shell_surface) return self.build_display_result( 'sensors/sensors_internal', params, pages={'controlPage': 'sensors/sensors_controls'})
def _params_internal_sensors(self, internal_sensors, shell_surface=None): params = prepare_sensors_as_measure_points_params(internal_sensors) if shell_surface is None: shell_surface = dao.try_load_last_entity_of_type(self.current_project_id, CorticalSurface) params['shelfObject'] = prepare_shell_surface_urls(self.current_project_id, shell_surface) return self.build_display_result('sensors/sensors_internal', params, pages={'controlPage': 'sensors/sensors_controls'})
def _params_internal_sensors(self, internal_sensors, shell_surface=None): params = prepare_sensors_as_measure_points_params(internal_sensors) if shell_surface is None: shell_surface = dao.try_load_last_entity_of_type( self.current_project_id, CorticalSurface) params['shelfObject'] = prepare_shell_surface_urls( self.current_project_id, shell_surface) return self.build_display_result( 'sensors/sensors_internal', params, pages={'controlPage': 'sensors/sensors_controls'})
def _params_meg_sensors(self, meg_sensors, projection_surface=None, shell_surface=None): params = prepare_sensors_as_measure_points_params(meg_sensors) params.update({ 'shelfObject': prepare_shell_surface_urls(self.current_project_id, shell_surface), 'urlVertices': '', 'urlTriangles': '', 'urlLines': '[]', 'urlNormals': '', 'boundaryURL': '', 'urlRegionMap': ''}) if projection_surface is not None: params.update(self._compute_surface_params(projection_surface)) return self.build_display_result("sensors/sensors_eeg", params, pages={"controlPage": "sensors/sensors_controls"})
def _params_eeg_sensors(self, eeg_sensors, eeg_cap=None, shell_surface=None): params = prepare_mapped_sensors_as_measure_points_params(self.current_project_id, eeg_sensors, eeg_cap) params.update({ 'shelfObject': prepare_shell_surface_urls(self.current_project_id, shell_surface), 'urlVertices': '', 'urlTriangles': '', 'urlLines': '[]', 'urlNormals': '' }) if eeg_cap is not None: params.update(self._compute_surface_params(eeg_cap)) return self.build_display_result("sensors/sensors_eeg", params, pages={"controlPage": "sensors/sensors_controls"})
def compute_parameters(self, time_series, shell_surface=None): """ Create the required parameter dictionary for the HTML/JS viewer. :rtype: `dict` :raises Exception: when * number of measure points exceeds the maximum allowed * a Face object cannot be found in database """ self.populate_surface_fields(time_series) url_vertices, url_normals, url_lines, url_triangles, url_region_map = self.surface.get_urls_for_rendering(True, self.region_map) hemisphere_chunk_mask = self.surface.get_slices_to_hemisphere_mask() params = self.retrieve_measure_points_prams(time_series) if not self.one_to_one_map and self.measure_points_no > MAX_MEASURE_POINTS_LENGTH: raise Exception("Max number of measure points " + str(MAX_MEASURE_POINTS_LENGTH) + " exceeded.") base_activity_url, time_urls = self._prepare_data_slices(time_series) min_val, max_val = time_series.get_min_max_values() legend_labels = self._compute_legend_labels(min_val, max_val) data_shape = time_series.read_data_shape() state_variables = time_series.labels_dimensions.get(time_series.labels_ordering[1], []) if self.surface and self.region_map: boundary_url = self.surface.get_url_for_region_boundaries(self.region_map) else: boundary_url = '' params.update(dict(title="Cerebral Activity: " + time_series.title, isOneToOneMapping=self.one_to_one_map, urlVertices=json.dumps(url_vertices), urlTriangles=json.dumps(url_triangles), urlLines=json.dumps(url_lines), urlNormals=json.dumps(url_normals), urlRegionMap=json.dumps(url_region_map), base_activity_url=base_activity_url, time=json.dumps(time_urls), minActivity=min_val, maxActivity=max_val, legendLabels=legend_labels, labelsStateVar=state_variables, labelsModes=range(data_shape[3]), extended_view=False, shelfObject=prepare_shell_surface_urls(self.current_project_id, shell_surface), biHemispheric=self.surface.bi_hemispheric, hemisphereChunkMask=json.dumps(hemisphere_chunk_mask), time_series=time_series, pageSize=self.PAGE_SIZE, urlRegionBoundaries=boundary_url, measurePointsLabels=time_series.get_space_labels(), measurePointsTitle=time_series.title)) params.update(self.build_template_params_for_subselectable_datatype(time_series)) return params
def launch(self, tracts, shell_surface=None): url_track_starts, url_track_vertices = tracts.get_urls_for_rendering() if tracts.region_volume_map is None: raise Exception('only tracts with an associated region volume map are supported at this moment') connectivity = tracts.region_volume_map.connectivity params = dict(title="Tract Visualizer", shelfObject=prepare_shell_surface_urls(self.current_project_id, shell_surface, preferred_type=CorticalSurface), urlTrackStarts=url_track_starts, urlTrackVertices=url_track_vertices) params.update(self.build_template_params_for_subselectable_datatype(connectivity)) return self.build_display_result("tract/tract_view", params, pages={"controlPage": "tract/tract_viewer_controls"})