# HG changeset patch # User greg # Date 1509730958 14400 # Node ID cf847e9f1a3a0ac14adee210a85a168ca08f8ff8 # Parent a0d57df923d2ca7b0220aa27a194a66611495867 Uploaded diff -r a0d57df923d2 -r cf847e9f1a3a dmri.py --- 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()