workflow for processing ISMRM Diffusion Study - Best Practices in Image Preprocessing data
Help improve this workflow!
This workflow has been published but could be further improved with some additional meta data:- Keyword(s) in categories input, output, operation, topic
You can help improve this workflow by suggesting the addition or removal of keywords, suggest changes and report issues, or request to become a maintainer of the Workflow .
workflow for processing ISMRM Diffusion Study - Best Practices in Image Preprocessing data
Snakemake workflow to run dwi preprocessing.
Uses snakemake & snakedwi , see docs here:
https://snakemake.readthedocs.io
https://snakedwi.readthedocs.io
This workflow converts the data to bids and runs snakedwi, then prepares data for uploading the submission
Put the raw data in
../sourcedata
(can be configured with
config.yml
)
Notes:
-
You will need to update the
--profile
option in the snakedwi command (or remove it if you are not using an execution profile) -
The data is missing SliceTiming for some scans, so I've pre-populated eddy slspec files for the 62 and 70 slice variants
-
Also forced PhaseEncodingDirection flags in the bids curation steps
Code Snippets
18 | shell: 'cp {input} {output}' |
26 27 28 29 30 31 32 | run: import json with open(input.json) as f: json_dict = json.load(f) json_dict['PhaseEncodingDirection'] = 'j' with open(output.json, 'w') as f: json.dump(json_dict, f,indent=4) |
38 | shell: 'cp {input} {output}' |
46 47 48 49 50 51 52 | run: import json with open(input.json) as f: json_dict = json.load(f) json_dict['PhaseEncodingDirection'] = 'j-' with open(output.json, 'w') as f: json.dump(json_dict, f,indent=4) |
61 | shell: 'echo 0 > {output}' |
65 | shell: "echo '0\n0\n0' > {output}" |
70 | shell: 'cp {input} {output}' |
80 81 82 83 84 85 86 87 88 | shell: 'for subj in {params.subjects};' 'do ' ' nslices=`fslval bids/sub-${{subj}}/dwi/sub-${{subj}}_acq-AP_dwi.nii.gz dim3` && ' ' if [ ${{nslices}} == {wildcards.nslices} ];' ' then ' ' echo ${{subj}} >> {output};' ' fi; ' 'done' |
103 | shell: 'cp {input.dd} {output.dd}' |
115 | shell: 'echo snakedwi {params.bids_dir} {params.out_dir} participant --profile cc-slurm --no_bedpost --participant_label `cat {input.subjects}` --slspec_txt {input.custom} > {output.cmd}' |
129 130 | shell: 'for folder in {input}; do cp -v ${{folder}}/results/sub-*/dwi/sub-?????_desc-eddy_dwi.* {output.submit_folder}; done' |
137 | shell: 'cp -v {input} {output}' |
Support
- Future updates
Related Workflows





