NIPY logo

Site Navigation

NIPY Community

Table Of Contents

This Page

neurospin.spatial_models.structural_bfls

Module: neurospin.spatial_models.structural_bfls

Inheritance diagram for nipy.neurospin.spatial_models.structural_bfls:

The main routine of this module aims at performing the extraction of ROIs from multisubject dataset using the localization.

This has been published in Thirion et al. Structural Analysis of fMRI Data Revisited: Improving the Sensitivity and Reliability of fMRI Group Studies. IEEE TMI 2007

Author : Bertrand Thirion, 2006-2010

Class

LandmarkRegions

class nipy.neurospin.spatial_models.structural_bfls.LandmarkRegions(domain, k, indiv_coord, subj, id='')

Bases: object

This class is intended to represent a set of inter-subject regions It should inherit from some abstract multiple ROI class, not implemented yet.

Methods

centers
density
get_feature
homogeneity
hpd
map_label
prevalence_density
roi_confidence
roi_prevalence
set_feature
show
weighted_feature_density
__init__(domain, k, indiv_coord, subj, id='')

Building the landmark_region

Parameters :

domain: ROI instance :

defines the spatial context of the SubDomains

k: int, the number of regions considered :

indiv_coord: k-length list of arrays, optional, :

coordinates of the nodes in some embedding space.

subj: k-length list of integers :

these correspond to and ROI feature: the subject index of individual regions

id: string, optional, identifier :

centers()

returns the average of the coordinates for each region

density(k, coord=None, dmax=1.0, dof=10)

Posterior density of component k

Parameters :

k: int, less or equal to self.k :

reference component

coord: array of shape(n, self.dom.em_dim), optional :

a set of input coordinates

dmax: float, optional :

regularizaing constant for the variance estimation

dof: float, optional, :

strength of the regulaization

Returns :

pd: array of shape(n) :

the posterior density that has been computed

delta: array of shape(n) :

the quadratic term in the gaussian model

get_feature(fid)
homogeneity()

returns the mean distance between points within each LR

hpd(k, coord=None, pval=0.95, dmax=1.0)

Sample the posterior probability of being in k on a grid defined by cs, assuming that the roi is an ellipsoid

Parameters :

k: int, less or equal to self.k :

reference component

coord: array of shape(n,dim), optional :

a set of input coordinates

pval: float<1, optional, :

cutoff for the CR

dmax=1.0: an upper bound for the spatial variance :

to avoid degenerate variance

Returns :

hpd array of shape(n) that yields the value :

map_label(coord=None, pval=0.95, dmax=1.0)

Sample the set of landmark regions on the proposed coordiante set cs, assuming a Gaussian shape

Parameters :

coord: array of shape(n,dim), optional, :

a set of input coordinates

pval: float in [0,1]), optional :

cutoff for the CR, i.e. highest posterior density threshold

dmax: an upper bound for the spatial variance :

to avoid degenerate variance

Returns :

label: array of shape (n): the posterior labelling :

prevalence_density()

returns a weighted map of self.prevalence

Returns :wp: array of shape(n_samples) :
roi_confidence(ths=0, fid='confidence')

assuming that a certain feature fid field has been set as a discrete feature, this creates an approximate p-value that states how confident one might that the LR is defined in at least ths individuals if conficence is not defined as a discrete_feature, it is assumed to be 1.

Parameters :

ths: integer that yields the representativity threshold :

Returns :

pvals: array of shape self.k :

the p-values corresponding to the ROIs

roi_prevalence(fid='confidence')

assuming that fid=’confidence’ field has been set as a discrete feature, this creates the expectancy of the confidence measure i.e. expected numberof detection of the roi in the observed group

Returns :

confid: array of shape self.k :

the population_prevalence

set_feature(fid, data)
show()

function to print basic information on self

weighted_feature_density(feature)

Given a set of feature values, produce a weighted feature map, where roi-levle features are mapped smoothly based on the density of the components

Parameters :

feature: array of shape (self.k), :

the information to map

Returns :

wsm: array of shape(self.shape) :

Functions

nipy.neurospin.spatial_models.structural_bfls.Compute_Amers(dom, lbeta, dmax=10.0, thr=3.0, ths=0, pval=0.2, verbose=0)

This is the main function for building the BFLs

Parameters :

dom : StructuredDomain instance,

generic descriptor of the space domain

lbeta: an array of shape (nbnodes, subjects): :

the multi-subject statistical maps

dmax:float, optional, spatial relaxation allowed in the preocedure :

thr: float, optional, threshold at the first-level :

ths: float, optional, number of subjects to validate a BFL :

pval: float, optional : significance p-value for the spatial inference

Returns :

crmap: array of shape (nnodes): :

the resulting group-level labelling of the space

AF : a instance of LandmarkRegions that describes the ROIs found

in inter-subject inference If no such thing can be defined LR is set to None

BFLs: List of nipy.neurospin.spatial_models.hroi.Nroi instances :

representing individual ROIs

Newlabel: labelling of the individual ROIs :

nipy.neurospin.spatial_models.structural_bfls.RD_cliques(Gc, bstochastic=1)

Replicator dynamics graph segmentation: python implementation

Parameters :

Gc: nipy.neurospin.graph.WeightedGraph instance, :

the graph to be segmented

bstochastic=1 stochastic initialization of the graph :

Returns :

labels : array of shape V, the number of vertices of Gc

the labelling of the vertices that represent the segmentation :

nipy.neurospin.spatial_models.structural_bfls.build_LR(bf, thq=0.95, ths=0, dmax=1.0, verbose=0)

Given a list of hierarchical ROIs, and an associated labelling, this creates an Amer structure wuch groups ROIs with the same label.

Parameters :

bf : list of nipy.neurospin.spatial_models.hroi.Nroi instances

it is assumd that each list corresponds to one subject each HierarchicalROI is assumed to have the roi_features ‘position’, ‘label’ and ‘posterior_proba’ defined

thq=0.95, ths=0 defines the condition (c): :

(c) A label should be present in ths subjects with a probability>thq in order to be valid

dmax: float optional, :

regularizing constant that defines a prior on the region extent

nipy.neurospin.spatial_models.structural_bfls.merge(Gc, labels)

Given a first labelling of the graph Gc, this function builds a reduced graph by merging the vertices according to the labelling

Parameters :

Gc nipy.neurospin.graph.graph.WeightedGraph instance :

labels array of shape V, the number of vertices of Gc :

the labelling of the vertices that represent the segmentation

Returns :

labels array of shape V, the new labelling after further merging :

Gr the reduced graph after merging :

nipy.neurospin.spatial_models.structural_bfls.segment_graph_rd(Gc, nit=1, verbose=0)

Hard segmentation of the graph Gc using a replicator dynamics approach. The clusters obtained in the first pass are further merged during a second pass, based on a reduced graph

Parameters :

Gc : nipy.neurospin.graph.graph.WeightedGraph instance

the graph to be segmented

Returns :

u : array of shape Gc.V labelling of the vertices

that represents the segmentation