comparison dmri.py @ 35:013144510199 draft

Uploaded
author greg
date Thu, 30 Nov 2017 10:45:16 -0500
parents b4c65a54aa7d
children 501221517d3f
comparison
equal deleted inserted replaced
34:fd434b04f717 35:013144510199
2 import argparse 2 import argparse
3 import os 3 import os
4 import shutil 4 import shutil
5 5
6 from dipy.core.gradients import gradient_table 6 from dipy.core.gradients import gradient_table
7 from dipy.data import fetch_sherbrooke_3shell, fetch_stanford_hardi, read_stanford_labels 7 from dipy.data import fetch_stanford_hardi, fetch_stanford_t1, read_stanford_labels
8 from dipy.io import read_bvals_bvecs 8 from dipy.io import read_bvals_bvecs
9 from matplotlib import pyplot 9 from matplotlib import pyplot
10 10
11 import nibabel 11 import nibabel
12 12
33 if remove_source_dir: 33 if remove_source_dir:
34 os.rmdir(source_directory) 34 os.rmdir(source_directory)
35 35
36 # Get input data. 36 # Get input data.
37 input_dir = args.drmi_dataset 37 input_dir = args.drmi_dataset
38 #if input_dir == 'stanford_hardi': 38 if input_dir == 'stanford_hardi':
39 if args.drmi_dataset_type == "dataset": 39 if args.drmi_dataset_type == "dataset":
40 fetch_stanford_hardi() 40 fetch_stanford_hardi()
41 fdwi = os.path.join(input_dir, 'HARDI150.nii.gz') 41 fdwi = os.path.join(input_dir, 'HARDI150.nii.gz')
42 fbval = os.path.join(input_dir, 'HARDI150.bval') 42 fbval = os.path.join(input_dir, 'HARDI150.bval')
43 fbvec = os.path.join(input_dir, 'HARDI150.bvec') 43 fbvec = os.path.join(input_dir, 'HARDI150.bvec')
44 img = nibabel.load(fdwi) 44 img = nibabel.load(fdwi)
45 else:
46 img, gtab, labels = read_stanford_labels()
47 fdwi = os.path.join(input_dir, 'HARDI150.nii.gz')
48 fbval = os.path.join(input_dir, 'HARDI150.bval')
49 fbvec = os.path.join(input_dir, 'HARDI150.bvec')
45 else: 50 else:
46 img, gtab, labels = read_stanford_labels() 51 # input_dir == 'stanford_t1
47 fdwi = os.path.join(input_dir, 'HARDI150.nii.gz') 52 fetch_stanford_t1()
48 fbval = os.path.join(input_dir, 'HARDI150.bval') 53 fdwi = os.path.join(input_dir, 'HARDI93.nii.gz')
49 fbvec = os.path.join(input_dir, 'HARDI150.bvec') 54 fbval = os.path.join(input_dir, 'HARDI93.bval')
55 fbvec = os.path.join(input_dir, 'HARDI93.bvec')
56 img = nibabel.load(fdwi)
50 57
51 data = img.get_data() 58 data = img.get_data()
52 # data is a 4D array where the first 3 dimensions are the i, j, 59 # data is a 4D array where the first 3 dimensions are the i, j,
53 # k voxel coordinates and the last dimension is the number of 60 # k voxel coordinates and the last dimension is the number of
54 # non-weighted (S0s) and diffusion-weighted volumes. 61 # non-weighted (S0s) and diffusion-weighted volumes.