本文整理匯總了Python中tvb.core.adapters.abcdisplayer.ABCDisplayer.paths2url方法的典型用法代碼示例。如果您正苦於以下問題:Python ABCDisplayer.paths2url方法的具體用法?Python ABCDisplayer.paths2url怎麽用?Python ABCDisplayer.paths2url使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tvb.core.adapters.abcdisplayer.ABCDisplayer
的用法示例。
在下文中一共展示了ABCDisplayer.paths2url方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: prepare_mapped_sensors_as_measure_points_params
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def prepare_mapped_sensors_as_measure_points_params(project_id, sensors, eeg_cap=None):
"""
Compute sensors positions by mapping them to the ``eeg_cap`` surface
If ``eeg_cap`` is not specified the mapping will use a default EEGCal DataType in current project.
If no default EEGCap is found, return sensors as they are (not projected)
:returns: dictionary to be used in Viewers for rendering measure_points
:rtype: dict
"""
if eeg_cap is None:
eeg_cap = dao.try_load_last_entity_of_type(project_id, EEGCap)
if eeg_cap:
datatype_kwargs = json.dumps({'surface_to_map': eeg_cap.gid})
sensor_locations = ABCDisplayer.paths2url(sensors, 'sensors_to_surface') + '/' + datatype_kwargs
sensor_no = sensors.number_of_sensors
sensor_labels = ABCDisplayer.paths2url(sensors, 'labels')
return {'urlMeasurePoints': sensor_locations,
'urlMeasurePointsLabels': sensor_labels,
'noOfMeasurePoints': sensor_no,
'minMeasure': 0,
'maxMeasure': sensor_no,
'urlMeasure': ''}
return prepare_sensors_as_measure_points_params(sensors)
示例2: get_sensor_measure_points
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def get_sensor_measure_points(sensors):
"""
Returns urls from where to fetch the measure points and their labels
"""
measure_points = ABCDisplayer.paths2url(sensors, 'locations')
measure_points_no = sensors.number_of_sensors
measure_points_labels = ABCDisplayer.paths2url(sensors, 'labels')
return measure_points, measure_points_labels, measure_points_no
示例3: retrieve_measure_points
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def retrieve_measure_points(self, time_series):
"""
To be overwritten method, for retrieving the measurement points (region centers, EEG sensors).
"""
if isinstance(time_series, TimeSeriesSurface):
return [], [], 0
measure_points = ABCDisplayer.paths2url(time_series.connectivity, 'centres')
measure_points_labels = ABCDisplayer.paths2url(time_series.connectivity, 'region_labels')
measure_points_no = time_series.connectivity.number_of_regions
return measure_points, measure_points_labels, measure_points_no
示例4: prepare_sensors_as_measure_points_params
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def prepare_sensors_as_measure_points_params(sensors):
"""
Returns urls from where to fetch the measure points and their labels
"""
sensor_locations = ABCDisplayer.paths2url(sensors, 'locations')
sensor_no = sensors.number_of_sensors
sensor_labels = ABCDisplayer.paths2url(sensors, 'labels')
return {'urlMeasurePoints': sensor_locations,
'urlMeasurePointsLabels': sensor_labels,
'noOfMeasurePoints': sensor_no,
'minMeasure': 0,
'maxMeasure': sensor_no,
'urlMeasure': ''}
示例5: launch
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def launch(self, **kwargs):
self.log.debug("Plot started...")
input_data = kwargs['input_data']
shape = list(input_data.read_data_shape())
state_list = input_data.source.labels_dimensions.get(input_data.source.labels_ordering[1], [])
mode_list = range(shape[3])
available_scales = ["Linear", "Logarithmic"]
params = dict(matrix_shape=json.dumps([shape[0], shape[2]]),
plotName=input_data.source.type,
url_base=ABCDisplayer.paths2url(input_data, "get_fourier_data", parameter=""),
xAxisName="Frequency [kHz]",
yAxisName="Power",
available_scales=available_scales,
state_list=state_list,
mode_list=mode_list,
normalize_list=["no", "yes"],
normalize="no",
state_variable=state_list[0],
mode=mode_list[0],
xscale=available_scales[0],
yscale=available_scales[0],
x_values=json.dumps(input_data.frequency[slice(shape[0])].tolist()),
xmin=input_data.freq_step,
xmax=input_data.max_freq)
return self.build_display_result("fourier_spectrum/view", params)
示例6: compute_params
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def compute_params(self, region_mapping_volume=None, measure=None, data_slice='', background=None):
region_mapping_volume = self._ensure_region_mapping(region_mapping_volume)
volume = region_mapping_volume.volume
volume_shape = region_mapping_volume.read_data_shape()
volume_shape = (1, ) + volume_shape
if measure is None:
params = self._compute_region_volume_map_params(region_mapping_volume)
else:
params = self._compute_measure_params(region_mapping_volume, measure, data_slice)
url_voxel_region = ABCDisplayer.paths2url(region_mapping_volume, "get_voxel_region", parameter="")
params.update(volumeShape=json.dumps(volume_shape),
volumeOrigin=json.dumps(volume.origin.tolist()),
voxelUnit=volume.voxel_unit,
voxelSize=json.dumps(volume.voxel_size.tolist()),
urlVoxelRegion=url_voxel_region)
if background is None:
background = dao.try_load_last_entity_of_type(self.current_project_id, StructuralMRI)
params.update(self._compute_background(background))
return params
示例7: retrieve_measure_points_prams
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def retrieve_measure_points_prams(self, time_series):
"""
To be overwritten method, for retrieving the measurement points (region centers, EEG sensors).
"""
if self.connectivity is None:
self.measure_points_no = 0
return {'urlMeasurePoints': [],
'urlMeasurePointsLabels': [],
'noOfMeasurePoints': 0}
measure_points = ABCDisplayer.paths2url(self.connectivity, 'centres')
measure_points_labels = ABCDisplayer.paths2url(self.connectivity, 'region_labels')
self.measure_points_no = self.connectivity.number_of_regions
return {'urlMeasurePoints': measure_points,
'urlMeasurePointsLabels': measure_points_labels,
'noOfMeasurePoints': self.measure_points_no}
示例8: launch
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def launch(self, connectivity):
"""Construct data for visualization and launch it."""
pars = {"labels": json.dumps(connectivity.region_labels.tolist()),
"url_base": ABCDisplayer.paths2url(connectivity, attribute_name="weights", flatten="True")
}
return self.build_display_result("connectivity_edge_bundle/view", pars)
示例9: _compute_background
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def _compute_background(background):
if background is not None:
min_value, max_value = background.get_min_max_values()
url_volume_data = ABCDisplayer.paths2url(background, 'get_volume_view', parameter='')
else:
min_value, max_value = 0, 0
url_volume_data = None
return dict( minBackgroundValue=min_value, maxBackgroundValue=max_value,
urlBackgroundVolumeData = url_volume_data )
示例10: compute_sensor_surfacemapped_measure_points
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def compute_sensor_surfacemapped_measure_points(project_id, sensors, eeg_cap=None):
"""
Compute sensors positions by mapping them to the ``eeg_cap`` surface
If ``eeg_cap`` is not specified the mapping will use a default.
It returns a url from where to fetch the positions
If no default is available it returns None
:returns: measure points, measure points labels, measure points number
:rtype: tuple
"""
if eeg_cap is None:
eeg_cap = dao.get_values_of_datatype(project_id, EEGCap)[0]
if eeg_cap:
eeg_cap = ABCDisplayer.load_entity_by_gid(eeg_cap[-1][2])
if eeg_cap:
datatype_kwargs = json.dumps({'surface_to_map': eeg_cap.gid})
measure_points = ABCDisplayer.paths2url(sensors, 'sensors_to_surface') + '/' + datatype_kwargs
measure_points_no = sensors.number_of_sensors
measure_points_labels = ABCDisplayer.paths2url(sensors, 'labels')
return measure_points, measure_points_labels, measure_points_no
示例11: _compute_measure_params
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def _compute_measure_params(self, region_mapping_volume, measure, data_slice):
# prepare the url that will project the measure onto the region volume map
metadata = measure.get_metadata('array_data')
min_value, max_value = metadata[measure.METADATA_ARRAY_MIN], metadata[measure.METADATA_ARRAY_MAX]
measure_shape = measure.get_data_shape('array_data')
if not data_slice:
data_slice = self.get_default_slice(measure_shape, region_mapping_volume.connectivity.number_of_regions)
data_slice = slice_str(data_slice)
datatype_kwargs = json.dumps({'mapped_array': measure.gid})
url_volume_data = ABCDisplayer.paths2url(region_mapping_volume, "get_mapped_array_volume_view")
url_volume_data += '/' + datatype_kwargs + '?mapped_array_slice=' + data_slice + ';'
return dict( minValue=min_value, maxValue=max_value,
urlVolumeData=url_volume_data,
measureShape=slice_str(measure_shape),
measureSlice=data_slice)
示例12: launch
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def launch(self, input_data, **kwargs):
"""
Draw interactive display.
"""
self.log.debug("Plot started...")
params = dict(plotName=input_data.source.type,
xAxisName="Frequency [kHz]",
yAxisName="CohSpec",
available_xScale=["Linear", "Logarithmic"],
available_spectrum=json.dumps(input_data.spectrum_types),
spectrum_list=input_data.spectrum_types,
xscale="Linear",
spectrum=input_data.spectrum_types[0],
url_base=ABCDisplayer.paths2url(input_data, "get_spectrum_data", parameter=""),
# TODO investigate the static xmin and xmax values
xmin=0.02,
xmax=0.8)
return self.build_display_result("complex_coherence/view", params)
示例13: compute_params
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def compute_params(self, region_mapping_volume=None, measure=None, data_slice=''):
region_mapping_volume = self._ensure_region_mapping(region_mapping_volume)
volume = region_mapping_volume.volume
volume_shape = region_mapping_volume.read_data_shape()
volume_shape = (1, ) + volume_shape
if measure is None:
params = self._compute_region_volume_map_params(region_mapping_volume)
else:
params = self._compute_measure_params(region_mapping_volume, measure, data_slice)
url_voxel_region = ABCDisplayer.paths2url(region_mapping_volume, "get_voxel_region", parameter="")
params.update(volumeShape=json.dumps(volume_shape),
volumeOrigin=json.dumps(volume.origin.tolist()),
voxelUnit=volume.voxel_unit,
voxelSize=json.dumps(volume.voxel_size.tolist()),
urlVoxelRegion=url_voxel_region)
return params
示例14: launch
# 需要導入模塊: from tvb.core.adapters.abcdisplayer import ABCDisplayer [as 別名]
# 或者: from tvb.core.adapters.abcdisplayer.ABCDisplayer import paths2url [as 別名]
def launch(self, background=None):
volume = background.volume
volume_shape = background.read_data_shape()
volume_shape = (1,) + volume_shape
min_value, max_value = background.get_min_max_values()
url_volume_data = ABCDisplayer.paths2url(background, 'get_volume_view', parameter='')
params = dict(title="MRI Volume visualizer",
minValue=min_value, maxValue=max_value,
urlVolumeData=url_volume_data,
volumeShape=json.dumps(volume_shape),
volumeOrigin=json.dumps(volume.origin.tolist()),
voxelUnit=volume.voxel_unit,
voxelSize=json.dumps(volume.voxel_size.tolist()),
urlVoxelRegion='',
minBackgroundValue=min_value, maxBackgroundValue=max_value,
urlBackgroundVolumeData='')
return self.build_display_result("time_series_volume/staticView", params,
pages=dict(controlPage="time_series_volume/controls"))