Inheritance diagram for nipy.labs.spatial_models.hroi:
This module contains the specification of ‘hierarchical 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’
Bases: nipy.labs.spatial_models.mroi.SubDomains
Class that handles hierarchical ROIs
Parameters : | `k`: int, :
`label`: array of shape (domain.size), dtype=np.int, :
`features`: dict{str: list of object, length=self.k} :
`roi_features`: dict{str: array-like, shape=(self.k, roi_feature_dim) :
`parents`: np.ndarray, shape(self.k) :
TODO: have the parents as a list of id rather than a list of indices. : |
---|
Methods
copy() | Returns a copy of self. |
feature_to_voxel_map(fid[, roi, method]) | Convert a feature to a flat voxel-mapping array. |
get_coord([id]) | Get coordinates of ROI’s voxels |
get_feature(fid[, id]) | Return a voxel-wise feature, grouped by ROI. |
get_id() | Return ROI’s id list. |
get_leaves_id() | Return the ids of the leaves. |
get_local_volume([id]) | Get volume of ROI’s voxels |
get_parents() | Return the parent of each node in the hierarchy |
get_roi_feature(fid[, id]) | |
get_size([id, ignore_children]) | Get ROI size (counted in terms of voxels) |
get_volume([id, ignore_children]) | Get ROI volume |
integrate([fid, id]) | Integrate certain feature on each ROI and return the k results |
make_forest() | Output an nipy forest structure to represent the ROI hierarchy. |
make_graph() | Output an nipy graph structure to represent the ROI hierarchy. |
merge_ascending(id_list[, pull_features]) | Remove the non-valid ROIs by including them in |
merge_descending([pull_features]) | Remove the items with only one son by including them in their son |
plot_feature(fid[, ax]) | Boxplot the distribution of features within ROIs. |
recompute_labels() | Redefine labels so that they are consecutive integers. |
reduce_to_leaves() | Create a new set of rois which are only the leaves of self. |
remove_feature(fid) | Remove a certain feature |
remove_roi_feature(fid) | Remove a certain ROI feature. |
representative_feature(fid[, method, id, ...]) | Compute a ROI representative of a given feature. |
select_id(id[, roi]) | Convert a ROI id into an index to be used to index features safely. |
select_roi(id_list) | Returns an instance of HROI with only the subset of chosen ROIs. |
set_feature(fid, data[, id, override]) | Append or modify a feature |
set_roi_feature(fid, data[, id, override]) | Append or modify a ROI feature |
to_image([fid, roi, method, descrip]) | Generates a label image that represents self. |
Building the HierarchicalROI
Returns a copy of self.
self.domain is not copied.
Convert a feature to a flat voxel-mapping array.
Get coordinates of ROI’s voxels
Parameters : | id: any hashable type :
|
---|
Return a voxel-wise feature, grouped by ROI.
Parameters : | fid: str, :
id: any hashable type :
|
---|
Return ROI’s id list.
Users must access ROIs with the use of the identifiers of this list and the methods that give access to their properties/features.
Return the ids of the leaves.
Get volume of ROI’s voxels
Parameters : | id: any hashable type :
|
---|
Return the parent of each node in the hierarchy
The parents are represented by their position in the nodes flat list.
TODO: The purpose of this class API is not to rely on this order, so we should have self.parents as a list of ids instead of a list of positions
Get ROI size (counted in terms of voxels)
Parameters : | id: any hashable type :
ignore_children: bool, :
|
---|
Get ROI volume
Parameters : | id: any hashable type, :
ignore_children: bool, :
|
---|
Integrate certain feature on each ROI and return the k results
Parameters : | fid : str
id: any hashable type :
|
---|---|
Returns : | lsum = array of shape (self.k, self.feature[fid].shape[1]), :
|
Output an nipy forest structure to represent the ROI hierarchy.
Output an nipy graph structure to represent the ROI hierarchy.
Remove the non-valid ROIs by including them in their parents when it exists.
Parameters : | id_list: list of id (any hashable type) :
pull_features: list of str :
|
---|
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) : |
---|
Boxplot the distribution of features within ROIs. Note that this assumes 1-d features.
Parameters : | fid: string :
ax: axis handle, optional : |
---|
Redefine labels so that they are consecutive integers.
Labels are used as a map to associate voxels to a given ROI. It is an inner object that should not be accessed outside this class. The number of nodes is updated appropriately.
Create a new set of rois which are only the leaves of self.
Modification of the structure is done in place. One way therefore want to work on a copy a of a given HROI oject.
Remove a certain feature
Parameters : | fid: str, :
|
---|
Remove a certain ROI feature.
The id ROI feature cannot be removed.
Compute a ROI representative of a given feature.
Parameters : | fid: str, :
method: str, :
id: any hashable type :
ignore_children: bool, :
assess_quality: bool :
|
---|
Convert a ROI id into an index to be used to index features safely.
Returns an instance of HROI with only the subset of chosen ROIs.
The hierarchy is set accordingly.
Parameters : | id_list: list of id (any hashable type) :
|
---|
Append or modify a feature
Parameters : | fid: str, :
data: list of self.k arrays of shape(self.size[k], p) or :
id: any hashable type :
override: bool, optional, :
Note that we cannot create a feature having the same name than : a ROI feature. : |
---|
Append or modify a ROI feature
Parameters : | fid: str, :
data: list of self.k features or a single feature :
id: any hashable type :
override: bool, optional, :
Note that we cannot create a ROI feature having the same name than : a feature. : Note that the `id` feature cannot be modified as an internal : component. : |
---|
Generates a label image that represents self.
Parameters : | fid: str, :
roi: bool, :
method: str, :
descrip: str, :
|
---|
Instantiate an HierarchicalROI as the blob decomposition of data in a certain domain.
Parameters : | domain: discrete_domain.StructuredDomain instance, :
data: array of shape (domain.size), :
threshold: float optional, :
criterion: string, optional :
smin: float, optional, :
|
---|---|
Returns : | nroi: HierachicalROI instance with a `signal` feature. : |
Instantiate an HierarchicalROI as the watershed of a certain dataset
Parameters : | domain: discrete_domain.StructuredDomain instance, :
data: array of shape (domain.size), :
threshold: float optional, :
|
---|---|
Returns : | The HierachicalROI instance with a `seed` feature. : |
Performs an agglomeration then a selection of regions so that a certain size or volume criterion is satisfied.
Parameters : | input_hroi: HierarchicalROI instance, :
criterion: str, optional :
smin: float, optional :
|
---|---|
Returns : | output_hroi: HierarchicalROI instance : |
Instantiate an HROi from a SubDomain instance and parents