NIPY logo

Site Navigation

NIPY Community

Table Of Contents

Previous topic

neurospin.spatial_models.hroi

This Page

neurospin.spatial_models.mroi

Module: neurospin.spatial_models.mroi

Inheritance diagram for nipy.neurospin.spatial_models.mroi:

Classes

MultiROI

class nipy.neurospin.spatial_models.mroi.MultiROI(domain, k, rid='')

Bases: object

This is an abstract class from which different types of multiple ROI classes will be derived

Methods

get_roi_feature
select This module supports asynchronous I/O on multiple file descriptors.
set_roi_feature
__init__(domain, k, rid='')
Parameters :

domain: ROI instance :

defines the spatial context of the SubDomains

k: non-negative int, number of regions considered :

id: string, optional, identifier :

get_roi_feature(fid)
select(valid)

Select a subset of ROIs and he associated features

set_roi_feature(fid, data)

SubDomains

class nipy.neurospin.spatial_models.mroi.SubDomains(domain, label, id='', no_empty_label=True)

Bases: object

This is another implementation of Multiple ROI, where the reference to a given domain is explicit

fixme : make roi_features implementation consistent

Methods

argmax_feature
check_features
copy Generic (shallow and deep) copying operations.
get_coord
get_feature
get_roi_feature
get_size
get_volume
integrate
make_feature
plot_feature
remove_feature
representative_feature
select This module supports asynchronous I/O on multiple file descriptors.
set_feature
set_roi_feature
to_image
__init__(domain, label, id='', no_empty_label=True)
Parameters :

domain: ROI instance :

defines the spatial context of the SubDomains

label: array of shape (domain.size), dtype=np.int, :

the label values greater than -1 correspond to subregions labelling

id: string, optional, identifier :

no_empty_label: Bool, optional :

if True absent label values are collapsed

otherwise, label is kept but empty regions might exist

argmax_feature(fid)

Return the list of roi-level argmax of feature called fid

check_features()
copy(id='')

Returns a copy of self Note that self.domain is not copied

get_coord(k)

returns self.coord[k]

get_feature(fid, k=None)

return self.features[fid]

get_roi_feature(fid)

roi_features accessor

get_size()

returns size, k-length array

get_volume(k)

returns self.local_volume[k]

integrate(fid=None)

Integrate certain feature on each ROI and return the k results

Parameters :

fid : string, feature identifier,

by default, the 1 function is integrataed, yielding ROI volumes

Returns :

lsum = array of shape (self.k, self.feature[fid].shape[1]), :

the results

make_feature(fid, data, override=True)

Extract a set of ffeatures from a domain map

Parameters :

fid: string, :

feature identifier

data: array of shape(deomain.size) or (domain, size, dim), :

domain map from which ROI features are axtracted

override: bool, optional, :

Allow feature overriding

plot_feature(fid, ax=None)

boxplot the distribution of features within ROIs Note that this assumes 1-d features

Parameters :

fid: string, :

the feature identifier

ax: axis handle, optional :

remove_feature(fid)

Remove a certain feature

representative_feature(fid, method='mean')

Compute a statistical representative of the within-Foain feature

Parameters :

fid: string, feature id :

method: string, method used to compute a representative :

chosen among ‘mean’, ‘max’, ‘median’, ‘min’, ‘weighted mean’

select(valid, id='', auto=True, no_empty_label=True)

returns an instance of multiple_ROI with only the subset of ROIs for which valid

Parameters :

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

which ROIs will be included in the output

id: string, optional, :

identifier of the output instance

auto: bool, optional, :

if True then self = self.select()

no_empty_label: bool, optional, :

if True, labels with no matching site are excluded

Returns :

the instance, if auto==False, nothing otherwise :

set_feature(fid, data, override=True)

Append a feature ‘fid’

Parameters :

fid: string, :

feature identifier

data: list of self.k arrays of shape(self.size[k], p) or self.size[k] :

the feature data

override: bool, optional, :

Allow feature overriding

set_roi_feature(fid, data)
Parameters :

fid: string, feature identifier :

data: array of shape(self.k, p), with p>0 :

to_image(path=None)

Generates and possiblly writes a label image that represents self.

Functions

nipy.neurospin.spatial_models.mroi.subdomain_from_array(labels, affine=None, nn=0)

return a SubDomain from an n-d int array

Parameters :

label: np.array instance :

a supposedly boolean array that yields the regions

affine: np.array, optional :

affine transform that maps the array coordinates to some embedding space by default, this is np.eye(dim+1, dim+1)

nn: int, neighboring system considered, :

unsued at the moment

nipy.neurospin.spatial_models.mroi.subdomain_from_balls(domain, positions, radii)

Create discrete ROIs as a set of balls within a certain coordinate systems

Parameters :

domain: StructuredDomain instance, :

the description of a discrete domain

positions: array of shape(k, dim): :

the positions of the balls

radii: array of shape(k): :

the sphere radii

nipy.neurospin.spatial_models.mroi.subdomain_from_image(mim, nn=18)

return a SubDomain instance from the input mask image

Parameters :

mim: NiftiIImage instance, or string path toward such an image :

supposedly a label image

nn: int, optional :

neighboring system considered from the image can be 6, 18 or 26

Returns :

The MultipleROI instance :

nipy.neurospin.spatial_models.mroi.subdomain_from_position_and_image(nim, pos)

keeps the set of labels of the image corresponding to a certain index so that their position is closest to the prescribed one Parameters ———- mim: NiftiIImage instance, or string path toward such an image

supposedly a label image
pos: array of shape(3) or list of length 3,
the prescribed position