{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Downloading Human Connectome Project (HCP) Data using Amazon Web Services (AWS)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "dmipy allows direct download of HCP data by connecting directly to Amazon Web Services with your own credentials. First, you need to follow the following instruction to get your AWS credentials:\n", "\n", "https://wiki.humanconnectome.org/display/PublicData/How+To+Connect+to+Connectome+Data+via+AWS\n", "\n", "Then, you can open the interface to the AWS serves as follows:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from dmipy.hcp_interface import downloader_aws\n", "\n", "public_aws_key = 'your public aws key'\n", "secret_aws_key = 'your secret aws key'\n", "\n", "hcp_interface = downloader_aws.HCPInterface(\n", " your_aws_public_key=public_aws_key,\n", " your_aws_secret_key=secret_aws_key)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If your credentials are correct this will not give you an authorization error. \n", "You can then automatically download subject 100307 of the Wu-Minn HCP data (the one we chose to illustrate the dmipy examples) and save a coronal slice for the dmipy example notebooks. The data location is automatically chosen by the system." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Downloading data to /user/rfick/home/.cache/Python-Eggs/dmipy-0.1.dev0-py2.7.egg-tmp/dmipy/data/hcp/100307\n", "Downloading bvals\n", "Downloading bvecs\n", "Downloading data.nii.gz\n", "Downloading nodif_brain_mask.nii.gz\n", "Preparing coronal slice for dmipy examples\n", "Done\n" ] } ], "source": [ "hcp_interface.download_and_prepare_dmipy_example_dataset()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can also download any other HCP subject by putting another valid subject number." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([100206, 100307, 100408, ..., 994273, 995174, 996782])" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "available_hcp_subjects = hcp_interface.available_subjects\n", "available_hcp_subjects" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Downloading data to /user/rfick/home/.cache/Python-Eggs/dmipy-0.1.dev0-py2.7.egg-tmp/dmipy/data/hcp/100206\n", "Downloading bvals\n", "Downloading bvecs\n", "Downloading data.nii.gz\n", "Downloading nodif_brain_mask.nii.gz\n" ] } ], "source": [ "hcp_interface.download_subject(subject_ID=available_hcp_subjects[0])" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.14" } }, "nbformat": 4, "nbformat_minor": 2 }