{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T04:55:27.222311Z", "start_time": "2019-02-27T04:55:24.463922Z" } }, "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": 2, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T04:55:55.713217Z", "start_time": "2019-02-27T04:55:27.224631Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "qform_code 32 not valid; setting to 0\n", "qform_code 32 not valid; setting to 0\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Data already download\n", "Loading brain labels...\n", "Getting voxel data from .img files...\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "qform_code 32 not valid; setting to 0\n", "qform_code 32 not valid; setting to 0\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(IntProgress(value=0, max=1), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\r" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(IntProgress(value=0, max=22), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\r" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(IntProgress(value=0, max=12), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\r", "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=45), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\r", "Atlas created\n" ] } ], "source": [ "dset_dir = '../../data/processed/starling/'\n", "\n", "starling_atlas = atlas(\n", " species = 'starling',\n", " dset_dir = dset_dir,\n", " um_mult = 100,\n", " smoothing = ['Brain', 'Nuclei', 'Tracts'],\n", " updated_y_sinus = [0, 1500, 0]\n", ")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T04:55:55.723910Z", "start_time": "2019-02-27T04:55:55.715476Z" } }, "outputs": [], "source": [ "tracts = [[reg, 'Tracts'] for reg in list(starling_atlas.brain_labels[starling_atlas.brain_labels.type_ == 'Tracts'].region.values)]\n", "nuclei = [[reg, 'Nuclei'] for reg in list(starling_atlas.brain_labels[starling_atlas.brain_labels.type_ == 'Nuclei'].region.values)]\n", "brain_regions = [[reg, 'Brainregions'] for reg in list(starling_atlas.brain_labels[starling_atlas.brain_labels.type_ == 'Brainregions'].region.values)]" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T04:56:48.444235Z", "start_time": "2019-02-27T04:55:55.725719Z" }, "scrolled": false }, "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=22), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\r" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "853e9decd47b4e16a21edd2f01c92173", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "54b569ed0f3f4fd7ab4dd7fb1a7cdd94", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FloatSlider(value=0.0, description='medial-lateral:', max=10937.0, min=-10737.0, step=100.0)" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "621bf5d3205e49cbaae98d485d4204d8", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FloatSlider(value=0.0, description='posterior-anterior:', max=13337.0, min=-8337.0, step=100.0)" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "77efc2bf2f644208b5e56d84e9f760e1", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FloatSlider(value=0.0, description='ventral-dorsal:', max=4237.0, min=-17437.0, step=100.0)" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "7e255a4a00a740da849673b88c33806a", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Dropdown(description='Region:', index=22, options=('Field_L', 'NCM', 'Ov', 'MLd', 'CMM', 'TeO', 'Entopallium',…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plot, vec = plot_regions_3d(starling_atlas, regions_to_plot = nuclei, downsample_pct = 1,\n", " polygon_simplification = 0.5,\n", " additional_volumes = ['Ct'],\n", " verbose=False)\n", "\n", "# add a clipping plane to only show half the brain/skull\n", "plot.clipping_planes = [[1,0,0, 0]]" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T04:57:19.432188Z", "start_time": "2019-02-27T04:56:48.446840Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(IntProgress(value=0, max=240), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\r" ] } ], "source": [ "rotate_plot(plot, n_frames = 60, fr=8, nrot = 4, radius = 24000)" ] } ], "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 }