@@ -43,8 +43,13 @@ def get_parser():
4343 formatter_class = RawTextHelpFormatter )
4444 parser .add_argument ('bids_dir' , help = 'The directory with the input dataset '
4545 'formatted according to the BIDS standard.' )
46- parser .add_argument ('derivatives_pipeline' , help = 'The pipeline that contains '
47- 'minimally preprocessed img, brainmask, and confounds.tsv' )
46+ parser .add_argument ('derivatives_pipeline' , help = 'Either the name of the pipeline '
47+ '(e.g., fmriprep) or the directory path to the pipeline '
48+ '(e.g., /some/dir/fmriprep) that contains the minimally preprocessed '
49+ 'img, brainmask, and confounds.tsv. '
50+ 'If you only give the name of the pipeline, it is assumed to be under '
51+ 'a derivatives directory within the bids directory '
52+ '(e.g., /my/bids/derivatives).' )
4853 parser .add_argument ('output_dir' , help = 'The directory where the output directory '
4954 'and files should be stored. If you are running group level analysis '
5055 'this folder should be prepopulated with the results of the'
@@ -153,8 +158,14 @@ def main():
153158 # Set up directories
154159 # TODO: set up some sort of versioning system
155160 bids_dir = os .path .abspath (opts .bids_dir )
161+ if os .path .isdir (opts .derivatives_pipeline ):
162+ derivatives_pipeline_dir = os .path .abspath (opts .derivatives_pipeline )
163+ else :
164+ derivatives_pipeline_dir = os .path .join (bids_dir , 'derivatives' , opts .derivatives_pipeline )
156165
157- derivatives_pipeline_dir = os .path .join (bids_dir , 'derivatives' , opts .derivatives_pipeline )
166+ if not os .path .isdir (derivatives_pipeline_dir ):
167+ msg = "{dir} is not an available directory" .format (dir = derivatives_pipeline_dir )
168+ raise NotADirectoryError (msg )
158169
159170 output_dir = os .path .abspath (opts .output_dir )
160171 os .makedirs (output_dir , exist_ok = True )
0 commit comments