• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python plotting.plot_connectome函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中nilearn.plotting.plot_connectome函数的典型用法代码示例。如果您正苦于以下问题:Python plot_connectome函数的具体用法?Python plot_connectome怎么用?Python plot_connectome使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了plot_connectome函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: plot_connectivity_glassbrain

def plot_connectivity_glassbrain(subject_id, group, pc, roi_coords,
                                 suffix, session='func1',
                                 preprocessing_folder='pipeline_1',
                                 save=True, msdl=False):
    """Plots connectome of pc
    """
    title = '-'.join([suffix, group, subject_id, session])
    
    output_folder = os.path.join(set_figure_base_dir('connectivity'), suffix)
    if not os.path.isdir(output_folder):
        os.makedirs(output_folder)
    
    output_file = os.path.join(output_folder,
                               '_'.join([suffix, 'connectome', group,
                                         session,
                                         preprocessing_folder, subject_id]))
                                         
    if msdl:
        title += '_msdl'
        output_file += '_msdl'
                                         
    plt.figure(figsize=(10, 20), dpi=90)
    if save:    
        plot_connectome(pc, roi_coords, edge_threshold='90%', title=title,
                        output_file=output_file)
    else:
        plot_connectome(pc, roi_coords, edge_threshold='90%', title=title)
开发者ID:JFBazille,项目名称:post_learning_analysis,代码行数:27,代码来源:compute_connectivity.py


示例2: plot_cluster_freqs_on_brain

    def plot_cluster_freqs_on_brain(self, cluster_name, xyz, colormap='viridis', vmin=None, vmax=None, do_3d=False):
        """
        Plot the frequencies of single electrode cluster on either a 2d or interactive 2d brain.

        Parameters
        ----------
        cluster_name: str
            Name of column in self.res['clusters']
        xyz: np.ndarray
            3 x n array of electrode locations. Should be in MNI space.
        colormap: str
            matplotlib colormap name
        vmin: float
            lower limit of colormap values. If not given, lowest value in frequency column will be used
        vmax: float
            upper limit of colormap values. If not given, highest value in frequency column will be used
        do_3d:
            Whether to plot an interactive 3d brain, or a 2d brain

        Returns
        -------
        If 2d, returns the matplotlib figure. If 3d, returns the html used to render the brain.
        """

        # get frequecies for this cluster
        freqs = self.res['clusters'][cluster_name].values

        # get color for each frequency. Start with all black
        colors = np.stack([[0., 0., 0., 0.]] * len(freqs))

        # fill in colors of electrodes with defined frequencies
        cm = plt.get_cmap(colormap)
        cNorm = clrs.Normalize(vmin=np.nanmin(freqs) if vmin is None else vmin,
                               vmax=np.nanmax(freqs) if vmax is None else vmax)
        colors[~np.isnan(freqs)] = cmx.ScalarMappable(norm=cNorm, cmap=cm).to_rgba(freqs[~np.isnan(freqs)])

        # if plotting 2d, use the nilearn glass brain
        if not do_3d:
            fig, ax = plt.subplots()
            ni_plot.plot_connectome(np.eye(xyz.shape[0]), xyz,
                                    node_kwargs={'alpha': 0.7, 'edgecolors': None},
                                    node_size=60, node_color=colors, display_mode='lzr',
                                    axes=ax)
            divider = make_axes_locatable(ax)
            cax = divider.append_axes('bottom', size='4%', pad=0)
            cb1 = mpl.colorbar.ColorbarBase(cax, cmap=colormap,
                                            norm=cNorm,
                                            orientation='horizontal')
            cb1.set_label('Frequency', fontsize=20)
            cb1.ax.tick_params(labelsize=14)
            fig.set_size_inches(15, 10)
            return fig

        # if plotting 3d use the nilearn 3d brain. Unfortunately this doesn't add a colorbar.
        else:
            # you need to return the html. If in jupyter, it will automatically render
            return ni_plot.view_markers(xyz, colors=colors, marker_size=6)
开发者ID:jayfmil,项目名称:TH_python,代码行数:57,代码来源:subject_oscillation_cluster.py


示例3: run_mini_pipeline

def run_mini_pipeline():
    atlas = datasets.fetch_atlas_msdl()
    atlas_img = atlas['maps']
    labels = pd.read_csv(atlas['labels'])['name']

    masker = NiftiMapsMasker(maps_img=atlas_img, standardize=True,
                               memory='/tmp/nilearn', verbose=0)

    data = datasets.fetch_adhd(number_subjects)

    figures_folder = '../figures/'
    count=0
    for func_file, confound_file in zip(data.func, data.confounds):
        
        # fit the data to the atlas mask, regress out confounds
        time_series = masker.fit_transform(func_file, confounds=confound_file)

        correlation = np.corrcoef(time_series.T)

        #plotting starts here
        plt.figure(figsize=(10, 10))
        plt.imshow(correlation, interpolation="nearest")
        x_ticks = plt.xticks(range(len(labels)), labels, rotation=90)
        y_ticks = plt.yticks(range(len(labels)), labels)
        corr_file = figures_folder+'subject_number_' + str(count) + '_correlation.pdf'
        plt.savefig(corr_file)

        atlas_region_coords = [plotting.find_xyz_cut_coords(img) for img in image.iter_img(atlas_img)]
        threshold = 0.6
        plotting.plot_connectome(correlation, atlas_region_coords, edge_threshold=threshold)
        connectome_file = figures_folder+'subject_number_' + str(count) + '_connectome.pdf'
        plt.savefig(connectome_file)


        #graph setup

        #binarize correlation matrix
        correlation[correlation<threshold] = 0
        correlation[correlation != 0] = 1

        graph = nx.from_numpy_matrix(correlation)

        partition=louvain.best_partition(graph)

        values = [partition.get(node) for node in graph.nodes()]

        plt.figure()
        nx.draw_spring(graph, cmap = plt.get_cmap('jet'), node_color = values, node_size=30, with_labels=True)
        graph_file = figures_folder+'subject_number_' + str(count) + '_community.pdf'
        plt.savefig(graph_file)

        count += 1

        plt.close('all')
开发者ID:flrgsr,项目名称:Mini-Pipeline-Community,代码行数:54,代码来源:nilearn_pipeline.py


示例4:

###############################################################################
# Plot matrix and graph
# ---------------------
#
# We use `matplotlib` plotting functions to visualize our correlation matrix
# and display the graph of connections with `nilearn.plotting.plot_connectome`.
import matplotlib.pyplot as plt
from nilearn import plotting

plt.imshow(matrix, vmin=-1.0, vmax=1.0, cmap="RdBu_r", interpolation="nearest")
plt.colorbar()
plt.title("Power correlation matrix")

# Tweak edge_threshold to keep only the strongest connections.
plotting.plot_connectome(
    matrix, coords, title="Power correlation graph", edge_threshold="99.8%", node_size=20, colorbar=True
)

###############################################################################
# Note the 1. on the matrix diagonal: These are the signals variances, set to
# 1. by the `spheres_masker`. Hence the covariance of the signal is a
# correlation matrix

###############################################################################
# Connectome extracted from Dosenbach's atlas
# -------------------------------------------
#
# We repeat the same steps for Dosenbach's atlas.
dosenbach = datasets.fetch_coords_dosenbach_2010()

coords = np.vstack((dosenbach.rois["x"], dosenbach.rois["y"], dosenbach.rois["z"])).T
开发者ID:Neurita,项目名称:nilearn,代码行数:31,代码来源:plot_sphere_based_connectome.py


示例5: print

# All individual coefficients are stacked in a unique 2D matrix.
print('Correlations of ADHD patients are stacked in an array of shape {0}'
      .format(correlation_matrices.shape))

###############################################################################
# as well as the average correlation across all fitted subjects.
mean_correlation_matrix = correlation_measure.mean_
print('Mean correlation has shape {0}.'.format(mean_correlation_matrix.shape))

###############################################################################
# We display the connectomes of the first 3 ADHD subjects and the mean
# correlation matrix over all ADHD patients.
from nilearn import plotting

plot_matrices(correlation_matrices[:4], 'correlation')
plotting.plot_connectome(mean_correlation_matrix, msdl_coords,
                         title='mean correlation over 13 ADHD subjects')

###############################################################################
# Look at blocks structure, reflecting functional networks.

###############################################################################
# Examine partial correlations
# ----------------------------
# We can also study **direct connections**, revealed by partial correlation
# coefficients. We just change the `ConnectivityMeasure` kind
partial_correlation_measure = ConnectivityMeasure(kind='partial correlation')

###############################################################################
# and repeat the previous operation.
partial_correlation_matrices = partial_correlation_measure.fit_transform(
    adhd_subjects)
开发者ID:bthirion,项目名称:nilearn,代码行数:32,代码来源:plot_group_level_connectivity.py


示例6:

# The covariance can be found at estimator.covariance_
plt.imshow(estimator.covariance_, interpolation="nearest",
           vmax=1, vmin=-1, cmap=plt.cm.RdBu_r)
# And display the labels
x_ticks = plt.xticks(range(len(labels)), labels, rotation=90)
y_ticks = plt.yticks(range(len(labels)), labels)
plt.title('Covariance')

##############################################################################
# And now display the corresponding graph
# ----------------------------------------
from nilearn import plotting
coords = atlas.region_coords

plotting.plot_connectome(estimator.covariance_, coords,
                         title='Covariance')


##############################################################################
# Display the sparse inverse covariance
# --------------------------------------
# we negate it to get partial correlations
plt.figure(figsize=(10, 10))
plt.imshow(-estimator.precision_, interpolation="nearest",
           vmax=1, vmin=-1, cmap=plt.cm.RdBu_r)
# And display the labels
x_ticks = plt.xticks(range(len(labels)), labels, rotation=90)
y_ticks = plt.yticks(range(len(labels)), labels)
plt.title('Sparse inverse covariance')

##############################################################################
开发者ID:dillonplunkett,项目名称:nilearn,代码行数:31,代码来源:plot_inverse_covariance_connectome.py


示例7: NiftiMapsMasker

masker = NiftiMapsMasker(maps_img=atlas_filename, standardize=True,
                           memory='nilearn_cache', verbose=5)

data = datasets.fetch_adhd(n_subjects=1)

time_series = masker.fit_transform(data.func[0],
                                   confounds=data.confounds)

correlation_matrix = np.corrcoef(time_series.T)

# Display the correlation matrix
from matplotlib import pyplot as plt
plt.figure(figsize=(10, 10))
plt.imshow(correlation_matrix, interpolation="nearest")
# And display the labels
x_ticks = plt.xticks(range(len(names)), names, rotation=90)
y_ticks = plt.yticks(range(len(names)), names)

# And now display the corresponding graph
from nilearn import plotting
coords = np.vstack((labels['x'], labels['y'], labels['z']))

# We threshold to keep only the 20% of edges with the highest value
# because the graph is very dense
plotting.plot_connectome(correlation_matrix, coords.T,
                         edge_threshold="80%")

plt.show()


开发者ID:andreas-koukorinis,项目名称:gaelvaroquaux.github.io,代码行数:28,代码来源:plot_connectome_extraction.py


示例8: range

__author__ = '2d Lt Kyle Palko'

import numpy as np
from nilearn import plotting as plt

# import Pitt 0050013, a young autistic subject
ts = np.genfromtxt('/media/kap/8e22f6f8-c4df-4d97-a388-0adcae3ec1fb/Python/Thesis/C200/ABIDE_pcp/cpac/filt_noglobal/'
                   'Pitt_0050013_rois_cc200.1D', skip_header=1)
cor = np.corrcoef(ts.T)

# create matrix
x = np.zeros((200, 200))
for i in range(0, np.size(x, axis=0)):
    x[i][i] = 1

a = np.genfromtxt('cc200_roi.csv', delimiter=',')
row = np.array([c[0] for c in a])
col = np.array([c[1] for c in a])
del a

for i in range(0, 10):
    r = row[i]
    c = col[i]
    x[r, c] = cor[r, c]
    x[c, r] = cor[c, r]

node_coords = np.genfromtxt('cc200_lab_coord.csv', delimiter=',')
plt.plot_connectome(x, node_coords, output_file='corrtest_1.png', node_size=1)
开发者ID:mrgtreeskier,项目名称:Thesis,代码行数:28,代码来源:draw_brain.py


示例9: zip

    if kind == 'tangent':
        mean_connectivity_matrix[kind] = conn_measure.mean_
    else:
        mean_connectivity_matrix[kind] = \
            individual_connectivity_matrices[kind].mean(axis=0)


######################################################################
# Plot the mean connectome with hemispheric saggital cuts
import numpy as np
from nilearn import plotting
labels = atlas.labels
region_coords = atlas.region_coords
for kind in kinds:
    plotting.plot_connectome(mean_connectivity_matrix[kind],
                             region_coords, edge_threshold='98%',
                             title=kind, display_mode='lzry')


######################################################################
# Use the connectivity coefficients to classify ADHD vs controls
from sklearn.svm import LinearSVC
from sklearn.cross_validation import StratifiedKFold, cross_val_score
classes = ['{0}{1}'.format(site, adhd) for site, adhd in zip(sites, adhds)]
print('Classification accuracy:')
mean_scores = []
cv = StratifiedKFold(classes, n_folds=3)
for kind in kinds:
    svc = LinearSVC()
    # Transform the connectivity matrices to 1D arrays
    coonectivity_coefs = connectome.sym_to_vec(
开发者ID:AlexandreAbraham,项目名称:nilearn,代码行数:31,代码来源:plot_connectivity_measures.py


示例10: ConnectivityMeasure

plt.tight_layout()


##########################################################################
# Compute partial correlation matrix
# -----------------------------------
# Using object :class:`nilearn.connectome.ConnectivityMeasure`: Its
# default covariance estimator is Ledoit-Wolf, allowing to obtain accurate
# partial correlations.
from nilearn.connectome import ConnectivityMeasure
connectivity_measure = ConnectivityMeasure(kind='partial correlation')
partial_correlation_matrix = connectivity_measure.fit_transform(
    [time_series])[0]

##########################################################################
# Display connectome
# -------------------
from nilearn import plotting

plotting.plot_connectome(partial_correlation_matrix, dmn_coords,
                         title="Default Mode Network Connectivity")

##########################################################################
# Display connectome with hemispheric projections.
# Notice (0, -52, 18) is included in both hemispheres since x == 0.
plotting.plot_connectome(partial_correlation_matrix, dmn_coords,
                         title="Connectivity projected on hemispheres",
                         display_mode='lyrz')

plotting.show()
开发者ID:TheChymera,项目名称:nilearn,代码行数:30,代码来源:plot_adhd_spheres.py


示例11: zip

for time_serie, label in zip(time_series.T, labels):
    plt.plot(time_serie, label=label)

plt.title("Default Mode Network Time Series")
plt.xlabel("Scan number")
plt.ylabel("Normalized signal")
plt.legend()
plt.tight_layout()


##########################################################################
# Compute precision matrices
from sklearn.covariance import LedoitWolf

cve = LedoitWolf()
cve.fit(time_series)


##########################################################################
# Display connectome
from nilearn import plotting

plotting.plot_connectome(cve.precision_, dmn_coords, title="Default Mode Network Connectivity")

# Display connectome with hemispheric projections.
# Notice (0, -52, 18) is included in both hemispheres since x == 0.
title = "Connectivity projected on hemispheres"
plotting.plot_connectome(cve.precision_, dmn_coords, title=title, display_mode="lyrz")

plotting.show()
开发者ID:CandyPythonFlow,项目名称:nilearn,代码行数:30,代码来源:plot_adhd_spheres.py


示例12: ConnectivityMeasure

from nilearn.connectome import ConnectivityMeasure
connectivity_measure = ConnectivityMeasure(kind='partial correlation')
partial_correlation_matrix = connectivity_measure.fit_transform(
    [time_series])[0]


##########################################################################
# Display connectome
# -------------------
#
# We display the graph of connections with `:func: nilearn.plotting.plot_connectome`.

from nilearn import plotting

plotting.plot_connectome(partial_correlation_matrix, dmn_coords,
                         title="Default Mode Network Connectivity")


##########################################################################
# Display connectome with hemispheric projections.
# Notice (0, -52, 18) is included in both hemispheres since x == 0.
plotting.plot_connectome(partial_correlation_matrix, dmn_coords,
                         title="Connectivity projected on hemispheres",
                         display_mode='lyrz')

plotting.show()


##############################################################################
# 3D visualization in a web browser
# ---------------------------------
开发者ID:mrahim,项目名称:nilearn,代码行数:31,代码来源:plot_sphere_based_connectome.py


示例13: load_msdl_names_and_coords

roi_names, roi_coords = load_msdl_names_and_coords()
stat_av = read_test('pc', 'av', 'avg')
stat_v = read_test('pc', 'v', 'avg')
stat2 = read_test2('pc', ['av', 'v'], 'avg')


i, j = np.unravel_index(stat2.argmax(), stat2.shape)
print 'av 1sample pval :', stat_av[i, j]
print 'v 1sample pval :', stat_v[i, j]
print roi_names[i], roi_names[j]
print i, j

m = np.eye(2)
m[1,0] = stat2[i, j]
m[0,1] = m[1,0] 
plot_connectome(m, [roi_coords[i], roi_coords[j]])


conn = []
behav = []
for i in range(len(dataset.subjects)):
    c = load_dynacomp_fc(dataset.subjects[i], session='func1', metric='pc', msdl=True)
    conn.append(c[i, j])
    b = behav_data[i]['postRT'] - behav_data[i]['preRT']
    behav.append(b)

sns.jointplot(np.array(conn), np.array(behav), kind='kde')
sns.axlabel('Connectivity', 'Behavior')

开发者ID:JFBazille,项目名称:post_learning_analysis,代码行数:28,代码来源:behavior_correlation.py


示例14: GraphLassoCV

###############################################################################
# Extract and plot correlation matrix

# calculate connectivity and plot Power-264 correlation matrix
connectivity = connectome.ConnectivityMeasure(kind='correlation')
corr_matrix = connectivity.fit_transform([timeseries])[0]
np.fill_diagonal(corr_matrix, 0)
plt.imshow(corr_matrix, vmin=-1., vmax=1., cmap='RdBu_r')
plt.colorbar()
plt.title('Power 264 Connectivity')

# Plot the connectome

plotting.plot_connectome(corr_matrix,
                         power_coords,
                         edge_threshold='99.8%',
                         node_size=20)


###############################################################################
# Extract and plot covariance and sparse covariance

# Compute the sparse inverse covariance
from sklearn.covariance import GraphLassoCV

estimator = GraphLassoCV()
estimator.fit(timeseries)

# Display the covariance
plt.figure(figsize=(5, 5))
plt.imshow(estimator.covariance_, interpolation="nearest",
开发者ID:satishjasthi,项目名称:nilearn,代码行数:31,代码来源:plot_power_connectome.py


示例15: print

###############################################################################
# as well as the average correlation across all fitted subjects.
mean_correlation_matrix = correlation_measure.mean_
print('Mean correlation has shape {0}.'.format(mean_correlation_matrix.shape))

###############################################################################
# We display the connectome matrices of the first 4 children
from nilearn import plotting

plot_matrices(correlation_matrices[:4], 'correlation')
###############################################################################
# The blocks structure that reflect functional networks are visible.

###############################################################################
# Now we display as a connectome the mean correlation matrix over all children.
plotting.plot_connectome(mean_correlation_matrix, msdl_coords,
                         title='mean correlation over all children')

###############################################################################
# Studying partial correlations
# -----------------------------
# We can also study **direct connections**, revealed by partial correlation
# coefficients. We just change the `ConnectivityMeasure` kind
partial_correlation_measure = ConnectivityMeasure(kind='partial correlation')

###############################################################################
# and repeat the previous operation.
partial_correlation_matrices = partial_correlation_measure.fit_transform(
    children)

###############################################################################
# Most of direct connections are weaker than full connections,
开发者ID:mrahim,项目名称:nilearn,代码行数:32,代码来源:plot_group_level_connectivity.py


示例16:

###############################################################################
# Extract and plot correlation matrix

for atlas in ['Power', 'Dosenbach']:

    if atlas == 'Power':
        timeseries = power_timeseries
        coords = power_coords
    else:
        timeseries = dosenbach_timeseries
        coords = dosenbach_coords

    connectivity = connectome.ConnectivityMeasure(kind='correlation')
    corr_matrix = connectivity.fit_transform([timeseries])[0]
    np.fill_diagonal(corr_matrix, 0)

    plt.figure()
    vmax = np.max(np.abs(corr_matrix))
    plt.imshow(corr_matrix, vmin=-vmax, vmax=vmax, cmap='RdBu_r',
               interpolation='nearest')
    plt.colorbar()
    plt.title(atlas + 'correlation matrix')

    # Plot the connectome
    plotting.plot_connectome(corr_matrix, coords,
                             edge_threshold='99.8%', node_size=20,
                             title=atlas + 'correlation connectome')

plotting.show()
开发者ID:CandyPythonFlow,项目名称:nilearn,代码行数:29,代码来源:plot_seed_based_connectome.py


示例17: GroupSparseCovarianceCV

from nilearn.group_sparse_covariance import GroupSparseCovarianceCV
gsc = GroupSparseCovarianceCV(verbose=2)
gsc.fit(subject_time_series)

print("-- Computing graph-lasso precision matrices ...")
from sklearn import covariance
gl = covariance.GraphLassoCV(verbose=2)
gl.fit(np.concatenate(subject_time_series))

# Displaying results ##########################################################
atlas_imgs = image.iter_img(msdl_atlas_dataset.maps)
atlas_region_coords = [plotting.find_xyz_cut_coords(img) for img in atlas_imgs]

title = "GraphLasso"
plotting.plot_connectome(-gl.precision_, atlas_region_coords,
                         edge_threshold='90%',
                         title="Sparse inverse covariance (GraphLasso)")
plotting.plot_connectome(gl.covariance_,
                         atlas_region_coords, edge_threshold='90%',
                         title="Covariance")
plot_matrices(gl.covariance_, gl.precision_, title)

title = "GroupSparseCovariance"
plotting.plot_connectome(-gsc.precisions_[..., 0],
                         atlas_region_coords, edge_threshold='90%',
                         title=title)
plot_matrices(gsc.covariances_[..., 0],
              gsc.precisions_[..., 0], title)

plt.show()
开发者ID:DavidDJChen,项目名称:nilearn,代码行数:30,代码来源:plot_multi_subject_connectome.py


示例18: ConnectivityMeasure

############################################################################
# Build and display a correlation matrix
from nilearn.connectome import ConnectivityMeasure
correlation_measure = ConnectivityMeasure(kind='correlation')
correlation_matrix = correlation_measure.fit_transform([time_series])[0]

# Display the correlation matrix
import numpy as np
from matplotlib import pyplot as plt
plt.figure(figsize=(10, 10))
# Mask out the major diagonal
np.fill_diagonal(correlation_matrix, 0)
plt.imshow(correlation_matrix, interpolation="nearest", cmap="RdBu_r",
           vmax=0.8, vmin=-0.8)
plt.colorbar()
# And display the labels
x_ticks = plt.xticks(range(len(labels)), labels, rotation=90)
y_ticks = plt.yticks(range(len(labels)), labels)

############################################################################
# And now display the corresponding graph
from nilearn import plotting
coords = atlas.region_coords

# We threshold to keep only the 20% of edges with the highest value
# because the graph is very dense
plotting.plot_connectome(correlation_matrix, coords,
                         edge_threshold="80%", colorbar=True)

plotting.show()
开发者ID:AlexandreAbraham,项目名称:nilearn,代码行数:30,代码来源:plot_probabilistic_atlas_extraction.py


示例19: pairwise_classification

             w,a = pairwise_classification(Xp, yp, title=output)
             print groups[i], groups[j], a
             t = np.zeros((len(roi_names), len(roi_names)))
             t[ind] = np.abs(w)
             t = (t + t.T) / 2.
             if msdl:
                 msdl_str = 'msdl'
             else:
                 msdl_str = 'rois'
             output_folder = os.path.join(set_figure_base_dir('classification'),
                                          metric, session, msdl_str)
             if not os.path.isdir(output_folder):
                 os.makedirs(output_folder)
             output_file = os.path.join(output_folder, 'connectome_' + output)
             plot_connectome(t, roi_coords, title=output,
                             output_file=output_file,
                             annotate=True,
                             edge_threshold='0%')
             
 
     # 1 vs rest
     for i in range(3):
         gr_i = dataset.group_indices[groups[i]]
         yr = np.zeros(X.shape[0])
         yr[gr_i] = 1
         output = '_'.join([groups[i] + '_rest', metric, session, msdl_str,
                            preprocessing_folder])
         plt.figure()
         w, a = pairwise_classification(X, yr, title=output)
 
         print groups[i] + '_rest', a
         if np.sum(w) == 0:
开发者ID:JFBazille,项目名称:post_learning_analysis,代码行数:32,代码来源:behavior_classification.py


示例20: zip

for func, confounds in zip(data.func, data.confounds):
    time_series.append(masker.fit_transform(func, confounds=confounds))

# calculate correlation matrices across subjects and display
correlation_matrices = connectome_measure.fit_transform(time_series)

# Mean correlation matrix across 10 subjects can be grabbed like this,
# using connectome measure object
mean_correlation_matrix = connectome_measure.mean_

# grab center coordinates for atlas labels
coordinates = plotting.find_parcellation_cut_coords(labels_img=yeo['thick_17'])

# plot connectome with 80% edge strength in the connectivity
plotting.plot_connectome(mean_correlation_matrix, coordinates,
                         edge_threshold="80%",
                         title='Yeo Atlas 17 thick (func)')

##########################################################################
# Load probabilistic atlases - extracting coordinates on brain maps
# -----------------------------------------------------------------

msdl = datasets.fetch_atlas_msdl()

##########################################################################
# Iterate over fetched atlases to extract coordinates - probabilistic
# -------------------------------------------------------------------
from nilearn.input_data import NiftiMapsMasker

# create masker to extract functional data within atlas parcels
masker = NiftiMapsMasker(maps_img=msdl['maps'], standardize=True,
开发者ID:bthirion,项目名称:nilearn,代码行数:31,代码来源:plot_atlas_comparison.py



注:本文中的nilearn.plotting.plot_connectome函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python plotting.plot_glass_brain函数代码示例发布时间:2022-05-27
下一篇:
Python plotting.plot_anat函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap