Note
Click here to download the full example code
Downloading ConWhAt Atlases¶
Setup¶
# Import the fetcher function
from conwhat.utils.fetchers import fetch_conwhat_atlas
import os,glob
# Define the output directory
atlas_dir = 'conwhat_atlases'
# Define which atlas to grab
atlas_name = 'CWL2k8Sc33Vol3d100s_v01'
Out:
/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/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 "
Download the atlases and take a look¶
fetch_conwhat_atlas(atlas_name,atlas_dir,remove_existing=True);
# The zipped and unzipped atlas folders are now there in the top-level atlas directory;
glob.glob(atlas_dir + '/*')
# The .zip file can be optionally removed automatically if desired.
# volumetric atlas folders contain a small number of fairly small .txt files
glob.glob('%s/%s/*.txt' %(atlas_dir,atlas_name))
# ...and a larger number of nifti images; one for each atlas structure
glob.glob('%s/%s/*.nii.gz' %(atlas_dir,atlas_name))[:5]
len(glob.glob('%s/%s/*.nii.gz' %(atlas_dir,atlas_name)))
Out:
dataset dir not present. creating
downloading data_file CWL2k8Sc33Vol3d100s_v01.zip...
wget https://www.nitrc.org/frs/download.php/10381/CWL2k8Sc33Vol3d100s_v01.zip --no-check-certificate
unzipping file...
unzip CWL2k8Sc33Vol3d100s_v01.zip
finished unzipping.
2445
Total running time of the script: ( 0 minutes 12.024 seconds)