whitematteranalysis package#

Subpackages#

Submodules#

whitematteranalysis.cluster module#

cluster.py

implementations of fiber clustering

class whitematteranalysis.cluster.ClusterAtlas#

Bases: object

Variables necessary to label a new subject from a spectral cluster atlas.

load(directory, atlas_name, verbose=False)#
save(directory, atlas_name)#
whitematteranalysis.cluster.hierarchical(input_polydata, number_of_clusters=300, threshold=2, fcluster_threshold=0.4, number_of_jobs=3)#

This is just a test. This is only a test. Stay tuned.

whitematteranalysis.cluster.load_atlas(directory, atlas_name)#

Convenience function to load a spectral cluster atlas

whitematteranalysis.cluster.mask_all_clusters(inpd, cluster_numbers_s, number_of_clusters, color=None, preserve_point_data=True, preserve_cell_data=False, verbose=True)#
whitematteranalysis.cluster.nearPSD(A, epsilon=0)#
whitematteranalysis.cluster.output_and_quality_control_cluster_atlas(atlas, output_polydata_s, subject_fiber_list, input_polydatas, number_of_subjects, outdir, cluster_numbers_s, color, embed, number_of_fibers_to_display, testing=False, verbose=False, render_images=True)#

Save the output in our atlas format for automatic labeling of clusters.

First save the atlas.vtp and atlas.p datasets. This is the data used to label a new subject. Also write the polydata with cluster indices saved as cell data. This is a one-file output option for clusters. Finally, save some quality control metrics and save the atlas clusters as individual polydatas. This is used to set up a mrml hierarchy file and to visualize the output in Slicer. This data is not used to label a new subject.

whitematteranalysis.cluster.spectral(input_polydata, number_of_clusters=200, number_of_eigenvectors=20, sigma=60, threshold=0.0, number_of_jobs=3, use_nystrom=False, nystrom_mask=None, landmarks=None, distance_method='Mean', normalized_cuts=True, outlier_std_threshold=2.0, pos_def_approx=True, bilateral=False)#

Spectral clustering based on pairwise fiber affinity matrix.

As in O’Donnell and Westin TMI 2007.

Differences from that implementation: fiber point correspondences are defined using fixed-length fiber parameterization (instead of closest point).

whitematteranalysis.cluster.spectral_atlas_label(input_polydata, atlas, number_of_jobs=2)#

Use an existing atlas to label a new polydata.

Returns the cluster indices for all the fibers. output_polydata, cluster_numbers, color, embed = wma.cluster.spectral_atlas_label(input_data, atlas)

whitematteranalysis.cluster.view_cluster_number(input_polydata, cluster_number, cluster_indices=None)#

Pop up a render window showing the selected cluster.

Uses cluster_indices to choose corresponding cells in the polydata. If no argument cluster_indices is provided, then uses the cell data array named ClusterNumber. One of these inputs must be present.

whitematteranalysis.congeal_multisubject module#

congeal_multisubject.py

re-implementation of fiber tractography registration (group)

class MultiSubjectRegistration

class whitematteranalysis.congeal_multisubject.MultiSubjectRegistration#

Bases: object

add_polydata(polydata, subject_id)#

Add a subject’s data to the groupwise registration. self.nonrigid

must be set before calling this, if nonrigid registration is desired.

iterate()#

Run a single iteration of optimization, multiprocessing over input subjects.

remove_mean_from_transforms()#

Remove mean rotations and mean scaling and mean translations from transforms. The mean rotation and translation should not affect the objective function anyway. A mean scaling will affect the objective, i.e. if the brain shrinks all distances become smaller and the similarity is higher. This is not the desired effect.

save_transformed_polydatas(intermediate_save=False, midsag_symmetric=False)#

Output polydatas for final or intermediate iterations.

update_nonrigid_grid()#

This updates the nonrigid grids. Subjects must be added first using

add_polydata.

whitematteranalysis.congeal_multisubject.congeal_multisubject_inner_loop(mean, subject, initial_transform, mode, sigma, subject_idx, iteration_count, output_directory, step_size, maxfun, render, grid_resolution)#

This is the code executed by each subprocess that launches the

registration of one subject to the current atlas model or mean brain.

whitematteranalysis.congeal_to_atlas module#

congeal_multisubject.py

re-implementation of fiber tractography registration (group)

class MultiSubjectRegistration

class whitematteranalysis.congeal_to_atlas.SubjectToAtlasRegistration#

Bases: object

iterate()#
save_transformed_polydata(intermediate_save=False)#
save_transformed_polydata_to_disk(outdir)#
set_atlas(polydata, atlas_id)#
set_subject(polydata, subject_id)#
update_nonrigid_grid()#

This updates the nonrigid grid. Subject data must be added first.

whitematteranalysis.fibers module#

fibers.py

This module contains code for representation of tractography using a fixed-length parameterization.

class FiberArray

class whitematteranalysis.fibers.Fiber#

Bases: object

A class for fiber tractography data, represented with a fixed length

get_equivalent_fiber()#

Get the reverse order of current line (trajectory), as the fiber can be equivalently represented in either order.

get_reflected_fiber()#

Returns reflected version of current fiber by reflecting fiber across midsagittal plane. Just sets output R coordinate to -R.

match_order(other)#

Reverse order of fiber to match this one if needed

class whitematteranalysis.fibers.FiberArray#

Bases: object

A class for arrays of fiber tractography data, represented with a fixed length

calculate_hemispheres()#

For each fiber assign a hemisphere using the first (R) coordinates.

This part assumes we are in RAS so the first coordinate is positive to the RIGHT and negative to the LEFT. The fiber must be more than 95% within 1 hemisphere. This excludes corpus but can retain errant cingulum. We also want to identify likely commissural fibers.

convert_from_polydata(input_vtk_polydata, points_per_fiber=None)#

Convert input vtkPolyData to the fixed length fiber representation of this class.

The polydata should contain the output of tractography.

The output is downsampled fibers in array format and hemisphere info is also calculated.

convert_to_polydata()#

Convert fiber array to vtkPolyData object.

get_equivalent_fiber(fiber_index)#

Return equivalent version of fiber number fiber_index. Return value is class Fiber. Gets the reverse order of line (trajectory), as the fiber can be equivalently represented in either order.

get_fiber(fiber_index)#

Return fiber number fiber_index. Return value is class Fiber.

get_fibers(fiber_indices)#

Return FiberArray containing subset of data corresponding to fiber_indices

get_oriented_fibers(fiber_indices, order)#

Return FiberArray containing subset of data corresponding to fiber_indices. Order fibers according to the array (where 0 is no

change, and 1 means to reverse the order and return the equivalent fiber)

whitematteranalysis.filter module#

filter.py

Swiss army knife of fiber polydata processing.

This module provides filtering functions that operate on vtkPolyData objects containing whole-brain tractography.

Preprocess by removing fibers based on length, or endpoint distance. Downsample. Mask. Create symmetrized test data.

preprocess downsample mask symmetrize remove_hemisphere remove_outliers

whitematteranalysis.filter.add_point_data_array(inpd, data, array_name)#

Make a vtk point data array from input data array and add to inpd.

Input data must have dimensions of the number of lines in the input polydata. The output array will be added to the polydata and will be point data, so the per-line values will be duplicated to become per-point values (each point on the line) for visualization.

whitematteranalysis.filter.anisotropic_smooth(inpd, fiber_distance_threshold, points_per_fiber=30, n_jobs=2, cluster_max=10)#

Average nearby fibers.

The pairwise fiber distance matrix is computed, then fibers are averaged with their neighbors until an edge (>max_fiber_distance) is encountered.

whitematteranalysis.filter.array_to_vtk(inarray, name='from_numpy')#
whitematteranalysis.filter.compute_lengths(inpd)#

Compute length of each fiber in polydata. Returns lengths and step size.

Step size is estimated using points in the middle of a fiber with over 15 points.

whitematteranalysis.filter.downsample(inpd, output_number_of_lines, return_indices=False, preserve_point_data=False, preserve_cell_data=True, initial_indices=None, verbose=True, random_seed=1234)#

Random (down)sampling of fibers without replacement.

whitematteranalysis.filter.flatten_length_distribution(inpd, min_length_mm=None, max_length_mm=None, num_bins=10, fibers_per_bin=1000, verbose=True)#

In order to cluster all structures without removing more prevalent shorter ones, sample equal numbers across length ranges.

This should enable clustering of smaller u-fibers than previously possible, while incorporating information about longer fibers they are near for stability.

whitematteranalysis.filter.laplacian_of_gaussian(inpd, fiber_distance_sigma=25, points_per_fiber=30, n_jobs=2, upper_thresh=30)#

Filter nearby fibers, using LoG weights.

The pairwise fiber distance matrix is computed, then fibers are averaged with their neighbors using LoG weighting. This is essentially a fiber subtraction operation, giving vectors pointing from the center fiber under the kernel, to all nearby fibers. Thus the output of this operation is not a fiber, but we compute properties of the output that might be interesting and related to fibers. We summarize the result using the average vector at each fiber point (output is its magnitude, similar to edge strength). The covariance of the vectors is also investigated. This matrix would be spherical in an isotropic region such as a tract center (tube/line detector), or planar in a sheetlike tract (sheet detector).

The equation is: (1-d^2/sigma^2) exp(-d^2/(2*sigma^2)), and weights are normalized in the neighborhood (weighted averaging).

whitematteranalysis.filter.mask(inpd, fiber_mask, color=None, preserve_point_data=False, preserve_cell_data=True, verbose=True)#

Keep lines and their points where fiber_mask == 1.

Unlike vtkMaskPolyData that samples every nth cell, this function uses an actual mask, and also gets rid of points that are not used by any cell, reducing the size of the polydata file.

This code also sets scalar cell data to input color data. This input data is expected to be 1 or 3 components.

If there is no input cell scalar color data, existing cell scalars that we have created (EmbeddingColor, ClusterNumber, EmbeddingCoordinate) are looked for and masked as well.

whitematteranalysis.filter.measure_line_lengths(inpd)#
whitematteranalysis.filter.pd_to_array(inpd, dims=225)#
whitematteranalysis.filter.preprocess(inpd, min_length_mm, remove_u=False, remove_u_endpoint_dist=40, remove_brainstem=False, return_indices=False, return_lengths=False, preserve_point_data=False, preserve_cell_data=False, verbose=True, max_length_mm=None)#

Remove fibers below a length threshold and using other criteria (optional).

Based on fiber length, and optionally on distance between endpoints (u-shape has low distance), and inferior location (likely in brainstem).

whitematteranalysis.filter.remove_hemisphere(inpd, hemisphere=-1)#

Remove left (-1) or right (+1) hemisphere points.

whitematteranalysis.filter.remove_outliers(inpd, min_fiber_distance, n_jobs=0, distance_method='Mean')#

Remove fibers that have no other nearby fibers, i.e. outliers.

The pairwise fiber distance matrix is computed, then fibers are rejected if their average neighbor distance (using closest 3 neighbors) is higher than min_fiber_distance.

whitematteranalysis.filter.smooth(inpd, fiber_distance_sigma=25, points_per_fiber=30, n_jobs=2, upper_thresh=30)#

Average nearby fibers.

The pairwise fiber distance matrix is computed, then fibers are averaged with their neighbors using Gaussian weighting.

The “local density” or soft neighbor count is also output.

whitematteranalysis.filter.symmetrize(inpd)#

Generate symmetric polydata by reflecting.

Output polydata has twice as many lines as input.

whitematteranalysis.io module#

io.py

This module provides input of vtk polydata tractography files (vtk/vtp). It also provides a class for I/O of laterality results.

read_polydata

Function to read vtkPolyData in .vtk or .vtp form

write_laterality_results

Function to write laterality indices, histograms, polydata to summarize laterality output

read_laterality_results

This function reads in the laterality data for further analysis.

class whitematteranalysis.io.LateralityResults#

Bases: object

Results of laterality computation for a subject.

This class defines the structure returned by ComputeWhiteMatterLaterality. I/O functions included in this class are read and write.

read(dirname, readpd=False, readdist=False)#

Read output (class laterality.LateralityResults) for one subject.

write(dirname, savedist=False)#

Write output laterality results for one subject.

whitematteranalysis.io.list_transform_files(input_dir)#
whitematteranalysis.io.list_vtk_files(input_dir)#
whitematteranalysis.io.read_and_preprocess_polydata_directory(input_dir, fiber_length, number_of_fibers, random_seed=None, fiber_length_max=None)#

Find and read all .vtk and .vtp files in the given directory input_dir. Preprocess with fiber length threshold and downsample to desired number of fibers.

whitematteranalysis.io.read_polydata(filename)#

Read whole-brain tractography as vtkPolyData format.

whitematteranalysis.io.transform_polydata_from_disk(in_filename, transform_filename, out_filename)#
whitematteranalysis.io.transform_polydata_from_disk_using_transform_object(in_filename, transform, out_filename)#
whitematteranalysis.io.transform_polydatas_from_disk(input_dir, transforms, output_dir)#

Loop over all input polydata files and apply the vtk transforms from the

input transforms list. Save transformed polydata files in the output directory. As long as files were read in using list_vtk_files originally, they will be in the same order as the transforms now.

whitematteranalysis.io.transform_polydatas_from_diskOLD(input_dir, transforms, output_dir)#

Loop over all input polydata files and apply the vtk transforms from the

input transforms list. Save transformed polydata files in the output directory. As long as files were read in using list_vtk_files originally, they will be in the same order as the transforms now.

whitematteranalysis.io.transform_polydatas_from_diskUNSAFE(input_dir, transforms, output_dir, parallel_jobs=3)#

Loop over all input polydata files and apply the vtk transforms from the

input transforms list. Save transformed polydata files in the output directory. As long as files were read in using list_vtk_files originally, they will be in the same order as the transforms now.

whitematteranalysis.io.write_polydata(polydata, filename)#

Write polydata as vtkPolyData format, according to extension.

whitematteranalysis.io.write_transforms_to_itk_format(transform_list, outdir, subject_ids=None)#

Write VTK affine or spline transforms to ITK 4 text file formats.

Input transforms are in VTK RAS space and are forward transforms. Output transforms are in LPS space and are the corresponsing inverse transforms, according to the conventions for these file formats and for resampling images. The affine transform is straightforward. The spline transform file format is just a list of displacements that have to be in the same order as they are stored in ITK C code. This now outputs an ITK transform that works correctly to transform the tracts (or any volume in the same space) in Slicer. In the nonrigid case, we also output a vtk native spline transform file using MNI format.

whitematteranalysis.laterality module#

laterality.py

This module calculates white matter fiber laterality indices.

functions

def laterality_index(left, right, idx=None)

Just calculates hemisphere laterality index from array inputs left and right. LI= (R-L)/(R+L). If R==L==0, output is 0.

class ComputeWhiteMatterLaterality

Class that actually does the computation. Input is polydata, parameters include sigma, points used to parametrize the fiber, and lower threshold on fiber distance. Output is of class LateralityResults (io.py)

class whitematteranalysis.laterality.WhiteMatterLaterality#

Bases: object

Laterality computation from fiber tracts.

compute(input_vtk_polydata)#

Actually calculate the laterality index for every input fiber.

Input polydata is required. This polydata is modified by adding a cell data array containing laterality indices.

Output from this class is a struct: <io.py> class LateralityResults

Parameters in the class can also be modified for experiments: sigma (in Gaussian on inter-fiber-point distance), points_per_fiber (for parameterization), threshold (below which inter-fiber-point distance is set to 0).

Performance options are the number of parallel_jobs, and verbose (whether to print progress).

whitematteranalysis.laterality.compute_laterality_index(left, right, idx=None)#

Compute laterality index from left and right hemisphere quantities.

whitematteranalysis.mrml module#

mrml.py

output in MRML scene file format (XML)

class whitematteranalysis.mrml.WriteMRML#

Bases: object

write(pd_filenames, colors, filename, ratio=1.0)#
write_node(pd_fname, color, name, f, ratio)#
write_prop_node(idx, f)#
whitematteranalysis.mrml.write(pd_filenames, colors, filename, ratio=1.0)#

whitematteranalysis.register module#

class whitematteranalysis.register.RegistrationInformation#

Bases: object

apply_transform()#
convert_transform_to_vtk(transform=None)#

Produce an output vtkTransform corresponding to the registration results. Optionally can input a 9-component transform vector.

initialize(polydata)#
initialize_fiber_sample()#
set_transform(input_transform)#
transform_fiber_array()#

Transform in_array (of class FiberArray) by transform (9 components, rotation about R,A,S, translation in R, A, S, and scale along R, A, S. Fibers are assumed to be in RAS. Transformed fibers are returned.

transform_fiber_array_NOT_USED(in_array, transform)#

Transform in_array (of class FiberArray) by transform (9 components, rotation about R,A,S, translation in R, A, S, and scale along R, A, S. Fibers are assumed to be in RAS. Transformed fibers are returned.

whitematteranalysis.register_two_subjects module#

register.py

implementation of fiber tractography registration (group)

class RegisterTractography

class whitematteranalysis.register_two_subjects.RegisterTractography#

Bases: object

compute()#

Run the registration. Add subjects first (before calling compute). Then call compute several times, using different sigma, to perform multiscale registration.

constraint(x_current)#
objective_function(current_x)#

The actual objective used in registration. Function of the current x in search space, as well as parameters of the class: sigma. Compares sampled fibers from moving input, to all fibers of fixed input.

whitematteranalysis.register_two_subjects.convert_transform_to_vtk(transform, scaled=False, mode=[1, 1, 1, 1])#

Produce an output vtkTransform corresponding to the registration results. Input is a 15-component transform vector.

whitematteranalysis.register_two_subjects.fiber_distance_numpy(moving_fiber, fixed_fibers)#

Find pairwise fiber distance from fixed fiber to all moving fibers.

whitematteranalysis.register_two_subjects.inner_loop_objective(fixed, moving, sigmasq)#

The code called within the objective_function to find the negative log

probability of one brain given all other brains.

whitematteranalysis.register_two_subjects.total_probability_numpy(moving_fiber, fixed_fibers, sigmasq)#

Compute total probability for moving fiber when compared to all fixed

fibers.

whitematteranalysis.register_two_subjects.transform_fiber_array_numpy(in_array, transform, mode=[1, 1, 1, 1])#

Transform in_array of R,A,S by transform (15 components, rotation about R,A,S, translation in R, A, S, scale along R, A, S, and shear. Fibers are assumed to be in RAS (or LPS as long as all inputs are consistent). Transformed fibers are returned.

whitematteranalysis.register_two_subjects.transform_fiber_array_numpyNOTUSED(moving_points, number_of_fibers, points_per_fiber, transform)#

Transform in_array of R,A,S by transform (15 components, rotation about R,A,S, translation in R, A, S, scale along R, A, S, and shear. Fibers are assumed to be in RAS (or LPS as long as all inputs are consistent). Transformed fibers are returned.

This overall slows down computations. So keep all data in numpy double arrays for now.

whitematteranalysis.register_two_subjects_nonrigid module#

register.py

implementation of fiber tractography registration (group)

class RegisterTractographyNonrigid

class whitematteranalysis.register_two_subjects_nonrigid.RegisterTractographyNonrigidThinPlateSplines#

Bases: RegisterTractography

compute()#

Run the registration. Add subjects first (before calling compute). Then call compute several times, using different parameters for the class, for example first just for translation.

constraint(x_current)#
initialize_nonrigid_grid()#
objective_function(current_x)#

The actual objective used in registration. Function of the current x in search space, as well as parameters of the class: threshold, sigma. Compares sampled fibers from moving input, to all fibers of fixed input.

transform_fiber_array_numpy(in_array, source_landmarks)#

Transform in_array of R,A,S by transform (a list of source points). Transformed fibers are returned.

whitematteranalysis.register_two_subjects_nonrigid.compute_thin_plate_spline_transform(source_points, target_points)#

Produce an output vtkThinPlateSplineTransform. Input is a vtkPoints object of source (moving) landmarks and a vtkPoints object of target (fixed) landmarks.

whitematteranalysis.register_two_subjects_nonrigid.convert_numpy_array_to_vtk_points(inarray)#

Convert numpy array or flat list of points to vtkPoints.

whitematteranalysis.register_two_subjects_nonrigid.convert_transform_to_vtk(source_landmarks, target_points)#

Produce an output vtkThinPlateSplineTransform corresponding to the

registration results. Input is a numpy array of of source (moving) landmarks and a vtkPoints object of target (fixed) landmarks.

whitematteranalysis.register_two_subjects_nonrigid_bsplines module#

register.py

implementation of fiber tractography registration (group)

class RegisterTractographyNonrigid

class whitematteranalysis.register_two_subjects_nonrigid_bsplines.RegisterTractographyNonrigid#

Bases: RegisterTractography

compute()#

Run the registration. Add subjects first (before calling compute). Then call compute several times, using different parameters for the class, for example first just for translation.

constraint(x_current)#
initialize_nonrigid_grid()#
objective_function(current_x)#

The actual objective used in registration. Function of the current x in search space, as well as parameters of the class: threshold, sigma. Compares sampled fibers from moving input, to all fibers of fixed input.

transform_fiber_array_numpy(in_array, transform)#

Transform in_array of R,A,S by transform (a list of source points). Transformed fibers are returned.

whitematteranalysis.register_two_subjects_nonrigid_bsplines.convert_numpy_array_to_vtk_points(inarray)#

Convert numpy array or flat list of points to vtkPoints.

whitematteranalysis.register_two_subjects_nonrigid_bsplines.convert_transform_to_vtk(transform)#

Produce an output vtkBSplineTransform corresponding to the

registration results. Input is a numpy array corresponding to the displacement field.

whitematteranalysis.relative_distance module#

relative_distance.py

implementation of relative distance model, to test representation of fiber tracts represented in coordinates relative to fMRI and anatomical points

class RelativeDistanceModel

class whitematteranalysis.relative_distance.RelativeDistanceModel#

Bases: object

compute(input_polydata, input_points)#

whitematteranalysis.render module#

Class RenderPolyData for rendering tractography, and saving views.

class whitematteranalysis.render.RenderPolyData#

Bases: object

Makes a vtk render window to display polydata tracts

build_vtk_renderer()#
render_polydata(input_polydata, scalar_range=None, tube=True, opacity=1, depth_peeling=False, scalar_bar=False, scalar_bar_title=None, axes=False, data_mode='Cell', colormap='jet', verbose=True)#
save_image(filename='test.jpg')#
save_views(directory='.', subjectID=None, verbose=True)#
scalar_bar_off()#
scalar_bar_on()#
view_anterior()#
view_inferior()#
view_left()#
view_posterior()#
view_right()#
view_superior()#
whitematteranalysis.render.argsort_by_jet_lookup_table(rgb_color)#
whitematteranalysis.render.get_hot_lookup_table()#
whitematteranalysis.render.get_jet_lookup_table()#
whitematteranalysis.render.histeq(values, nbr_bins=256)#
whitematteranalysis.render.render(input_polydata, number_of_fibers=None, opacity=1, depth_peeling=False, scalar_bar=False, axes=False, scalar_range=None, data_mode='Cell', tube=True, colormap='jet', data_name=None, verbose=True)#

Function for easy matlab-like use of the rendering functionality.

Returns RenderPolyData object which can be used directly for more functionality.

whitematteranalysis.render.save_views(render_object, directory='.', subjectID=None)#

whitematteranalysis.similarity module#

whitematteranalysis.similarity.Frechet_distances_2(input_vtk_polydata_n, input_vtk_polydata_m)#
whitematteranalysis.similarity.distance_to_similarity(distance, sigmasq=100)#
whitematteranalysis.similarity.fiber_distance(fiber, fiber_array, threshold=0, distance_method='MeanSquared', fiber_landmarks=None, landmarks=None, sigmasq=6400, bilateral=False)#

Find pairwise fiber distance from fiber to all fibers in fiber_array. The Mean and MeanSquared distances are the average distance per fiber point, to remove scaling effects (dependence on number of points chosen for fiber parameterization). The Hausdorff distance is the maximum distance between corresponding points. input fiber should be class Fiber. fibers should be class FiberArray

whitematteranalysis.similarity.fiber_distance_oriented(fiber, fiber_array, threshold=0, distance_method='MeanSquared', fiber_landmarks=None, landmarks=None, sigmasq=6400, bilateral=False)#

Find pairwise fiber distance from fiber to all fibers in fiber_array, without testing both fiber orders. This is to be used if the fibers are ordered purposely, such as

according to the endpoint nearest a cortical point. The Mean and MeanSquared distances are the average distance per fiber point, to remove scaling effects (dependence on number of points chosen for fiber parameterization). The Hausdorff distance is the maximum distance between corresponding points. input fiber should be class Fiber. fibers should be class FiberArray

whitematteranalysis.similarity.frechDist(P, Q)#
whitematteranalysis.similarity.pairwise_frechet_distances(input_vtk_polydata_n, input_vtk_polydata_m)#
whitematteranalysis.similarity.rectangular_frechet_distances(input_vtk_polydata_m, input_vtk_polydata_n)#
whitematteranalysis.similarity.total_similarity(fiber, fiber_array, threshold, sigmasq, distance_method='MeanSquared')#

Convenience function that just returns total fiber similarity. Returns a single scalar value: total similarity to all input fibers in fiber_array (these can be from one hemisphere or the whole brain, etc).

whitematteranalysis.similarity.total_similarity_and_distances(fiber, fiber_array, reflect, threshold, sigmasq, distance_method='MeanSquared')#

Convenience function for fiber similarity needed for laterality. Optionally reflects fiber, returns total similarity to all input fibers in fiber_array (these are from one hemisphere). Also returns distances array for further analysis.

whitematteranalysis.similarity.total_similarity_for_laterality(fiber, fiber_array, reflect, threshold, sigmasq)#

Convenience function for fiber similarity needed for laterality. Optionally reflects fiber, returns total similarity to all input fibers in fiber_array (these are from one hemisphere). Also returns distances array for further analysis.

whitematteranalysis.tract_measurement module#

class whitematteranalysis.tract_measurement.Demographics#

Bases: object

Group demographics.

check()#
get_demographics_by_header(query_header_name)#
get_demographics_by_index(query_index)#
load()#
class whitematteranalysis.tract_measurement.TractMeasurement#

Bases: object

Fiber tract scalar measurement obtained from Slicer module FiberTractScalarMeasurement.

check()#
get_measurements_by_index(query_index)#
get_measurements_by_name(query_header_name)#
load()#
whitematteranalysis.tract_measurement.load_demographics(xlsx)#

Load load_demographics file Each row is one case, including subjectID, groupID, Age, etc.

whitematteranalysis.tract_measurement.load_measurement(measurement_file, hierarchy='Column', separator='Tab')#

Load measurement for one subject

whitematteranalysis.tract_measurement.load_measurement_in_folder(measurement_folder, hierarchy='Column', separator='Tab')#

Load measurements for multiple subjects

Module contents#