mindboggle.evaluate package

Submodules

mindboggle.evaluate.evaluate_features module

Evaluate deep surface features by computing the minimum distance from each label border vertex to all of the feature vertices in the same sulcus. The label borders run along the deepest parts of many sulci and correspond to fundi in the DKT cortical labeling protocol.

Results have been saved to https://osf.io/r95wb/

Examples

$ python evaluate_features.py

Authors:

Copyright 2015, Mindboggle team (http://mindboggle.info), Apache v2.0 License

evaluate_deep_features(features_file, labels_file, sulci_file='', hemi='', excludeIDs=[-1], output_vtk_name='', verbose=True)

Evaluate deep surface features by computing the minimum distance from each label border vertex to all of the feature vertices in the same sulcus, and from each feature vertex to all of the label border vertices in the same sulcus. The label borders run along the deepest parts of sulci and correspond to fundi in the DKT cortical labeling protocol.

Parameters:
  • features_file (string) – VTK surface file with feature numbers for vertex scalars
  • labels_file (string) – VTK surface file with label numbers for vertex scalars
  • sulci_file (string) – VTK surface file with sulcus numbers for vertex scalars
  • excludeIDs (list of integers) – feature/sulcus/label IDs to exclude (background set to -1)
  • output_vtk_name (bool) – if not empty, output a VTK file beginning with output_vtk_name that contains a surface with mean distances as scalars
  • verbose (bool) – print mean distances to standard output?
Returns:

  • feature_to_border_mean_distances (numpy array [number of features x 1]) – mean distance from each feature to sulcus label border
  • feature_to_border_sd_distances (numpy array [number of features x 1]) – standard deviations of feature-to-border distances
  • feature_to_border_distances_vtk (string) – VTK surface file containing feature-to-border distances
  • border_to_feature_mean_distances (numpy array [number of features x 1]) – mean distances from each sulcus label border to feature
  • border_to_feature_sd_distances (numpy array [number of features x 1]) – standard deviations of border-to-feature distances
  • border_to_feature_distances_vtk (string) – VTK surface file containing border-to-feature distances

mindboggle.evaluate.evaluate_labels module

Compute surface and volume label overlaps.

Compute the Dice and Jaccard overlap measures for each labeled region of two labeled surfaces or image volumes, for example one that has been manually labeled and one that has been automatically labeled.

Results have been saved to https://osf.io/7gmeq/

Authors:

Copyright 2015, Mindboggle team (http://mindboggle.info), Apache v2.0 License

evaluate_surface_overlaps(labels, index, table1, table2, output_file='', save_output=True)

Measure surface overlap per label by comparing Mindboggle vertices tables.

Parameters:
  • labels (list) – cortical label indices to measure surface overlap
  • index (integer) – index (starting from zero) to column of table containing label indices
  • table1 (string) – table with index labels for scalar values
  • table2 (string) – table with index labels for scalar values
  • output_file (string) – (optional) output file name
Returns:

  • dice_overlaps (numpy array) – Dice overlap values
  • jacc_overlaps (numpy array) – Jaccard overlap values
  • output_file (string) – (optional) output file name
  • save_output (bool) – save output file?

Examples

>>> # Compare volume label overlaps in trivial case: brain with itself:
>>> import os
>>> from mindboggle.evaluate.evaluate_labels import evaluate_surface_overlaps
>>> from mindboggle.mio.labels import DKTprotocol
>>> from mindboggle.mio.fetch_data import prep_tests
>>> urls, fetch_data = prep_tests()
>>> table1 = fetch_data(urls['left_vertices_table'], '', '.csv')
>>> table2 = fetch_data(urls['left_vertices_table'], '', '.csv')
>>> dkt = DKTprotocol()
>>> labels = dkt.cerebrum_cortex_DKT31_numbers
>>> index = 1
>>> output_file = ''
>>> save_output = True
>>> evaluate_surface_overlaps(labels, index, table1, table2,
...     output_file=output_file, save_output=save_output) # doctest: +SKIP
evaluate_surface_overlaps_cpp(command, labels_file1, labels_file2, output_file)

Measure surface overlap using Joachim Giard’s code.

Note: Fails if two files have different number of vertices.

Parameters:
  • command (string) – surface overlap C++ executable command
  • labels_file1 (string) – vtk file with index labels for scalar values
  • labels_file2 (string) – vtk file with index labels for scalar values
  • output_file (string) – (optional) output file name
Returns:

output_file – name of output text file with overlap results

Return type:

string

Examples

>>> # Compare surface label overlaps in trivial case: brain with itself:
>>> import os
>>> from mindboggle.evaluate.evaluate_labels import evaluate_surface_overlaps_cpp
>>> from mindboggle.mio.fetch_data import fetch_data
>>> from mindboggle.mio.fetch_data import prep_tests
>>> urls, fetch_data = prep_tests()
>>> file1 = fetch_data(urls['left_freesurfer_labels'], '', '.nii.gz')
>>> file2 = fetch_data(urls['left_freesurfer_labels'], '', '.nii.gz')
>>> ccode_path = os.environ['MINDBOGGLE_TOOLS'] # doctest: +SKIP
>>> command = os.path.join(ccode_path, 'surface_overlap', 'SurfaceOverlapMain') # doctest: +SKIP
>>> output_file = ''
>>> evaluate_surface_overlaps_cpp(command, file1, file2, output_file) # doctest: +SKIP
evaluate_volume_overlaps(labels, file1, file2, output_file='', save_output=True)

Compute overlap between individual label regions in source and target nifti (nii.gz) images.

Parameters:
  • labels (list) – label indices
  • file1 (string) – source image, consisting of index-labeled pixels/voxels
  • file2 (string) – target image, consisting of index-labeled pixels/voxels
  • output_file (string) – (optional) output file name
  • save_output (bool) – save output file?
Returns:

  • dice_overlaps (numpy array) – Dice overlap values
  • jacc_overlaps (numpy array) – Jaccard overlap values
  • output_file (string) – output text file name with overlap values

Examples

>>> # Compare FreeSurfer and ants labels for the same brain:
>>> import os
>>> from mindboggle.evaluate.evaluate_labels import evaluate_volume_overlaps
>>> from mindboggle.mio.labels import DKTprotocol
>>> from mindboggle.mio.fetch_data import prep_tests
>>> urls, fetch_data = prep_tests()
>>> file1 = fetch_data(urls['freesurfer_labels'], '', '.nii.gz')
>>> file2 = fetch_data(urls['ants_labels'], '', '.nii.gz')
>>> dkt = DKTprotocol()
>>> labels = dkt.cerebrum_cortex_DKT31_numbers
>>> output_file = ''
>>> save_output = True
>>> evaluate_volume_overlaps(labels, file1, file2,
...     output_file=output_file, save_output=save_output) # doctest: +SKIP

mindboggle.evaluate.evaluate_shapes module

Evaluate the consistency of Mindboggle shape measures for rescanned MRI data.

Results have been saved to https://osf.io/mhc37/

Examples

$ python evaluate_shapes.py

Authors:

Copyright 2016, Mindboggle team (http://mindboggle.info), Apache v2.0 License

Module contents