当前位置: 首页>>代码示例>>Python>>正文


Python Dataset.get_ids_by_expression方法代码示例

本文整理汇总了Python中neurosynth.base.dataset.Dataset.get_ids_by_expression方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.get_ids_by_expression方法的具体用法?Python Dataset.get_ids_by_expression怎么用?Python Dataset.get_ids_by_expression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在neurosynth.base.dataset.Dataset的用法示例。


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

示例1: efficiency

# 需要导入模块: from neurosynth.base.dataset import Dataset [as 别名]
# 或者: from neurosynth.base.dataset.Dataset import get_ids_by_expression [as 别名]
ma = meta.MetaAnalysis(dataset, ids)
ma.save_results('emotion')

# <markdowncell>

# You should now have a set of Nifti-format brain images on your drive that display various meta-analytic results. The image names are somewhat cryptic; see documentation elsewhere for details. It's important to note that the meta-analysis routines currently implemented in Neurosynth aren't very sophisticated; they're designed primarily for efficiency (most analyses should take just a few seconds), and take multiple shortcuts as compared to other packages like ALE or MKDA. But with that caveat in mind (and one that will hopefully be remedied in the near future), Neurosynth gives you a streamlined and quick way of running large-scale meta-analyses of fMRI data. Of course, all of the images you could generate using individual features are already available on the Neurosynth website, so there's probably not much point in doing this kind of thing yourself unless you've defined entirely new features.
# 
# ### More complex feature-based meta-analyses
# 
# Fortunately, we're not constrained to using single features in our meta-analyses. Neurosynth implements a parsing expression grammar, which is a fancy way of saying you can combine terms according to syntactic rules--in this case, basic logical operations.
# 
# For example, suppose we want to restrict our analysis to studies of emotion that do NOT use the terms 'reward' or 'pain', which we might construe as somewhat non-prototypical affective states. Then we could do the following:

# <codecell>

ids = dataset.get_ids_by_expression('emo* &~ (reward* | pain*)', threshold=0.001)
ma = meta.MetaAnalysis(dataset, ids)
ma.save_results('emotion_without_reward_or_pain')
print "Found %d studies." % len(ids)

# <markdowncell>

# This meta-analysis is somewhat more restrictive than the previous one (555 studies instead of 639), and the result should theoretically be at least somewhat more spatially specific.
# 
# There's no inherent restriction on how many terms you combine or how deeply you nest logical expressions within parentheses, but the cardinal of GIGO (garbage in, garbage out) always applies, so if your expression is very specific and the number of studies drops too far (in practice, sensible results are unlikely with fewer than 50 studies), don't expect to see much.
# 
# ### Meta-analytic contrasts
# 
# In addition to various logical operations, one handy thing you can do with Neurosynth is perform meta-analytic contrasts. Meaning, you can identify voxels in which the average likelihood of activation being reported differ for two different sets of studies. For example, let's say you want to meta-analytically contrast studies that use the term 'recollection' with studies that use the term 'recognition'. You can do this by defining both sets of studies separately, and then passing them both to the meta-analysis object:

# <codecell>
开发者ID:MQMQ0229,项目名称:neurosynth,代码行数:33,代码来源:neurosynth_demo.py


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