NIPY logo

Site Navigation

NIPY Community

Table Of Contents

Previous topic

labs.spatial_models.hierarchical_parcellation

This Page

labs.spatial_models.hroi

Module: labs.spatial_models.hroi

Inheritance diagram for nipy.labs.spatial_models.hroi:

This module contains the specification of ‘heierarchical ROI’ object, Which is used in spatial models of the library such as structural analysis

The connection with other classes is not completely satisfactory at the moment: there should be some intermediate classes between ‘Fields’ and ‘hroi’

Author : Bertrand Thirion, 2009-2011

Class

HierarchicalROI

class nipy.labs.spatial_models.hroi.HierarchicalROI(domain, label, parents, rid='')

Bases: nipy.labs.spatial_models.mroi.SubDomains

Class that handles hierarchical ROIs

Methods

argmax_feature
check_features
copy Generic (shallow and deep) copying operations.
get_coord
get_feature
get_k
get_parents
get_roi_feature
get_size
get_volume
integrate
isleaf
make_feature
make_forest
make_graph
merge_ascending
merge_descending
plot_feature
reduce_to_leaves
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, parents, rid='')

Building the HierarchicalROI

argmax_feature(fid)

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

check_features()
copy(rid='')

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

get_coord(k)

returns self.coord[k]

get_feature(fid, k=None)

return self.features[fid]

get_k()
get_parents()
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

isleaf()
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

make_forest()

output an fff.forest structure to represent the ROI hierarchy

make_graph()

output an fff.graph structure to represent the ROI hierarchy

merge_ascending(valid)

Remove the non-valid ROIs by including them in their parents when it exists

Parameters :valid array of shape(self.k) :
merge_descending(methods=None)

Remove the items with only one son by including them in their son

Parameters :

methods indicates the way possible features are dealt with :

(not implemented yet) :

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 :

reduce_to_leaves(rid='')

create a new set of rois which are only the leaves of self

remove_feature(fid)

Remove a certain feature

representative_feature(fid, method='mean')

Compute an ROI-level feature given the discrete features

Parameters :

fid(string) the discrete feature under consideration :

method=’average’ the assessment method :

Returns :

the computed roi-feature is returned :

select(valid, rid='', no_empty_label=True)

Remove the rois for which valid==0 and update the hierarchy accordingly Note that auto=True automatically

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, descrip=None, write_type=<type 'numpy.int16'>, data=None)

Generates and possiblly writes a label image that represents self.

Parameters :

path: string, optional :

output image path

descrip: string, optional, :

descritpion associated with the output image

write_type: string, optional, :

type of the written data

data: array os shape (self.k), optional, :

information to write into the image

Functions

nipy.labs.spatial_models.hroi.HROI_as_discrete_domain_blobs(domain, data, threshold=-inf, smin=0, rid='', criterion='size')

Instantiate an HierarchicalROI as the blob decomposition of data in a certain domain

Parameters :

domain: discrete_domain.StructuredDomain instance, :

definition of the spatial context

data: array of shape (domain.size), :

the corresponding data field

threshold: float optional, :

thresholding level

smin: float, optional, :

a threhsold on region size or cardinality.

rid: string, optional, :

a region identifier

Returns :

nroi: HierachicalROI instance :

nipy.labs.spatial_models.hroi.HROI_from_watershed(domain, data, threshold=-inf, rid='')

Instantiate an HierarchicalROI as the watershed of a certain dataset

Parameters :

domain: discrete_domain.StructuredDomain instance, :

definition of the spatial context

data: array of shape (domain.size), :

the corresponding data field

threshold: float optional, :

thresholding level

Returns :

the HierachicalROI instance :

nipy.labs.spatial_models.hroi.hroi_agglomeration(input_hroi, criterion='size', smin=0)

Performs an agglomeration then a selction of regions so that a certain size or volume criterion is staisfied

Parameters :

input_hroi: HierachicalROI instance, :

the input hROI

criterion: string, optional :

to be chosen among ‘size’ or ‘volume’

smin: float, optional :

the applied criterion

Returns :

output_hroi: HierachicalROI instance :

nipy.labs.spatial_models.hroi.make_hroi_from_subdomain(sub_domain, parents)

Instantiate an HROi from a SubDomain instance and parents