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