Table Of Contents

Previous topic

neurospin.utils.nosetester

Next topic

neurospin.utils.simul_2d_multisubject_fmri_dataset

This Page

neurospin.utils.roi

Module: neurospin.utils.roi

Inheritance diagram for nipy.neurospin.utils.roi:

Classes

MultipleROI

class nipy.neurospin.utils.roi.MultipleROI(id='roi', k=0, header=None)

This is a class to deal with multiple ROIs defined in a given space mroi.header is assumed to provide all the referential information (this should be changed in the future), so that the mroi is basically defined as a multiple sets of 3D coordinates finally, there is an associated feature dictionary. Typically it is assumed that each feature is an (roi,feature_dim) array, i.e. each roi is assumed homogeneous wrt the feature In the future, it might be possible to complexify the structure to model within-ROI variance

__init__(id='roi', k=0, header=None)
roi = MultipleROI(id=’roi’, header=None) - id (string): roi identifier - k: number of rois that are included in the structure - header (nipy header) : referential-defining information
append_balls(position, radius)
idem self.as_multiple_balls, but the ROIs are added
as_multiple_balls(position, radius)
self.as_multiple_balls(position, radius) Given a set of positions and radii, defines one roi at each (position/radius) couple INPUT: position: array of shape (k,3): the set of positions radius: array of shape (k): the set of radii
check_features()
check that self.features have the coorect size i.e; f.shape[0]=self.k for f in self.features
check_header(image)
checks that the image is in the header of self INPUT: - image: (string) the path of an image
clean(valid)
remove the regions for which valid<=0
complete_feature(fid, values)
completes a feature by appending the values
from_labelled_image(image, labels=None, add=True)
All the voxels of the image that have non-zero-value self.k becomes the number of values of the (discrete) image INPUT: - image (string): a nifti label (discrete valued) image -labels=None : the set of image labels that shall be used as ROI definitions By default, all the image labels are used note that this can be used to append features, when rois are already defined
get_size()
return the number of voxels per ROI in one array
make_image(name)
write a int nifty image where the nonzero values are the ROIs INPUT: - the desired image name NOTE: - the background values are set to -1 - the ROIs values are set as [0..self.k-1]
plot_feature(fid)
boxplot the feature within the ROI Note that this assumes a 1-d feature
set_feature_from_image(fid, image, method='average')
extract some roi-related information from an image INPUT: - fid: feature id - image(string): image name - method=’average’ (string) : take the roi feature as the average feature over the ROI
set_roi_feature(fid, data)
INPUT: - fid (string): feature identifier, e.g. - data: array of shape(self.k,p),with p>0 this function simply stores data

ROI

class nipy.neurospin.utils.roi.ROI(id='roi', header=None)

Temporary ROI class for fff Ultimately, it should be merged with the nipy class

ROI definition requires - an identifier - an header (exactly a nifti header at the moment, though not everything is necessary) The ROI can be derived from a image or defined in the coordinate system implied by header.sform()

roi.features is a dictionary of informations on the ROI elements. It is assumed that the ROI is sampled on a discrete grid, so that each feature is in fact a (voxel,feature_dimension) array

__init__(id='roi', header=None)
roi = ROI(id=’roi’, header=None) - id (string): roi identifier - header (nipy header) : referential-defining information
check_header(image)
checks that the image is in the header of self INPUT: - image: (string) the path of an image
from_binary_image(image)
Take all the <>0 sites of the image as the ROI INPUT: - image: (string) the path of an image
from_labelled_image(image, label)
All the voxels of the image that have the pre-defined label INPUT: image: a nifti label (discrete valued) image label (int): the desired label
from_position(position, radius)
a ball in the grid requires that the grid and header are defined
from_position_and_image(image, position)
the label on the image that is closest to the provided position INPUT: - image: a nifti label (discrete valued) image - position: a position in the common space NOTE: everything could be performed in the image space
get_feature(fid)
return the feature corrsponding to fid, if it exists
make_image(name)
write a binary nifty image where the nonzero values are the ROI mask INPUT: the desired image name
plot_feature(fid)
boxplot the feature within the ROI
representative_feature(fid, method='mean')
Compute a statistical representative of the within-ROI feature
set_feature(fid, data)
INPUT: - fid (string): feature identifier, e.g. - data (array of shape (self.VolumeExtent)) this function creates a reduced feature array corresponding to the ROI item OUTPUT: - ldata: array of shape (roi.nbvox,dim) the ROI-based feature
set_feature_from_image(fid, image)
extract some roi-related information from an image INPUT: - fid: feature id - image(string): image name
set_feature_from_masked_data(fid, data, mask)
idem set_feature but the input data is thought to be masked

WeightedROI

class nipy.neurospin.utils.roi.WeightedROI(id='roi', header=None, grid=None)

Bases: nipy.neurospin.utils.roi.ROI

ROI where a weighting is defined on the voxels

__init__(id='roi', header=None, grid=None)

Functions

nipy.neurospin.utils.roi.test1(verbose=0)
nipy.neurospin.utils.roi.test2(verbose=0)
nipy.neurospin.utils.roi.test_mroi1(verbose=0)
nipy.neurospin.utils.roi.test_mroi2(verbose=0)
nipy.neurospin.utils.roi.test_mroi3(verbose=0)