comparison linear_fascile_evaluation.py @ 1:84a2e30b5404 draft

Uploaded
author greg
date Tue, 28 Nov 2017 13:30:57 -0500
parents cbfa8c336751
children 0ddfcb3b5ce6
comparison
equal deleted inserted replaced
0:cbfa8c336751 1:84a2e30b5404
9 import matplotlib 9 import matplotlib
10 10
11 from dipy.viz.colormap import line_colors 11 from dipy.viz.colormap import line_colors
12 from dipy.viz import fvtk 12 from dipy.viz import fvtk
13 from mpl_toolkits.axes_grid1 import AxesGrid 13 from mpl_toolkits.axes_grid1 import AxesGrid
14 from dipy.data import read_stanford_labels, fetch_stanford_t1, read_stanford_t1
14 15
15 parser = argparse.ArgumentParser() 16 parser = argparse.ArgumentParser()
16 parser.add_argument('--candidates', dest='candidates', help='Candidates selection') 17 parser.add_argument('--candidates', dest='candidates', help='Candidates selection')
17 parser.add_argument('--output_life_candidates', dest='output_life_candidates', help='Output life candidates') 18 parser.add_argument('--output_life_candidates', dest='output_life_candidates', help='Output life candidates')
18 parser.add_argument('--output_life_optimized', dest='output_life_optimized', help='Output life optimized streamlines') 19 parser.add_argument('--output_life_optimized', dest='output_life_optimized', help='Output life optimized streamlines')
20 parser.add_argument('--output_error_histograms', dest='output_error_histograms', help='Output error histograms') 21 parser.add_argument('--output_error_histograms', dest='output_error_histograms', help='Output error histograms')
21 parser.add_argument('--output_spatial_errors', dest='output_spatial_errors', help='Output spatial errors') 22 parser.add_argument('--output_spatial_errors', dest='output_spatial_errors', help='Output spatial errors')
22 23
23 args = parser.parse_args() 24 args = parser.parse_args()
24 25
25 if not op.exists(args.candidates): 26 # We'll need to know where the corpus callosum is from these variables.
26 from streamline_tools import * 27 hardi_img, gtab, labels_img = read_stanford_labels()
27 else: 28 labels = labels_img.get_data()
28 # We'll need to know where the corpus callosum is from these variables: 29 cc_slice = labels == 2
29 from dipy.data import (read_stanford_labels, fetch_stanford_t1, read_stanford_t1) 30 fetch_stanford_t1()
30 hardi_img, gtab, labels_img = read_stanford_labels() 31 t1 = read_stanford_t1()
31 labels = labels_img.get_data() 32 t1_data = t1.get_data()
32 cc_slice = labels == 2 33 data = hardi_img.get_data()
33 fetch_stanford_t1()
34 t1 = read_stanford_t1()
35 t1_data = t1.get_data()
36 data = hardi_img.get_data()
37 34
38 # Read the candidates from file in voxel space: 35 # Read the candidates from file in voxel space:
39 candidate_sl = [s[0] for s in nib.trackvis.read(args.candidates, points_space='voxel')[0]] 36 candidate_sl = [s[0] for s in nib.trackvis.read(args.candidates, points_space='voxel')[0]]
40 # Visualize the initial candidate group of streamlines 37 # Visualize the initial candidate group of streamlines
41 # in 3D, relative to the anatomical structure of this brain. 38 # in 3D, relative to the anatomical structure of this brain.