Bundles Database¶
Fiber bundles definitions can be stored in the database. Bundles can be defined as a flat list of checkpoints, or more general logical structures.
Notice these fibers can be accessed using the get()
method, like
reader.get("fibers",119,db-id=10)
Load¶
-
get_bundle_ids_and_names
()[source]¶ Available bundles
Returns: A list of tuples (id,name)
where id is the bundle id and name is the bundle name
-
get_bundles_list
(bundle_type=None)[source]¶ Get available bundles
Parameters: bundle_type (int) – Optional, restrict only to a certain type, see get_bundle_details()
Returns: A list containing the names of the available bundles
-
get_bundle_name
(bundle_id)[source]¶ Name of a bundle in the database
Parameters: bundle_id (int) – Bundle id Returns: Bundle name
-
check_if_name_exists
(name)[source]¶ Check if a bundle with the given name exists in the database
Parameters: name (str) – Bundle name Returns: True
if a bundle with this name exists,False
otherwise
-
get_logic_bundle_dict
(bundle_id=None, bundle_name=None)[source]¶ Retrieves a logic bundle from the database
Only one of the arguments is required, bundle_id is preferred
Parameters: - Returns
A nested dictionary with the specification of the logic bundle. The hierarchy is represented as a tree, where each node is a dictionary. The returned dictionary represents the top node of this tree. There are three types of nodes: logical, structures and rois. All nodes are dictionaries with three keys :
"node_type"
,"value"
and"extra_data"
- Logic nodes: Value is a string which can take the values
"OR"
,"AND"
or"NOT"
. Extra_data holds a list of children nodes. OR nodes represent the union from the sets returned by each child, AND represent an intersection, and NOT subtracts the union from the reference set (the whole tractography). - Structure nodes: Leaf node, its value contains the name of an structure. It represents the fibers that cross such structure.
- ROI nodes: Leaf node, its extra_data contains the database id for a ROI
(see
geom_db
). It represents fibers that cross such ROI.
- Logic nodes: Value is a string which can take the values
-
get_bundle_details
(bundle_id)[source]¶ Low Level, Get all data from a given bundle
Parameters: bundle_id (int) – Bundle id Returns: (name,type,data)
where name is the bundle name, type is the bundle type and data is the raw data for the bundle. The current types areType Description Data contents 0 Alias to named fiber str containing fiber name 1 Waypoints and
pickled waypoints list 2 Waypoints or
pickled waypoints list 10 Hierarchical pickled nodes dictionary
Save¶
-
save_checkpoints_bundle
(*args, **kwargs)[source]¶ Saves a bundle defined using checkpoints
Parameters:
-
save_logic_bundle
(*args, **kwargs)[source]¶ Saves a logic bundle into the database
Parameters: - bundle_name (str) – Name for the bundle
- logic_tree_dict (dict) – Dictionary describing the bundle, see
get_logic_bundle_dict()