Acquiring the tutorial data
Download the tutorial data manually here, then unzip it into your ~/Documents directory.
Or, use the bash commands provided below:
unzip -o -qq BrainSuiteNipype_Tutorial.zip -d ~/Documents
Acquiring the workflow
We have created a sample workflow that uses the BrainSuite Nipype interface to run through the Cortical Surface Extraction routine. This workflow can also be used as a learning tool to help new users understand the basic syntax for setting up a Nipype workflow in Python. Download the workflow manually here, or run the following bash command to download the workflow:
Running the workflow
The Nipype workflow must be run from the terminal. Cd to the directory where you saved corticalExtraction.py, and run the following bash command:
Tips for creating your own workflows
- To use Nipype in a Python script, we must always import nipype’s pipeline engine:
import nipype.pipeline.engine as pe
- Then import the interfaces you wish to use. The interfaces provide various classes that wrap command line executables. BSE and BFC are two examples of classes that are provided by the BrainSuite interface. In our example, we are only using the BrainSuite interface:
import nipype.interfaces.brainsuite as bs
- Using the Node function of Nipype’s Pipeline engine, create Nipype nodes that contain an instance of an interface class:
bse = pe.Node(interface=bs.Bse(), name=’BSE’)
- Not sure what to do next? Every class has a .help() method. Try running the following command:
You can find the same help information for all of our classes on Nipype’s auto-generated documentation page, found here.
- You must specify all
[Mandatory]inputs either by assigning a value to the mandatory input, or by connecting the output from another class to the mandatory input.
The file 2523412.nii.gz is part of the Beijing Enhanced dataset, released by Beijing Normal University as part of the International Neuroimaging Datasharing Initiative (INDI) under a Creative Commons Attribution-NonCommerical 3.0 Unported License (CC-BY-NC). More information on the complete dataset is available online here, and it can be downloaded from NITRC.