Skip to content

Commit

Permalink
Split out resample/vote/qc stages into new group stage
Browse files Browse the repository at this point in the history
  • Loading branch information
gdevenyi committed Aug 2, 2017
1 parent 8ea7940 commit 3184cba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ test:
timeout: 21600
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds003_downsampled:/bids_dataset -v ${HOME}/outputs:/outputs bids/${CIRCLE_PROJECT_REPONAME,,} --fast --n_cpus 2 --segmentation_type colin27-subcortical /bids_dataset /outputs participant2 --participant_label 02 :
timeout: 21600
- docker run -ti --rm --read-only -v /tmp:/tmp -v /var/tmp:/var/tmp -v ${HOME}/data/ds003_downsampled:/bids_dataset -v ${HOME}/outputs:/outputs bids/${CIRCLE_PROJECT_REPONAME,,} --fast --n_cpus 2 --segmentation_type colin27-subcortical /bids_dataset /outputs group :
timeout: 21600

deployment:
hub:
Expand Down
13 changes: 9 additions & 4 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ def run(command, env={}):
'group level analysis.')
parser.add_argument('analysis_level', help='Level of the analysis that will be performed. '
'Multiple participant level analyses can be run independently '
'(in parallel) using the same output_dir after a group level preprocessing has been done. '
'In MAGeTbrain parlance, group = template stage, partipant = subject stage',
choices=['participant1', 'participant2'])
'(in parallel) using the same output_dir. '
'In MAGeTbrain parlance, participant1 = template stage, partipant2 = subject stage '
'group = resample + vote + qc stage',
choices=['participant1', 'participant2', 'group'])
parser.add_argument('--participant_label', help='The label(s) of the participant(s) that should be analyzed. The label '
'corresponds to sub-<participant_label> from the BIDS spec '
'(so it does not include "sub-"). If this parameter is not '
Expand Down Expand Up @@ -142,7 +143,7 @@ def run(command, env={}):
for session in subject_T1s:
subject_T1_list.append('/{0}/input/subject/{1}'.format(args.output_dir, os.path.basename(session)))
shutil.copy(session, '/{0}/input/subject/{1}'.format(args.output_dir, os.path.basename(session)))
cmd = "QBATCH_PPJ={0} QBATCH_CHUNKSIZE=1 QBATCH_CORES=1 mb.sh {1} -s ".format(args.n_cpus, args.fast and "--reg-command mb_register_fast.sh" or "") + " ".join(subject_T1_list) + " -- subject resample vote"
cmd = "QBATCH_PPJ={0} QBATCH_CHUNKSIZE=1 QBATCH_CORES=1 mb.sh {1} -s ".format(args.n_cpus, args.fast and "--reg-command mb_register_fast.sh" or "") + " ".join(subject_T1_list) + " -- subject"
run(cmd)

# running template level preprocessing
Expand All @@ -164,3 +165,7 @@ def run(command, env={}):
template_T1_list.append('/{0}/input/template/{1}'.format(args.output_dir, os.path.basename(subject_file[0])))
cmd = "QBATCH_PPJ={0} QBATCH_CHUNKSIZE=1 QBATCH_CORES=1 mb.sh {1} -t ".format(args.n_cpus, args.fast and '--reg-command mb_register_fast.sh' or '') + " ".join(template_T1_list) + " -- template"
run(cmd)

elif args.analysis_level == "group":
cmd = "QBATCH_PPJ={0} QBATCH_CHUNKSIZE=1 QBATCH_CORES=1 mb.sh".format(args.n_cpus) + " -- resample vote qc"
run(cmd)

0 comments on commit 3184cba

Please sign in to comment.