-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathplot_5_example_rmap_computing.py
63 lines (61 loc) · 2.67 KB
/
plot_5_example_rmap_computing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"""
R-Map computation
=================
"""
# %%
# Across patient decoding using R-Map optimal connectivity
# --------------------------------------------------------
#
# ECoG electrode placement is commonly very heterogeneous across patients and cohorts.
# To still facilitate approaches that are able to perform decoding applications without patient individual training,
# two across-patient decoding approaches were previously investigated for movement decoding:
#
#
# * grid-point decoding
# * optimal connectivity channel decoding
#
#
# First, the grid-point decoding approach relies on definition of a cortical or subcortical grid.
# Data from individual grid points is then interpolated onto those common grid points.
# The approach was also explained in the :doc:`plot_4_example_gridPointProjection` notebook.
#
# .. image:: ../_static/RMAP_figure.png
# :alt: R-Map and grid point approach for decoding without patient-individual training
#
# The R-Map decoding approach relies on the other hand on computation of whole brain connectivity. The electrode MNI space locations need to be known,
# then the following steps can be performed for decoding without patient individual training:
#
# #. Using the `wjn_toolbox <https://github.com/neuromodulation/wjn_toolbox>`_ *wjn_specrical_roi* function, the MNI coordinates can be transformed into NIFTI (.nii) files, containing the electrode contact region of interest (ROI):
#
# .. code-block:: python
#
# wjn_spherical_roi(roiname, mni, 4)
#
# #. For the given *ROI.nii* files, the LeadDBS `LeadMapper <https://netstim.gitbook.io/leaddbs/connectomics/lead-mapper>`_ tool can be used for functional or structural connectivity estimation.
#
# #. The py_neuromodulation :class:`~RMAP.py` module can then compute the R-Map given the contact-individual connectivity fingerprints:
#
# .. code-block:: python
#
# RMAP.calculate_RMap_numba(fingerprints, performances)
#
# #. The fingerprints from test-set patients can then be correlated with the calculated R-Map:
#
# .. code-block:: python
#
# RMAP.get_corr_numba(fp, fp_test)
#
# #. The channel with highest correlation can then be selected for decoding without individual training. :class:`~RMAP.py` contain already leave one channel and leave one patient out cross validation functions:
#
# .. code-block:: python
#
# RMAP.leave_one_sub_out_cv(l_fps_names, l_fps_dat, l_per, sub_list)
#
# #. The obtained R-Map correlations can then be estimated statistically and plotted against true correlates:
#
# .. code-block:: python
#
# RMAP.plot_performance_prediction_correlation(per_left_out, per_predict, out_path_save)
#
#
# sphinx_gallery_thumbnail_path = '_static/RMAP_figure.png'