Skip to content

Commit

Permalink
Merge pull request #77 from miykael/move_user_docs
Browse files Browse the repository at this point in the history
Moving user documentation from main homepage to nipype_tutorial - Pull Request
  • Loading branch information
miykael authored May 13, 2018
2 parents 42a6e9f + 2cf5af2 commit 632d4c5
Show file tree
Hide file tree
Showing 61 changed files with 4,603 additions and 851 deletions.
62 changes: 37 additions & 25 deletions index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {
"scrolled": false
},
Expand Down Expand Up @@ -63,6 +63,7 @@
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_jupyter-notebook.ipynb\">Jupyter-Notebook</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_dataset.ipynb\">BIDS & Tutorial Dataset</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_docker.ipynb\">Docker</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_neurodocker.ipynb\">Neurodocker</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_python.ipynb\">Python</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_showcase.ipynb\">Nipype Showcase</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_quickstart.ipynb\">Nipype Quickstart</a>\n",
Expand All @@ -80,28 +81,22 @@
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_data_input_bids.ipynb\">Data Input with BIDS</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_data_output.ipynb\">Data Output</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_plugins.ipynb\">Execution Plugins</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_function_nodes.ipynb\">Function Nodes</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_function_interface.ipynb\">Function Interface</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_iteration.ipynb\">Iteration / Iterables</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_mapnodes.ipynb\">MapNodes</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_joinnodes.ipynb\">JoinNodes</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_joinnodes.ipynb\">JoinNode, synchronize & itersource</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_error_and_crashes.ipynb\">Errors & Crashes</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_import_workflows.ipynb\">Import existing Workflows</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_debug.ipynb\">Debugging Nipype Workflows</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_model_specification_fmri.ipynb\">fMRI Model Specification</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_execution_configuration.ipynb\">Execution Configuration</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_import_workflows.ipynb\">Import existing Workflows</a>\n",
" </div>\n",
" <p>This section will introduce you to all of the key players in Nipype. Basic concepts that you need to learn to\n",
" fully understand and appreciate Nipype. Once you understand this section, you will know all that you need to know\n",
" to create any kind of Nipype workflow.</p>\n",
"\n",
" <h2 class=\"domain-header color03\"><a class=\"domain-title\">Advanced Concepts</a></h2>\n",
" <h2 class=\"domain-header color03\"><a class=\"domain-title\">Workflow Examples</a></h2>\n",
" <div class=\"pure-g domain-table-container color03\">\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_create_interfaces.ipynb\">Create Interfaces</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_interfaces_caching.ipynb\">Interfaces Caching</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_execution_configuration.ipynb\">Execution Configuration</a>\n",
" </div>\n",
" <p>This section is for more advanced users and Nipype developers.</p>\n",
"\n",
" <h2 class=\"domain-header color04\"><a class=\"domain-title\">Workflow Examples</a></h2>\n",
" <div class=\"pure-g domain-table-container color04\">\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/example_preprocessing.ipynb\">Example 1: Preprocessing</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/example_1stlevel.ipynb\">Example 1: 1st-level Analysis</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/example_normalize.ipynb\">Example 1: Normalize Data</a>\n",
Expand All @@ -111,6 +106,17 @@
" </div>\n",
" <p>In this section you will find some practical examples and hands-on that show you how to use Nipype in a \"real world\" scenario.</p>\n",
"\n",
" <h2 class=\"domain-header color04\"><a class=\"domain-title\">Advanced Concepts</a></h2>\n",
" <div class=\"pure-g domain-table-container color04\">\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_create_interfaces.ipynb\">Create Interfaces</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_interfaces_caching.ipynb\">Interfaces Caching</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_command_line_interface.ipynb\">Nipype Command Line Interface</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_aws.ipynb\">Amazon Web Services (AWS)</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_sphinx_ext.ipynb\">Sphinx extensions</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_spmmcr.ipynb\">SPM with MATLAB Common Runtime (MCR)</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_mipav.ipynb\">Using MIPAV, JIST, and CBS Tools</a> </div>\n",
" <p>This section is for more advanced users and Nipype developers.</p>\n",
"\n",
" <h2 class=\"domain-header color05\"><a class=\"domain-title\">Useful Resources & Links</a></h2>\n",
" <div class=\"pure-g domain-table-container color05\">\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/resources_installation.ipynb\">Install Nipype</a>\n",
Expand Down Expand Up @@ -222,6 +228,7 @@
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_jupyter-notebook.ipynb\">Jupyter-Notebook</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_dataset.ipynb\">BIDS & Tutorial Dataset</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_docker.ipynb\">Docker</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_neurodocker.ipynb\">Neurodocker</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_python.ipynb\">Python</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_showcase.ipynb\">Nipype Showcase</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/introduction_quickstart.ipynb\">Nipype Quickstart</a>\n",
Expand All @@ -239,28 +246,22 @@
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_data_input_bids.ipynb\">Data Input with BIDS</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_data_output.ipynb\">Data Output</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_plugins.ipynb\">Execution Plugins</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_function_nodes.ipynb\">Function Nodes</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_function_interface.ipynb\">Function Interface</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_iteration.ipynb\">Iteration / Iterables</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_mapnodes.ipynb\">MapNodes</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_joinnodes.ipynb\">JoinNodes</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_joinnodes.ipynb\">JoinNode, synchronize & itersource</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_error_and_crashes.ipynb\">Errors & Crashes</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_import_workflows.ipynb\">Import existing Workflows</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_debug.ipynb\">Debugging Nipype Workflows</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_model_specification_fmri.ipynb\">fMRI Model Specification</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_execution_configuration.ipynb\">Execution Configuration</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/basic_import_workflows.ipynb\">Import existing Workflows</a>\n",
" </div>\n",
" <p>This section will introduce you to all of the key players in Nipype. Basic concepts that you need to learn to\n",
" fully understand and appreciate Nipype. Once you understand this section, you will know all that you need to know\n",
" to create any kind of Nipype workflow.</p>\n",
"\n",
" <h2 class=\"domain-header color03\"><a class=\"domain-title\">Advanced Concepts</a></h2>\n",
" <h2 class=\"domain-header color03\"><a class=\"domain-title\">Workflow Examples</a></h2>\n",
" <div class=\"pure-g domain-table-container color03\">\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_create_interfaces.ipynb\">Create Interfaces</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_interfaces_caching.ipynb\">Interfaces Caching</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_execution_configuration.ipynb\">Execution Configuration</a>\n",
" </div>\n",
" <p>This section is for more advanced users and Nipype developers.</p>\n",
"\n",
" <h2 class=\"domain-header color04\"><a class=\"domain-title\">Workflow Examples</a></h2>\n",
" <div class=\"pure-g domain-table-container color04\">\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/example_preprocessing.ipynb\">Example 1: Preprocessing</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/example_1stlevel.ipynb\">Example 1: 1st-level Analysis</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/example_normalize.ipynb\">Example 1: Normalize Data</a>\n",
Expand All @@ -270,6 +271,17 @@
" </div>\n",
" <p>In this section you will find some practical examples and hands-on that show you how to use Nipype in a \"real world\" scenario.</p>\n",
"\n",
" <h2 class=\"domain-header color04\"><a class=\"domain-title\">Advanced Concepts</a></h2>\n",
" <div class=\"pure-g domain-table-container color04\">\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_create_interfaces.ipynb\">Create Interfaces</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_interfaces_caching.ipynb\">Interfaces Caching</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_command_line_interface.ipynb\">Nipype Command Line Interface</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_aws.ipynb\">Amazon Web Services (AWS)</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_sphinx_ext.ipynb\">Sphinx extensions</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_spmmcr.ipynb\">SPM with MATLAB Common Runtime (MCR)</a>\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/advanced_mipav.ipynb\">Using MIPAV, JIST, and CBS Tools</a> </div>\n",
" <p>This section is for more advanced users and Nipype developers.</p>\n",
"\n",
" <h2 class=\"domain-header color05\"><a class=\"domain-title\">Useful Resources & Links</a></h2>\n",
" <div class=\"pure-g domain-table-container color05\">\n",
" <a class=\"subject-link pure-u-1-4\" target=\"_blank\" href=\"notebooks/resources_installation.ipynb\">Install Nipype</a>\n",
Expand Down
166 changes: 166 additions & 0 deletions notebooks/advanced_aws.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Using Nipype with Amazon Web Services (AWS)\n",
"\n",
"Several groups have been successfully using Nipype on AWS. This procedure\n",
"involves setting a temporary cluster using StarCluster and potentially\n",
"transferring files to/from S3. The latter is supported by Nipype through\n",
"`DataSink` and `S3DataGrabber`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Using DataSink with S3\n",
"\n",
"The `DataSink` class now supports sending output data directly to an AWS S3\n",
"bucket. It does this through the introduction of several input attributes to the\n",
"`DataSink` interface and by parsing the `base_directory` attribute. This class\n",
"uses the [boto3](https://boto3.readthedocs.org/en/latest/) and\n",
"[botocore](https://botocore.readthedocs.org/en/latest/) Python packages to\n",
"interact with AWS. To configure the `DataSink` to write data to S3, the user must\n",
"set the ``base_directory`` property to an S3-style filepath.\n",
"\n",
"For example:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from nipype.interfaces.io import DataSink\n",
"ds = DataSink()\n",
"ds.inputs.base_directory = 's3://mybucket/path/to/output/dir'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"With the `\"s3://\"` prefix in the path, the `DataSink` knows that the output\n",
"directory to send files is on S3 in the bucket `\"mybucket\"`. `\"path/to/output/dir\"`\n",
"is the relative directory path within the bucket `\"mybucket\"` where output data\n",
"will be uploaded to (***Note***: if the relative path specified contains folders that\n",
"don’t exist in the bucket, the `DataSink` will create them). The `DataSink` treats\n",
"the S3 base directory exactly as it would a local directory, maintaining support\n",
"for containers, substitutions, subfolders, `\".\"` notation, etc. to route output\n",
"data appropriately.\n",
"\n",
"There are four new attributes introduced with S3-compatibility: ``creds_path``,\n",
"``encrypt_bucket_keys``, ``local_copy``, and ``bucket``."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ds.inputs.creds_path = '/home/neuro/aws_creds/credentials.csv'\n",
"ds.inputs.encrypt_bucket_keys = True\n",
"ds.local_copy = '/home/neuro/workflow_outputs/local_backup'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"``creds_path`` is a file path where the user's AWS credentials file (typically\n",
"a csv) is stored. This credentials file should contain the AWS access key id and\n",
"secret access key and should be formatted as one of the following (these formats\n",
"are how Amazon provides the credentials file by default when first downloaded).\n",
"\n",
"Root-account user:\n",
"\n",
"\tAWSAccessKeyID=ABCDEFGHIJKLMNOP\n",
"\tAWSSecretKey=zyx123wvu456/ABC890+gHiJk\n",
"\n",
"IAM-user:\n",
"\n",
"\tUser Name,Access Key Id,Secret Access Key\n",
"\t\"username\",ABCDEFGHIJKLMNOP,zyx123wvu456/ABC890+gHiJk\n",
"\n",
"The ``creds_path`` is necessary when writing files to a bucket that has\n",
"restricted access (almost no buckets are publicly writable). If ``creds_path``\n",
"is not specified, the DataSink will check the ``AWS_ACCESS_KEY_ID`` and\n",
"``AWS_SECRET_ACCESS_KEY`` environment variables and use those values for bucket\n",
"access.\n",
"\n",
"``encrypt_bucket_keys`` is a boolean flag that indicates whether to encrypt the\n",
"output data on S3, using server-side AES-256 encryption. This is useful if the\n",
"data being output is sensitive and one desires an extra layer of security on the\n",
"data. By default, this is turned off.\n",
"\n",
"``local_copy`` is a string of the filepath where local copies of the output data\n",
"are stored in addition to those sent to S3. This is useful if one wants to keep\n",
"a backup version of the data stored on their local computer. By default, this is\n",
"turned off.\n",
"\n",
"``bucket`` is a boto3 Bucket object that the user can use to overwrite the\n",
"bucket specified in their ``base_directory``. This can be useful if one has to\n",
"manually create a bucket instance on their own using special credentials (or\n",
"using a mock server like [fakes3](https://github.com/jubos/fake-s3)). This is\n",
"typically used for developers unit-testing the DataSink class. Most users do not\n",
"need to use this attribute for actual workflows. This is an optional argument.\n",
"\n",
"Finally, the user needs only to specify the input attributes for any incoming\n",
"data to the node, and the outputs will be written to their S3 bucket."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```python\n",
"workflow.connect(inputnode, 'subject_id', ds, 'container')\n",
"workflow.connect(realigner, 'realigned_files', ds, 'motion')\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"So, for example, outputs for `sub001`’s `realigned_file1.nii.gz` will be in:\n",
"\n",
" s3://mybucket/path/to/output/dir/sub001/motion/realigned_file1.nii.gz"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Using S3DataGrabber\n",
"Coming soon..."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [default]",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 632d4c5

Please sign in to comment.