Mercurial > repos > greg > drmi
comparison dmri.py @ 8:a0d57df923d2 draft
Uploaded
| author | greg | 
|---|---|
| date | Fri, 03 Nov 2017 13:33:58 -0400 | 
| parents | 2b6708bc9391 | 
| children | cf847e9f1a3a | 
   comparison
  equal
  deleted
  inserted
  replaced
| 7:2b6708bc9391 | 8:a0d57df923d2 | 
|---|---|
| 23 shutil.copy(source_entry, destination_directory) | 23 shutil.copy(source_entry, destination_directory) | 
| 24 else: | 24 else: | 
| 25 shutil.move(source_entry, destination_directory) | 25 shutil.move(source_entry, destination_directory) | 
| 26 if remove_source_dir: | 26 if remove_source_dir: | 
| 27 os.rmdir(source_directory) | 27 os.rmdir(source_directory) | 
| 28 | |
| 29 input_dir = 'input_dir' | |
| 30 # Get input data. | |
| 31 fetch_sherbrooke_3shell() | |
| 32 # MNove inputs to working directory. | |
| 33 source_dir = os.path.abspath(os.path.join('home', 'greg', '.dipy', 'sherbrooke_3shell')) | 28 source_dir = os.path.abspath(os.path.join('home', 'greg', '.dipy', 'sherbrooke_3shell')) | 
| 34 move_directory_files(source_dir, input_dir) | 29 dest_dir = 'input_dir' | 
| 35 fdwi = os.path.join(input_dir, 'HARDI193.nii.gz') | 30 if not os.path.exists(source_dir): | 
| 36 fbval = os.path.join(input_dir, 'HARDI193.bval') | 31 # Get input data. | 
| 37 fbvec = os.path.join(input_dir, 'HARDI193.bvec') | 32 fetch_sherbrooke_3shell() | 
| 33 # Move inputs to working directory. | |
| 34 move_directory_files(source_dir, dest_dir, copy=True) | |
| 35 fdwi = os.path.join(dest_dir, 'HARDI193.nii.gz') | |
| 36 fbval = os.path.join(dest_dir, 'HARDI193.bval') | |
| 37 fbvec = os.path.join(dest_dir, 'HARDI193.bvec') | |
| 38 # Load the dMRI datasets. | 38 # Load the dMRI datasets. | 
| 39 img = nibabel.load(fdwi) | 39 img = nibabel.load(fdwi) | 
| 40 data = img.get_data() | 40 data = img.get_data() | 
| 41 # data is a 4D array where the first 3 dimensions are the i, j, | 41 # data is a 4D array where the first 3 dimensions are the i, j, | 
| 42 # k voxel coordinates and the last dimension is the number of | 42 # k voxel coordinates and the last dimension is the number of | 
