cassianobecker / dnn

MIT License
4 stars 0 forks source link

downloader script for hcp data #7

Closed harangju closed 4 years ago

lindenmp commented 4 years ago

See here: https://github.com/lindenmp/antsDTOrientationTests

cassianobecker commented 4 years ago

Some information on how to use and factor our parameters as configuration files:

import configparser import os

params = configparser.ConfigParser() params_furl = os.path.join(experiment_path, 'conf', 'experiment.ini')

to read

params.read(params_furl)

to write

params.add_section('FILE') params.set('FILE', 'experiment_path', experiment_path) params.set('FILE', 'experiment_name', name)

the experiment file would read, for example:

[TIME_SERIES] horizon = 15 guard_front = 4 guard_back = 4

[FMRI] tr = 0.72 physio_sampling_rate = 400 regress_physio = False

[PARCELLATION] parcellation = aparc

[SURFACE] inflation = inflated

[SESSION] train = MOTOR_LR test = MOTOR_LR

[LOGGING] experiment_level = info monitor_level = info

cassianobecker commented 4 years ago

to work with a subjects.txt file found at the path and filename given by list_url, you can do:

def load_subject_list(list_url): with open(list_url, 'r') as f: subjects = [s.strip() for s in f.readlines()] return subjects

cassianobecker commented 4 years ago

Take a look at the following, in dataset/hcp/downloaders.py, class HcpDownloader, method load

there, you will have information on how to assemble the http download request from the HCP database, including the credentials, for example

 r = requests.get(url,
                         auth=(self.settings['CREDENTIALS']['hcp_server_username'],
                               self.settings['CREDENTIALS']['hcp_server_password']),
                         stream=True)
harangju commented 4 years ago

downloader downloads raw data