{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Exploring ConWhAt Atlases" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There are four different atlas types in ConWhat, corresponding to the 2 ontology types (Tract-based / Connectivity-Based) and 2 representation types (Volumetric / Streamlinetric). \n", "\n", "(More on this schema [here](http://conwhat.readthedocs.io/en/latest/about_conwhat/ontology_and_representation.html))" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# ConWhAt stuff\n", "from conwhat import VolConnAtlas,StreamConnAtlas,VolTractAtlas,StreamTractAtlas\n", "from conwhat.viz.volume import plot_vol_scatter,plot_vol_and_rois_nilearn\n", "\n", "# Neuroimaging stuff\n", "import nibabel as nib\n", "from nilearn.plotting import plot_stat_map,plot_surf_roi\n", "\n", "# Viz stuff\n", "%matplotlib inline\n", "from matplotlib import pyplot as plt\n", "import seaborn as sns\n", "\n", "# Generic stuff\n", "import glob, numpy as np, pandas as pd, networkx as nx" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We'll start with the scale 33 lausanne 2008 volumetric connectivity-based atlas." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Define the atlas name and top-level directory location" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "atlas_dir = '/scratch/hpc3230/Data/conwhat_atlases'\n", "atlas_name = 'CWL2k8Sc33Vol3d100s_v01'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Initialize the atlas class" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "loading file mapping\n", "loading vol bbox\n", "loading connectivity\n" ] } ], "source": [ "vca = VolConnAtlas(atlas_dir=atlas_dir + '/' + atlas_name,\n", " atlas_name=atlas_name)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This atlas object contains various pieces of general information" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'CWL2k8Sc33Vol3d100s_v01'" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vca.atlas_name" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'/scratch/hpc3230/Data/conwhat_atlases/CWL2k8Sc33Vol3d100s_v01'" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vca.atlas_dir" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Information about each atlas entry is contained in the `vfms` attribute, which returns a pandas dataframe" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | name | \n", "nii_file | \n", "nii_file_id | \n", "4dvolind | \n", "
|---|---|---|---|---|
| 0 | \n", "61_to_80 | \n", "vismap_grp_62-81_norm.nii.gz | \n", "0 | \n", "NaN | \n", "
| 1 | \n", "38_to_55 | \n", "vismap_grp_39-56_norm.nii.gz | \n", "1 | \n", "NaN | \n", "
| 2 | \n", "28_to_38 | \n", "vismap_grp_29-39_norm.nii.gz | \n", "2 | \n", "NaN | \n", "
| 3 | \n", "18_to_19 | \n", "vismap_grp_19-20_norm.nii.gz | \n", "3 | \n", "NaN | \n", "
| 4 | \n", "26_to_55 | \n", "vismap_grp_27-56_norm.nii.gz | \n", "4 | \n", "NaN | \n", "