{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:21:42.494316Z", "start_time": "2019-02-27T02:21:42.465698Z" } }, "outputs": [], "source": [ "# for automatic reloading\n", "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:21:45.389187Z", "start_time": "2019-02-27T02:21:42.496672Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/mnt/cube/tsainbur/conda_envs/tpy3/lib/python3.6/site-packages/tqdm/autonotebook/__init__.py:14: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)\n", " \" (e.g. in jupyter console)\", TqdmExperimentalWarning)\n" ] } ], "source": [ "from birdbrain.atlas import atlas\n", "from birdbrain.utils import um_to_vox\n", "import numpy as np\n", "from birdbrain.visualization.plotting_3d import plot_regions_3d, rotate_plot" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:21:45.424011Z", "start_time": "2019-02-27T02:21:45.391471Z" } }, "outputs": [], "source": [ "password = None" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:21:47.022790Z", "start_time": "2019-02-27T02:21:45.425984Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Data already download\n", "Getting voxel data from .img files...\n", "Getting location for each nucleus/region from voxel data...\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(IntProgress(value=0, max=13), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\r", "Atlas created\n" ] } ], "source": [ "# NBVAL_SKIP\n", "dset_dir = '../../data/processed/zebra_finch/'\n", "\n", "zebra_finch_atlas = atlas(\n", " species = 'zebra_finch',\n", " dset_dir = dset_dir,\n", " um_mult = 100,\n", " smoothing = [], #['Brain', 'Brainregions']\n", " password = password\n", ")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:21:47.063029Z", "start_time": "2019-02-27T02:21:47.025138Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Nuclei']\n", "['DLM' 'E' 'HVC' 'L' 'LMAN' 'MLd' 'Olfactory_bulb' 'Ov' 'RA' 'Rt' 'TeO'\n", " 'X' 'nXIIts']\n" ] } ], "source": [ "# NBVAL_SKIP\n", "# the only delineation for zebra finch is nuclei\n", "print(np.unique(list(zebra_finch_atlas.brain_labels.type_)))\n", "print(np.unique(list(zebra_finch_atlas.brain_labels.index)))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:21:47.166702Z", "start_time": "2019-02-27T02:21:47.064968Z" } }, "outputs": [], "source": [ "# NBVAL_SKIP\n", "nuclei = [[reg, 'Nuclei'] for reg in list(zebra_finch_atlas.brain_labels[zebra_finch_atlas.brain_labels.type_ == 'Nuclei'].region.values)]" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:21:51.297472Z", "start_time": "2019-02-27T02:21:47.168959Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/mnt/cube/tsainbur/conda_envs/tpy3/lib/python3.6/site-packages/traittypes/traittypes.py:101: UserWarning: Given trait value dtype \"uint8\" does not match required type \"float32\". A coerced copy has been created.\n", " np.dtype(self.dtype).name))\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(IntProgress(value=0, max=13), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\r" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "5b0b9653ba7c4492ac3587c56269f8fe", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "a5fff7e93f50450d86694d9b53b8ae2c", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FloatSlider(value=0.0, description='medial-lateral:', max=10200.0, min=-10200.0, step=100.0)" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "218406b9a77346399a26ee8550539896", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FloatSlider(value=0.0, description='posterior-anterior:', max=10200.0, min=-10200.0, step=100.0)" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "2cf5105a64d843c3894fba70ab2f0cc5", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FloatSlider(value=0.0, description='ventral-dorsal:', max=10200.0, min=-10200.0, step=100.0)" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "7b1bce3e233d4acc95dd2945a1588c8c", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Dropdown(description='Region:', index=13, options=('L', 'HVC', 'X', 'RA', 'E', 'LMAN', 'MLd', 'DLM', 'Ov', 'Ol…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# NBVAL_SKIP\n", "plot, vec = plot_regions_3d(zebra_finch_atlas, regions_to_plot = nuclei, downsample_pct = 1,\n", " polygon_simplification = 0,\n", " verbose=False)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:21:55.348525Z", "start_time": "2019-02-27T02:21:51.300099Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(IntProgress(value=0, max=120), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\r" ] } ], "source": [ "# NBVAL_SKIP\n", "rotate_plot(plot, n_frames = 60, fr=32, nrot = 2, radius = 8000)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.8" } }, "nbformat": 4, "nbformat_minor": 2 }