Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TVB-2359 New dual brain visualizer for time series #43

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
793b887
Init Commit.
kimonoki May 15, 2018
3d0fe1c
TVB-2367 Add content in the controls panel
kimonoki May 15, 2018
821be68
TVB-2367 Add 3D view's template
kimonoki May 15, 2018
9de5985
TVB-2367 Merge the js files into the new viewer
kimonoki May 15, 2018
476b33f
TVB-2367 Add the section view's title for the new viewer
kimonoki May 16, 2018
31ca3df
TVB-2367 Change the online help id to new-brain-dual-visualiser
kimonoki May 16, 2018
89ae09b
TVB-2367 Remove unused controls: spacing and pages
kimonoki May 24, 2018
d2a989f
TVB-2368 Implementation of the 2D display
kimonoki May 25, 2018
8c5bc0a
TVB-2368 Fix the scrolling
kimonoki May 25, 2018
ea37432
Remove unused dependency d3tip
kimonoki May 27, 2018
ff05b7d
TVB-2368 Fix the scrolling
kimonoki May 28, 2018
aa5d4f0
TVB-2370 Display time selection range
kimonoki Jun 6, 2018
684ecbb
TVB-2369 Display spheres in the dual viewer
kimonoki Jun 6, 2018
de5c56b
TVB-2369 Fix shader's directory
kimonoki Jun 7, 2018
1a322c1
TVB-2370 Fix brush's styling
kimonoki Jun 7, 2018
988ebf4
TVB-2370 Fix all the stroke boundary styling in the brush
kimonoki Jun 7, 2018
e0e9c17
TVB-2368 Use local file for d3v5.js
kimonoki Jun 13, 2018
3cd6989
TVB-2372 Move the time selection window along with the 3d slider
kimonoki Jun 21, 2018
621e139
TVB-2372 Fix showBlockerOverlay not working in Firefox
kimonoki Jun 25, 2018
8b8727c
TVB-2372 Display Dynamic Spheres from the energy computed
kimonoki Jul 9, 2018
0230275
TVB-2372 Channel selector for the sphere rendering
kimonoki Jul 13, 2018
dca0285
TVB-2378 synchronize channels selection with spheres highlighting
kimonoki Jul 20, 2018
a6cf698
TVB-2379 Merge timeseriesD3 into tvbviz
kimonoki Jul 24, 2018
9a5a464
TVB-2378 Fix behaviours when reaching the end
kimonoki Jul 26, 2018
bf2eadc
TVB-2379 Merge the gl header template and 3D script
kimonoki Jul 26, 2018
be663fe
TVB-2378 Fix Energy for zoomed time slice
kimonoki Jul 30, 2018
b7afef4
TVB-2379 Remove measurepoint control and unused files
kimonoki Jul 30, 2018
3f0ac71
TVB-2379 Merge opacity shaders
kimonoki Aug 1, 2018
cb8cc03
TVB-2379 Add animated_graph.js
kimonoki Aug 1, 2018
3dd5c31
TVB-2379 Rename animated_graph.js to dualBrainViewer.js
kimonoki Aug 1, 2018
c456bb6
TVB-2379 Move animated_graph.js to new_dual_brain
kimonoki Aug 1, 2018
607a5f4
TVB-2379 Update animated_graph.js from dualBrainViewer.js
kimonoki Aug 1, 2018
9fb8a8b
TVB-2379 Rename animated_graph.js to dualBrainViewer.js
kimonoki Aug 1, 2018
965f66e
TVB-2368 Restore the original svg/d3 viewer
kimonoki Aug 2, 2018
0fa068c
TVB-2379 Fix reference to gl header html template in internal html te…
kimonoki Aug 3, 2018
559757d
TVB-2372 Remove unnecessary channel number array and use the existing…
kimonoki Aug 5, 2018
a0de3d2
TVB-2372 Syncing the time displayed in 3D viewer's slider from the ti…
kimonoki Aug 6, 2018
9f22515
TVB-2372 Fix time display in the slider when time selection is empty
kimonoki Aug 7, 2018
24af584
TVB-2369 Fix wrong sphere buffers generated for the internal sensors
kimonoki Aug 7, 2018
fe325ed
TVB-2372 Syncing the start time(t0) to the 3d slider
kimonoki Aug 10, 2018
336adca
TVB-2379 Remove unused FLOT functions
kimonoki Aug 12, 2018
a0625f7
TVB-2378 Remove unused scaling slider
kimonoki Aug 13, 2018
0b656df
Add work in progress text in the new viewer's title and restore the o…
kimonoki Aug 14, 2018
b4f664e
Change default opacity value to 0.3
kimonoki Aug 15, 2018
a0cf86b
Avoid redundant calling of the energy retrieving function when the ti…
kimonoki Aug 15, 2018
cac912b
Display the whole timeline for the 2d plot
kimonoki Aug 17, 2018
847216b
Fix calling 2d drawing from 3d movie playing for the old dual brain a…
kimonoki Aug 20, 2018
9938e32
Fix sphere size changing from dragging time selection window in 2d plot
kimonoki Aug 20, 2018
65d81b8
TVB-2359 Restore 2D plot scaling feature
kimonoki Aug 24, 2018
6484a31
TVB-2359 Fix messed sphere buffers when changed with time
kimonoki Aug 28, 2018
b6e1958
TVB-2359 Fix sphere rendering for non-selected channels
kimonoki Aug 31, 2018
635cb38
TVB-2359 Fix rendering sequence when dragging the selection window
kimonoki Sep 3, 2018
db800b2
TVB-2359 Remove d3v4 dependency
kimonoki Sep 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tvb/adapters/visualizers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@

__all__ = ["annotations_viewer", "brain", "complex_imaginary_coherence", "connectivity", "connectivity_edge_bundle",
"covariance", "cross_coherence", "cross_correlation", "eeg_monitor", "fourier_spectrum",
"histogram", "ica", "local_connectivity_view", "matrix_viewer", "pca", "pearson_cross_correlation",
"histogram", "ica", "local_connectivity_view", "matrix_viewer","new_dual_viewer","pca", "pearson_cross_correlation",
"pearson_edge_bundle", "pse_discrete", "pse_isocline", "region_volume_mapping", "sensors", "surface_view",
"time_series", "time_series_volume", "tract", "topographic", "wavelet_spectrogram"]
127 changes: 127 additions & 0 deletions tvb/adapters/visualizers/new_dual_viewer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http://www.thevirtualbrain.org
#
# (c) 2012-2017, Baycrest Centre for Geriatric Care ("Baycrest") and others
#
# This program is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this
# program. If not, see <http://www.gnu.org/licenses/>.
#
#
# CITATION:
# When using The Virtual Brain for scientific publications, please cite it as follows:
#
# Paula Sanz Leon, Stuart A. Knock, M. Marmaduke Woodman, Lia Domide,
# Jochen Mersmann, Anthony R. McIntosh, Viktor Jirsa (2013)
# The Virtual Brain: a simulator of primate brain network dynamics.
# Frontiers in Neuroinformatics (7:10. doi: 10.3389/fninf.2013.00010)
#
#


from tvb.adapters.visualizers.brain import BrainViewer
from tvb.adapters.visualizers.eeg_monitor import EegMonitor
from tvb.adapters.visualizers.sensors import prepare_sensors_as_measure_points_params
from tvb.adapters.visualizers.sensors import prepare_mapped_sensors_as_measure_points_params
from tvb.basic.filters.chain import FilterChain
from tvb.core.entities.storage import dao
from tvb.datatypes.surfaces import EEGCap, CorticalSurface
from tvb.datatypes.surfaces import Surface
from tvb.datatypes.time_series import TimeSeries, TimeSeriesSEEG, TimeSeriesEEG, TimeSeriesRegion


class NewDualViewer(BrainViewer):
"""
New visualizer merging Brain 3D display and EEG lines display.
Same input as the DualBrainViewer
"""
_ui_name = "(Work in progress)New Viewer for Time Series in 3D and 2D"
_ui_subsection = "new_brain_dual"

def get_input_tree(self):

return [{'name': 'time_series', 'label': 'Time Series', 'type': TimeSeries, 'required': True,
'conditions': FilterChain(fields=[FilterChain.datatype + '.type',
FilterChain.datatype + '._has_surface_mapping'],
operations=["in", "=="],
values=[['TimeSeriesEEG', 'TimeSeriesSEEG',
'TimeSeriesMEG', 'TimeSeriesRegion'], True])},

{'name': 'projection_surface', 'label': 'Projection Surface', 'type': Surface, 'required': False,
'description': 'A surface on which to project the results. When missing, the first EEGCap is taken'
'This parameter is ignored when InternalSensors measures.'},

{'name': 'shell_surface', 'label': 'Shell Surface', 'type': Surface, 'required': False,
'description': "Wrapping surface over the internal sensors, to be displayed "
"semi-transparently, for visual purposes only."}]

def populate_surface_fields(self, time_series):
"""
Prepares the urls from which the client may read the data needed for drawing the surface.
"""

if isinstance(time_series, TimeSeriesRegion):
BrainViewer.populate_surface_fields(self, time_series)
return

self.one_to_one_map = False
self.region_map = None
self.connectivity = None

if self.surface is None:
eeg_cap = dao.get_generic_entity(EEGCap, "EEGCap", "type")
if len(eeg_cap) < 1:
raise Exception("No EEG Cap Surface found for display!")
self.surface = eeg_cap[0]

def retrieve_measure_points_prams(self, time_series):

if isinstance(time_series, TimeSeriesRegion):
return BrainViewer.retrieve_measure_points_prams(self, time_series)

self.measure_points_no = time_series.sensors.number_of_sensors

if isinstance(time_series, TimeSeriesEEG):
return prepare_mapped_sensors_as_measure_points_params(self.current_project_id,
time_series.sensors, self.surface)

return prepare_sensors_as_measure_points_params(time_series.sensors)

def launch(self, time_series, projection_surface=None, shell_surface=None):

self.surface = projection_surface

if isinstance(time_series, TimeSeriesSEEG) and shell_surface is None:
shell_surface = dao.try_load_last_entity_of_type(self.current_project_id, CorticalSurface)

params = BrainViewer.compute_parameters(self, time_series, shell_surface)
params.update(EegMonitor().compute_parameters(time_series, is_extended_view=True))

params['isOneToOneMapping'] = False
params['brainViewerTemplate'] = 'dual_brain_3d_view.html'

if isinstance(time_series, TimeSeriesSEEG):
params['brainViewerTemplate'] = "dual_brain_3d_internal_view.html"
# Mark as None since we only display shelf face and no point to load these as well
params['urlVertices'] = None
params['isSEEG'] = True

if isinstance(time_series, TimeSeriesRegion):
params['withTransparency'] = True
else:
params['withTransparency'] = False


return self.build_display_result("new_dual_brain/view", params,
pages=dict(controlPage="new_dual_brain/controls",
channelsPage="commons/channel_selector.html"))
2 changes: 0 additions & 2 deletions tvb/interfaces/web/static/js/d3.v4.min.js

This file was deleted.

2 changes: 2 additions & 0 deletions tvb/interfaces/web/static/js/d3.v5.min.js

Large diffs are not rendered by default.

Loading