{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Downloading ConWhAt Atlases" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Import the fetcher function" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [], "source": [ "from conwhat.utils.fetchers import fetch_conwhat_atlas\n", "import glob" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Define the output directory" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "atlas_dir = '/scratch/hpc3230/Data/conwhat_atlases'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Define which atlas to grab" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "atlas_name = 'CWL2k8Sc33Vol3d100s_v01'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Break a leg" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "removing existing folder\n", "\n", "\n", "duplicate file detected - removing...\n", "rm CWL2k8Sc33Vol3d100s_v01.zip\n", "\n", "\n", "downloading data_file CWL2k8Sc33Vol3d100s_v01.zip...\n", "wget https://www.nitrc.org/frs/download.php/10381/CWL2k8Sc33Vol3d100s_v01.zip\n", "\n", "\n", "unzipping file...\n", "unzip CWL2k8Sc33Vol3d100s_v01.zip\n", "\n", "\n", "finished unzipping.\n" ] } ], "source": [ "fetch_conwhat_atlas(atlas_name,atlas_dir,remove_existing=True);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The zipped and unzipped atlas folders are now there in the top-level atlas directory;" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01',\n", " '/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01.zip',\n", " '/scratch/hpc3230/Data/conwhat_atlases/README.md']" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "glob.glob(atlas_dir + '/*')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The .zip file can be optionally removed automatically if desired. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "volumetric atlas folders contain a small number of fairly small .txt files" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/region_mapping_fsav_rh.txt',\n", " '/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/weights.txt',\n", " '/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/mappings.txt',\n", " '/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/region_labels.txt',\n", " '/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/bounding_boxes.txt',\n", " '/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/hemispheres.txt',\n", " '/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/cortex.txt',\n", " '/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/region_mapping_fsav_lh.txt']" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "glob.glob('%s/%s/*.txt' %(atlas_dir,atlas_name))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "...and a larger number of nifti images; one for each atlas structure" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/vismap_grp_7-64_norm.nii.gz',\n", " '/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/vismap_grp_23-30_norm.nii.gz',\n", " '/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/vismap_grp_65-69_norm.nii.gz',\n", " '/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/vismap_grp_55-70_norm.nii.gz',\n", " '/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01/vismap_grp_28-64_norm.nii.gz']" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "glob.glob('%s/%s/*.nii.gz' %(atlas_dir,atlas_name))[:5]" ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2445" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(glob.glob('%s/%s/*.nii.gz' %(atlas_dir,atlas_name)))" ] } ], "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.13" }, "nbTranslate": { "displayLangs": [ "*" ], "hotkey": "alt-t", "langInMainMenu": true, "sourceLang": "en", "targetLang": "fr", "useGoogleTranslate": true }, "toc": { "nav_menu": {}, "number_sections": false, "sideBar": false, "skip_h1_title": false, "toc_cell": false, "toc_position": {}, "toc_section_display": "block", "toc_window_display": true } }, "nbformat": 4, "nbformat_minor": 1 }