NIPY logo

Site Navigation

NIPY Community

Github repo

Table Of Contents

This Page

labs.spatial_models.structural_bfls

Module: labs.spatial_models.structural_bfls

Inheritance diagram for nipy.labs.spatial_models.structural_bfls:

The main routine of this module implement the LandmarkRegions class, that is used to represent Regions of interest at the population level (in a template space).

This has been used 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

LandmarkRegions

class nipy.labs.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() returns the average of the coordinates for each region
density(k[, coord, dmax, dof]) Posterior density of component k
get_feature(fid)
homogeneity() returns the mean distance between points within each LR
hpd(k[, coord, pval, dmax]) Sample the posterior probability of being in k
map_label([coord, pval, dmax]) Sample the set of landmark regions
prevalence_density() Returns a weighted map of self.prevalence
roi_confidence([ths, fid]) assuming that a certain feature fid field has been set
roi_prevalence([fid]) assuming that fid=’confidence’ field has been set
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,
__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 regularization

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) :

nipy.labs.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.labs.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

Returns :

LR : None or structural_bfls.LR instance

describing a cross-subject set of ROIs. If inference yields a null result, LR is set to None

newlabel: a relabelling of the individual ROIs, similar to u, :

which discards labels that do not fulfill the condition (c)