-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplot_neurosynth.py
49 lines (36 loc) · 1.44 KB
/
plot_neurosynth.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
""" Plot a map from neurosynth
"""
# Authors: Gael Varoquaux
# License: BSD
#import urllib, os, errno
#from urllib2 import Request, urlopen, HTTPError
import numpy as np
import pylab as plt
from nilearn.plotting.img_plotting import plot_anat
from neurosynth.base.dataset import Dataset
from neurosynth.analysis import meta
#def url_get(url):
# request = Request(url)
# response = urlopen(request)
# return response.read()
if __name__ == '__main__':
dataset = Dataset('/volatile/varoquau/dev/neurosynth-data/database.txt')
ids = dataset.image_table.ids
ma = meta.MetaAnalysis(dataset, ids)
ma.save_results(prefix='all_neurosynth')
#mem.clear()
#combined_df = mem.cache(get_images_with_collections_df)()
#--------------------------------------------------
# Plot a map of frequency of activation
display = plot_anat("/usr/share/fsl/data/standard/MNI152_T1_2mm.nii.gz",
display_mode='z',
cut_coords=np.linspace(-30, 60, 7))
display.add_overlay('all_neurosynth_pA.nii.gz', vmin=0,
cmap=plt.cm.hot, colorbar=True)
display._colorbar_ax.set_yticklabels([
"% 3i" % (100 * float(t.get_text()))
for t in display._colorbar_ax.yaxis.get_ticklabels()])
display.title('NeuroSynth: Probability of activations')
display.savefig('neurosynth_frequency.png')
display.savefig('neurosynth_frequency.pdf')
plt.show()