tract_querier.tractography¶
Functions
- class tract_querier.tractography.Tractography(tracts=None, tracts_data=None, validate=True, **kwargs)[source]¶
Bases:
objectClass to represent a tractography dataset
- Parameters:
- tractslist of float array N_i\times 3
Each element of the list is a tract represented as point array, the length of the i-th tract is N_i
- tracts_datadict of <data name>= list of float array of N_i\times M
Each element in the list corresponds to a tract, N_i is the length of the i-th tract and M is the number of components of that data type.
- validatebool
Check that tracts and tracts_data are valid
- Attributes:
- extra_args
Methods
add_tract_data_from_array(name, array)Add a new data element reproducing a constant data value for each of the $M$ tracts.
append(tracts[, tracts_data, validate])Append tracts and corresponding data to the current set
filter_tracts(criterium)Filter the tracts in the set according to a criterium function
Tract indices included after the filtering
Tract set used to original construct this tractography object, no subsampling or filtering applied
Tract data contained of the original dataset of this tractography object
subsample_tracts(points_per_tract)Subsample the tracts in the dataset to a maximum number of points per tract
tracts()Tracts contained in this tractography object after filtering and subsampling if these operations have been applied
Tract data contained in this tractography object after filtering and subsampling if these operations have been applied
Reset any filtering applied to the tracts
Reset any subsampling applied to the tracts
are_tracts_filtered
are_tracts_subsampled
- property extra_args¶
- append(tracts, tracts_data=None, validate=True)[source]¶
Append tracts and corresponding data to the current set
- Parameters:
- tractslist of float array N_i\times 3
Each element of the list is a tract represented as point array, the length of the i-th tract is N_i
- tracts_datadict of <data name>= list of float array of N_i\times M
Each element in the list corresponds to a tract, N_i is the length of the i-th tract and M is the number of components of that data type.
- validatebool
Check that tracts and tracts_data are valid
- subsample_tracts(points_per_tract)[source]¶
Subsample the tracts in the dataset to a maximum number of points per tract
- Parameters:
- points_per_tract: int
Maximum number of points per tract after the operation is executed
- filter_tracts(criterium)[source]¶
Filter the tracts in the set according to a criterium function
- Parameters:
- criteriumfunction of array N\times 3 -> Bool
A function taking a tract as an array of 3D points and returning True or False with specifying if it should be included
- original_tracts()[source]¶
Tract set used to original construct this tractography object, no subsampling or filtering applied
- Returns:
- tractslist of float array N_i\times3
Each element of the list is a tract represented as point array, the length of the i-th tract is N_i
- original_tracts_data()[source]¶
Tract data contained of the original dataset of this tractography object
- Returns:
- tract datadict of <data name>= list of float array of N_i\times M
Each element in the list corresponds to a tract, N_i is the length of the i-th tract and M is the number of components of that data type.
- filtered_tracts_map()[source]¶
Tract indices included after the filtering
- Returns:
- List of tract indices included after the filtering
- tracts()[source]¶
Tracts contained in this tractography object after filtering and subsampling if these operations have been applied
- Returns:
- tractslist of float array N_i\times 3
Each element of the list is a tract represented as point array, the length of the i-th tract is N_i
- tracts_data()[source]¶
Tract data contained in this tractography object after filtering and subsampling if these operations have been applied
- Returns:
- tract datadict of <data name>= list of float array of N_i\times M
Each element in the list corresponds to a tract, N_i is the length of the i-th tract and M is the number of components of that data type.
- add_tract_data_from_array(name, array)[source]¶
Add a new data element reproducing a constant data value for each of the $M$ tracts.
After execution, the tract data will have a new set original_tracts_data()[name][i][:] == array[i]
- Parameters:
- namestr
Name of the new data element
- arrayarray of length $M$
Data value for each tract
- tract_querier.tractography.tractography_to_trackvis_file(filename, tractography, affine=None, image_dimensions=None)[source]¶
- tract_querier.tractography.vtkPolyData_to_tracts(polydata, return_tractography_object=True)[source]¶
Reads a VTKPolyData object and outputs a tracts/tracts_data pair
- Parameters:
- polydatavtkPolyData
VTKPolyData Object
- Returns:
- tractslist of float array N_ix3
Each element of the list is a tract represented as point array, the length of the i-th tract is N_i
- tract_datadict of <data name>= list of float array of N_ixM
Each element in the list corresponds to a tract, N_i is the length of the i-th tract and M is the number of components of that data type.