Pipeline for preprocessing diffusion weighted images (DWI) in a valid BIDS directory.
/Users/bsipes/opt/anaconda3/envs/tracts/lib/python3.9/site-packages/bids/config.py:39: FutureWarning: Setting 'extension_initial_dot' will be removed in pybids 0.16.
  warnings.warn("Setting 'extension_initial_dot' will be removed in pybids 0.16.",
/Users/bsipes/opt/anaconda3/envs/tracts/lib/python3.9/site-packages/nilearn/datasets/__init__.py:93: FutureWarning: Fetchers from the nilearn.datasets module will be updated in version 0.9 to return python strings instead of bytes and Pandas dataframes instead of Numpy arrays.
  warn("Fetchers from the nilearn.datasets module will be "
/Users/bsipes/opt/anaconda3/envs/tracts/lib/python3.9/site-packages/bids/config.py:39: FutureWarning: Setting 'extension_initial_dot' will be removed in pybids 0.16.
  warnings.warn("Setting 'extension_initial_dot' will be removed in pybids 0.16.",

Preprocessing pipeline module:

A class containing core functionalities wrapped in a Nipype workflow, assuming your input data is in valid BIDS format. This pipeline will follow the DESIGNER protocol and align your T1 & DWI to MNI template space (ACPC HCP procedure), perform all denoising & artifact removal steps, and correct the DWI gradients accordingly.

class pipeline[source]

pipeline(BIDS_dir, ext='nii.gz', rpe_design='-rpe_none', regrid=True, gmwmi=False, mrtrix_nthreads=0, skip_tuples=[()], debug=False)

Create a Nipype workflow, collects the layout of a BIDS directory, and branches the workflow into sub-graphs that can be ran in parallel per subject-session combination Inputs:

- BIDS_dir (str): Path to BIDS dataset.
- ext (str): Extension of your BIDS image files. Default is set to "nii.gz"
- rpe_design (str): Reverse phase encoding design for your DWI acquisition. Also supports '-rpe_all', default is "-rpe_none"
- regrid (bool): Whether  to resample DWI to  1mm MNI template, defaults to True.
- gmwmi (bool): Segment for gray matter white matter interface (GMWMI) with FSL first, defaults to False.
- mrtrix_nthreads (int): Number of threads for mrtrix3 algorithm. If zero, the number of available CPUs will be used. Default is 0.
- skip_tuples (list[tuple]): A combination of [('subject #', 'session #')] tuples to skip, example: [('01', '03')] will skip sub-01/ses-03. Used for missinng data, the pipeline will automatically remove inconsistent sessions from BIDS Layout.
- debug (bool): Default = False; if True, saves node outputs and log files.

Example:

Create a pipeline:

preproc_dwi = pipeline(BIDS_dir='./testing/BIDS_dir/', 
                       rpe_design='-rpe_none', 
                       regrid=True, 
                       gmwmi=False,
                       mrtrix_nthreads=12,
                       skip_tuples=[('11045', '02')])
derivatives folder found at ./testing/BIDS_dir/derivatives
Creating layout of data directory, might take a while if there are a lot of subjects

Check if our environment is properly set-up:

preproc_dwi.check_environment()
FSLOUTPUTTYPE is valid
FSLDIR is valid
ANTS is valid
mrtrix3 is valid
Freesurfer path found
Matlab Compiler Runtime 2012 version in Freesurfer Path found. (MCRv80)

Take a look at what's in the pipeline:

preproc_dwi.__dict__
{'bids_dir': '/Users/xxie/sample_data/dwipreproc/BIDS_output/',
 'rpe_design': '-rpe_none',
 'regrid': True,
 'mrtrix_nthreads': 12,
 'ext': 'nii.gz',
 'excludes': [('01', '003')],
 'MNI_template': '/usr/local/fsl/data/standard/MNI152_T1_1mm.nii.gz',
 'sub_list': ['01'],
 'ses_list': ['002', '003'],
 'layout': BIDS Layout: ...le_data/dwipreproc/BIDS_output | Subjects: 1 | Sessions: 2 | Runs: 0,
 'anat_file': 'sub-{subject_id}/ses-{session_id}/anat/sub-{subject_id}_ses-{session_id}_T1w.nii.gz',
 'dwi_file': 'sub-{subject_id}/ses-{session_id}/dwi/sub-{subject_id}_ses-{session_id}_dwi.nii.gz',
 'b_files': 'sub-{subject_id}/ses-{session_id}/dwi/sub-{subject_id}_ses-{session_id}_dwi.bv*'}

We can tweak some things in the pipeline (this is totally not necessary if your BIDS dataset follows conventional naming), for example, to fit the subject file template strings to match our dataset naming scheme:

#if necessary, you can fit the file templates to match dataset naming conventions
#preproc_dwi.anat_file = 'sub-{subject_id}/ses-{session_id}/anat/sub-{subject_id}_ses-{session_id}_run-1_T1w.nii'
#preproc_dwi.dwi_file = 'sub-{subject_id}/ses-{session_id}/dwi/sub-{subject_id}_ses-{session_id}_run-1_dwi.nii'
#preproc_dwi.rdwi_file = 'sub-{subject_id}/ses-{session_id}/dwi/sub-{subject_id}_ses-{session_id}_run-2_dwi.nii'
#preproc_dwi.b_files = 'sub-{subject_id}/ses-{session_id}/dwi/sub-{subject_id}_ses-{session_id}_run-1_dwi.bv*'
#preproc_dwi.rb_files = 'sub-{subject_id}/ses-{session_id}/dwi/sub-{subject_id}_ses-{session_id}_run-2_dwi.bv*'

# Initiate our nodes:
preproc_dwi.create_nodes()

preproc_dwi.__dict__

We can set up preprocessing pipeline with default parameters, this will connect all workflow nodes with default input names and parameter values:

#usage
preproc_dwi.connect_nodes(rpe_design='-rpe_none')
print(f"Current intermediate file output destination is {preproc_dwi.workflow.base_dir}")
Current intermediate file output destination is /Users/xxie/sample_data/dwipreproc/BIDS_output/derivatives

You'd usually want to separate the final outputs (datasink directory) from the intermediate files:

preproc_dwi.workflow.base_dir = "./testing/BIDS_dir/code/pipetography"

All the default settings may not be optimal for your dataset, run the processing for a test image and see the intermediate results and then tweak the available inputs to improve the output image quality.

Now that our pre-processing Nodes are properly setup, we can visualize our workflow:

#preproc_dwi.connect_nodes(wf_name = 'pipetography')
preproc_dwi.draw_pipeline(graph_type='flat')
211112-11:26:30,243 nipype.workflow INFO:
	 Generated workflow graph: /Users/xxie/sample_data/dwipreproc/BIDS_output/code/pipetography/graph/preprocessing.png (graph2use=flat, simple_form=True).

Let's take a look at the final workflow we created:

from IPython.display import Image
Image('/Users/xxie/sample_data/dwipreproc/BIDS_output/code/pipetography/graph/preprocessing.png')

Run pipeline:

Calling run_pipeline will prompt an user input for the number of parallel processes

preproc_dwi.run_pipeline(parallel = 4)
Running workflow with 4 parallel processes
201217-23:04:26,779 nipype.workflow INFO:
	 Workflow pipetography settings: ['check', 'execution', 'logging', 'monitoring']
201217-23:04:26,825 nipype.workflow INFO:
	 Running in parallel.
201217-23:04:26,832 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201217-23:04:28,832 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.select_files
201217-23:04:30,832 nipype.workflow INFO:
	 [Job 0] Completed (pipetography.select_files).
201217-23:04:30,834 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 3 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201217-23:04:32,833 nipype.workflow INFO:
	 [Job 1] Completed (pipetography.sub_grad_files).
201217-23:04:32,835 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 1 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.reduce_FOV
                       * pipetography.get_metadata
201217-23:04:34,837 nipype.workflow INFO:
	 [Job 9] Completed (pipetography.get_metadata).
201217-23:04:34,840 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 0 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.mrtrix_image
                       * pipetography.reduce_FOV
201217-23:04:38,839 nipype.workflow INFO:
	 [Job 31] Completed (pipetography.reduce_FOV).
201217-23:04:38,842 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 2 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.mrtrix_image
201217-23:04:40,839 nipype.workflow INFO:
	 [Job 2] Completed (pipetography.mrtrix_image).
201217-23:04:40,841 nipype.workflow INFO:
	 [Job 33] Completed (pipetography.transform_inverse).
201217-23:04:40,843 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 1 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.FLIRT
201217-23:04:42,843 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 0 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.raw_dwi2mask
                       * pipetography.FLIRT
201217-23:05:26,873 nipype.workflow INFO:
	 [Job 3] Completed (pipetography.raw_dwi2mask).
201217-23:05:26,875 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 1 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.FLIRT
201217-23:05:28,875 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 0 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.dwigradcheck
                       * pipetography.FLIRT
201217-23:05:46,887 nipype.workflow INFO:
	 [Job 32] Completed (pipetography.FLIRT).
201217-23:05:46,890 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 1 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.dwigradcheck
201217-23:05:48,887 nipype.workflow INFO:
	 [Job 34] Completed (pipetography.concat_transform).
201217-23:05:48,891 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 1 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.dwigradcheck
201217-23:05:50,888 nipype.workflow INFO:
	 [Job 35] Completed (pipetography.aff2rigid).
201217-23:05:50,892 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 1 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.dwigradcheck
201217-23:05:52,889 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 0 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.apply_warp
                       * pipetography.dwigradcheck
201217-23:06:20,909 nipype.workflow INFO:
	 [Job 36] Completed (pipetography.apply_warp).
201217-23:06:20,913 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 2 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.dwigradcheck
201217-23:06:22,910 nipype.workflow INFO:
	 [MultiProc] Running 3 tasks, and 0 jobs ready. Free memory (GB): 28.20/28.80, Free processors: 1/4.
                     Currently running:
                       * pipetography.mrtrix_5ttgen
                       * pipetography.fsl_bet
                       * pipetography.dwigradcheck
201217-23:06:46,922 nipype.workflow INFO:
	 [Job 37] Completed (pipetography.fsl_bet).
201217-23:06:46,926 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 0 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.mrtrix_5ttgen
                       * pipetography.dwigradcheck
201217-23:07:20,943 nipype.workflow INFO:
	 [Job 4] Completed (pipetography.dwigradcheck).
201217-23:07:20,946 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 1 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.mrtrix_5ttgen
201217-23:07:22,948 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 0 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.mrconvert
                       * pipetography.mrtrix_5ttgen
201217-23:07:26,948 nipype.workflow INFO:
	 [Job 5] Completed (pipetography.mrconvert).
201217-23:07:26,950 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 1 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.mrtrix_5ttgen
201217-23:07:28,949 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 0 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.denoise
                       * pipetography.mrtrix_5ttgen
201217-23:11:25,92 nipype.workflow INFO:
	 [Job 6] Completed (pipetography.denoise).
201217-23:11:25,95 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 2 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.mrtrix_5ttgen
201217-23:11:27,93 nipype.workflow INFO:
	 [Job 7] Completed (pipetography.LowNoiseMap).
201217-23:11:27,95 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 0 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.ringing_removal
                       * pipetography.mrtrix_5ttgen
201217-23:13:05,156 nipype.workflow INFO:
	 [Job 8] Completed (pipetography.ringing_removal).
201217-23:13:05,159 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 1 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.mrtrix_5ttgen
201217-23:13:07,158 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 0 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.dwifslpreproc
                       * pipetography.mrtrix_5ttgen
201217-23:18:11,412 nipype.workflow INFO:
	 [Job 49] Completed (pipetography.mrtrix_5ttgen).
201217-23:18:11,415 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 2 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.dwifslpreproc
201217-23:18:13,413 nipype.workflow INFO:
	 [Job 50] Completed (pipetography.5tt2gmwmi).
201217-23:18:13,414 nipype.workflow INFO:
	 [Job 52] Completed (pipetography.5tt2wm).
201217-23:18:13,416 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 1 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.dwifslpreproc
201217-23:18:15,416 nipype.workflow INFO:
	 [Job 51] Completed (pipetography.binarize_gmwmi).
201217-23:18:15,419 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.dwifslpreproc
201218-04:28:45,779 nipype.workflow INFO:
	 [Job 10] Completed (pipetography.dwifslpreproc).
201218-04:28:45,781 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:28:47,779 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.alter_gradient
201218-04:30:45,899 nipype.workflow INFO:
	 [Job 11] Completed (pipetography.alter_gradient).
201218-04:30:45,901 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:30:47,899 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.modify_gradient
201218-04:30:49,904 nipype.workflow INFO:
	 [Job 12] Completed (pipetography.modify_gradient).
201218-04:30:49,906 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:30:51,908 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.update_image
201218-04:30:57,921 nipype.workflow INFO:
	 [Job 13] Completed (pipetography.update_image).
201218-04:30:57,923 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:30:59,922 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.recreate_mask
201218-04:31:37,972 nipype.workflow INFO:
	 [Job 14] Completed (pipetography.recreate_mask).
201218-04:31:37,974 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:31:39,973 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.dwibiascorrect
201218-04:32:04,17 nipype.workflow INFO:
	 [Job 15] Completed (pipetography.dwibiascorrect).
201218-04:32:04,18 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 2 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:32:06,23 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 0 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.NewGradient
                       * pipetography.RicianNoise
201218-04:32:08,23 nipype.workflow INFO:
	 [Job 18] Completed (pipetography.NewGradient).
201218-04:32:08,26 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.RicianNoise
201218-04:32:12,30 nipype.workflow INFO:
	 [Job 16] Completed (pipetography.RicianNoise).
201218-04:32:12,32 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:32:14,30 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.NoiseComparison
201218-04:32:22,40 nipype.workflow INFO:
	 [Job 17] Completed (pipetography.NoiseComparison).
201218-04:32:22,42 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:32:24,40 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.ConvertRician
201218-04:32:28,47 nipype.workflow INFO:
	 [Job 19] Completed (pipetography.ConvertRician).
201218-04:32:28,48 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:32:30,51 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.dwi2mask
201218-04:33:08,107 nipype.workflow INFO:
	 [Job 20] Completed (pipetography.dwi2mask).
201218-04:33:08,109 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:33:10,110 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.dwi2tensor
201218-04:33:14,122 nipype.workflow INFO:
	 [Job 21] Completed (pipetography.dwi2tensor).
201218-04:33:14,124 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:33:16,124 nipype.workflow INFO:
	 [Job 22] Completed (pipetography.tensor2metrics).
201218-04:33:16,125 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:33:18,124 nipype.workflow INFO:
	 [Job 23] Completed (pipetography.mrthreshold).
201218-04:33:18,126 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:33:20,129 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.dwinormalise
201218-04:33:28,134 nipype.workflow INFO:
	 [Job 24] Completed (pipetography.dwinormalise).
201218-04:33:28,136 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 2 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:33:30,139 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 0 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.sub_b0extract
                       * pipetography.sub_dwi2mask
201218-04:33:34,139 nipype.workflow INFO:
	 [Job 27] Completed (pipetography.sub_b0extract).
201218-04:33:34,142 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 1 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.sub_dwi2mask
201218-04:33:36,141 nipype.workflow INFO:
	 [Job 28] Completed (pipetography.sub_mrmath_mean).
201218-04:33:36,143 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 1 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.sub_dwi2mask
201218-04:33:38,141 nipype.workflow INFO:
	 [Job 29] Completed (pipetography.sub_dwi2nii).
201218-04:33:38,143 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.sub_dwi2mask
201218-04:34:08,198 nipype.workflow INFO:
	 [Job 25] Completed (pipetography.sub_dwi2mask).
201218-04:34:08,200 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:34:10,204 nipype.workflow INFO:
	 [Job 26] Completed (pipetography.sub_mask2nii).
201218-04:34:10,206 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:34:12,204 nipype.workflow INFO:
	 [Job 30] Completed (pipetography.sub_ApplyMask).
201218-04:34:12,207 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:34:14,207 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.fsl_epireg
201218-04:37:04,435 nipype.workflow INFO:
	 [Job 38] Completed (pipetography.fsl_epireg).
201218-04:37:04,437 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:37:06,441 nipype.workflow INFO:
	 [Job 39] Completed (pipetography.transformconvert).
201218-04:37:06,443 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:37:08,445 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.mrtransform
201218-04:37:14,460 nipype.workflow INFO:
	 [Job 40] Completed (pipetography.mrtransform).
201218-04:37:14,462 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:37:16,461 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.mrgrid
201218-04:37:36,482 nipype.workflow INFO:
	 [Job 41] Completed (pipetography.mrgrid).
201218-04:37:36,483 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 3 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:37:38,482 nipype.workflow INFO:
	 [MultiProc] Running 3 tasks, and 0 jobs ready. Free memory (GB): 28.20/28.80, Free processors: 1/4.
                     Currently running:
                       * pipetography.mni_b0extract
                       * pipetography.mni_dwi2mask
                       * pipetography.MNI_Outputs
201218-04:37:42,485 nipype.workflow INFO:
	 [Job 45] Completed (pipetography.mni_b0extract).
201218-04:37:42,488 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 1 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.mni_dwi2mask
                       * pipetography.MNI_Outputs
201218-04:37:44,486 nipype.workflow INFO:
	 [Job 46] Completed (pipetography.mni_mrmath_mean).
201218-04:37:44,489 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 1 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.mni_dwi2mask
                       * pipetography.MNI_Outputs
201218-04:37:46,487 nipype.workflow INFO:
	 [MultiProc] Running 3 tasks, and 0 jobs ready. Free memory (GB): 28.20/28.80, Free processors: 1/4.
                     Currently running:
                       * pipetography.mni_dwi2nii
                       * pipetography.mni_dwi2mask
                       * pipetography.MNI_Outputs
201218-04:37:48,489 nipype.workflow INFO:
	 [Job 47] Completed (pipetography.mni_dwi2nii).
201218-04:37:48,491 nipype.workflow INFO:
	 [MultiProc] Running 2 tasks, and 0 jobs ready. Free memory (GB): 28.40/28.80, Free processors: 2/4.
                     Currently running:
                       * pipetography.mni_dwi2mask
                       * pipetography.MNI_Outputs
201218-04:38:40,549 nipype.workflow INFO:
	 [Job 42] Completed (pipetography.MNI_Outputs).
201218-04:38:40,550 nipype.workflow INFO:
	 [Job 43] Completed (pipetography.mni_dwi2mask).
201218-04:38:40,552 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:38:42,555 nipype.workflow INFO:
	 [Job 44] Completed (pipetography.mni_mask2nii).
201218-04:38:42,557 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:38:44,561 nipype.workflow INFO:
	 [Job 48] Completed (pipetography.mni_ApplyMask).
201218-04:38:44,563 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 1 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.
201218-04:38:46,564 nipype.workflow INFO:
	 [MultiProc] Running 1 tasks, and 0 jobs ready. Free memory (GB): 28.60/28.80, Free processors: 3/4.
                     Currently running:
                       * pipetography.datasink
201218-04:38:54,571 nipype.workflow INFO:
	 [Job 53] Completed (pipetography.datasink).
201218-04:38:54,573 nipype.workflow INFO:
	 [MultiProc] Running 0 tasks, and 0 jobs ready. Free memory (GB): 28.80/28.80, Free processors: 4/4.

Outputs:

The datasink node will automatically create a derivatives folder in the BIDS directory folder if it doesn't find a derivatives folder. The derivatives directory will contain output images and gradient files that are realigned and resampled to MNI template:

!tree /Users/xxie/sample_data/dwipreproc/BIDS_output/derivatives/
/Users/xxie/sample_data/dwipreproc/BIDS_output/derivatives/
└── pipetography
    ├── graph
    │   ├── preprocessing.dot
    │   ├── preprocessing.png
    │   ├── preprocessing_detailed.dot
    │   └── preprocessing_detailed.png
    └── sub-01
        └── ses-002
            └── preprocessed
                ├── T1w_space-acpc.nii.gz
                ├── T1w_space-acpc_seg-5tt.mif
                ├── T1w_space-acpc_seg-gmwmi_mask.nii.gz
                ├── T1w_space-acpc_seg-wm_mask.nii.gz
                ├── dwi_space-acpc_res-1mm.b
                ├── dwi_space-acpc_res-1mm.bvals
                ├── dwi_space-acpc_res-1mm.bvecs
                ├── dwi_space-acpc_res-1mm.json
                ├── dwi_space-acpc_res-1mm.mif
                ├── dwi_space-acpc_res-1mm.nii.gz
                ├── dwi_space-acpc_res-1mm_b0mean.nii.gz
                ├── dwi_space-acpc_res-1mm_seg-brain.nii.gz
                └── dwi_space-acpc_res-1mm_seg-brain_mask.nii.gz

5 directories, 17 files