本文整理汇总了Python中nilearn.plotting.show函数的典型用法代码示例。如果您正苦于以下问题:Python show函数的具体用法?Python show怎么用?Python show使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run
def run(idx, reduction, alpha, mask, raw, n_components, init, func_filenames):
output_dir = join(trace_folder, 'experiment_%i' % idx)
try:
os.makedirs(output_dir)
except OSError:
pass
dict_fact = SpcaFmri(mask=mask,
smoothing_fwhm=3,
batch_size=40,
shelve=not raw,
n_components=n_components,
replacement=False,
dict_init=fetch_atlas_smith_2009().rsn70 if
init else None,
reduction=reduction,
alpha=alpha,
random_state=0,
n_epochs=2,
l1_ratio=0.5,
backend='c',
memory=expanduser("~/nilearn_cache"), memory_level=2,
verbose=5,
n_jobs=1,
trace_folder=output_dir
)
print('[Example] Learning maps')
t0 = time.time()
dict_fact.fit(func_filenames, raw=raw)
t1 = time.time() - t0
print('[Example] Dumping results')
# Decomposition estimator embeds their own masker
masker = dict_fact.masker_
components_img = masker.inverse_transform(dict_fact.components_)
components_img.to_filename(join(output_dir, 'components_final.nii.gz'))
print('[Example] Run in %.2f s' % t1)
# Show components from both methods using 4D plotting tools
import matplotlib.pyplot as plt
from nilearn.plotting import plot_prob_atlas, show
print('[Example] Displaying')
fig, axes = plt.subplots(2, 1)
plot_prob_atlas(components_img, view_type="filled_contours",
axes=axes[0])
plot_stat_map(index_img(components_img, 0),
axes=axes[1],
colorbar=False,
threshold=0)
plt.savefig(join(output_dir, 'components.pdf'))
show()
开发者ID:lelegan,项目名称:modl,代码行数:50,代码来源:hcp_compare.py
示例2: import
# Grab extracted components umasked back to Nifti image.
# Note: For older versions, less than 0.4.1. components_img_
# is not implemented. See Note section above for details.
components_img = estimator.components_img_
components_img.to_filename('%s_resting_state.nii.gz' %
names[estimator])
components_imgs.append(components_img)
###############################################################################
# Visualize the results
# ----------------------
from nilearn.plotting import (plot_prob_atlas, find_xyz_cut_coords, show,
plot_stat_map)
from nilearn.image import index_img
# Selecting specific maps to display: maps were manually chosen to be similar
indices = {dict_learning: 25, canica: 33}
# We select relevant cut coordinates for displaying
cut_component = index_img(components_imgs[0], indices[dict_learning])
cut_coords = find_xyz_cut_coords(cut_component)
for estimator, components in zip(estimators, components_imgs):
# 4D plotting
plot_prob_atlas(components, view_type="filled_contours",
title="%s" % names[estimator],
cut_coords=cut_coords, colorbar=False)
# 3D plotting
plot_stat_map(index_img(components, indices[estimator]),
title="%s" % names[estimator],
cut_coords=cut_coords, colorbar=False)
show()
开发者ID:jeromedockes,项目名称:nilearn,代码行数:30,代码来源:plot_compare_decomposition.py
示例3:
black_bg=True, display_mode='xz', threshold=3)
###############################################################################
# Plotting the sign of the activation
plotting.plot_glass_brain(localizer_tmap_filename, threshold=0, colorbar=True,
plot_abs=False)
###############################################################################
# The sign of the activation and a colorbar
plotting.plot_glass_brain(localizer_tmap_filename, threshold=3,
colorbar=True, plot_abs=False)
###############################################################################
# Different projections for the left and right hemispheres
# ---------------------------------------------------------
#
# Hemispheric sagittal cuts
plotting.plot_glass_brain(localizer_tmap_filename,
title='plot_glass_brain with display_mode="lzr"',
black_bg=True, display_mode='lzr', threshold=3)
###############################################################################
plotting.plot_glass_brain(localizer_tmap_filename, threshold=0, colorbar=True,
title='plot_glass_brain with display_mode="lyrz"',
plot_abs=False, display_mode='lyrz')
plotting.show()
开发者ID:CandyPythonFlow,项目名称:nilearn,代码行数:30,代码来源:plot_demo_glass_brain_extensive.py
注:本文中的nilearn.plotting.show函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论