Mercurial > repos > greg > drmi
changeset 9:cf847e9f1a3a draft
Uploaded
author | greg |
---|---|
date | Fri, 03 Nov 2017 13:42:38 -0400 |
parents | a0d57df923d2 |
children | 5014ba48e15e |
files | dmri.py |
diffstat | 1 files changed, 6 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/dmri.py Fri Nov 03 13:33:58 2017 -0400 +++ b/dmri.py Fri Nov 03 13:42:38 2017 -0400 @@ -12,29 +12,12 @@ args = parser.parse_args() -def move_directory_files(source_dir, destination_dir, copy=False, remove_source_dir=False): - source_directory = os.path.abspath(source_dir) - destination_directory = os.path.abspath(destination_dir) - if not os.path.isdir(destination_directory): - os.makedirs(destination_directory) - for dir_entry in os.listdir(source_directory): - source_entry = os.path.join(source_directory, dir_entry) - if copy: - shutil.copy(source_entry, destination_directory) - else: - shutil.move(source_entry, destination_directory) - if remove_source_dir: - os.rmdir(source_directory) -source_dir = os.path.abspath(os.path.join('home', 'greg', '.dipy', 'sherbrooke_3shell')) -dest_dir = 'input_dir' -if not os.path.exists(source_dir): - # Get input data. - fetch_sherbrooke_3shell() -# Move inputs to working directory. -move_directory_files(source_dir, dest_dir, copy=True) -fdwi = os.path.join(dest_dir, 'HARDI193.nii.gz') -fbval = os.path.join(dest_dir, 'HARDI193.bval') -fbvec = os.path.join(dest_dir, 'HARDI193.bvec') +input_dir = os.path.join('.dipy', 'sherbrooke_3shell') +# Get input data. +fetch_sherbrooke_3shell() +fdwi = os.path.join(input_dir, 'HARDI193.nii.gz') +fbval = os.path.join(input_dir, 'HARDI193.bval') +fbvec = os.path.join(input_dir, 'HARDI193.bvec') # Load the dMRI datasets. img = nibabel.load(fdwi) data = img.get_data()