{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:11:47.828410Z", "start_time": "2019-02-27T02:11:45.338467Z" } }, "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-27T02:12:10.792132Z", "start_time": "2019-02-27T02:11:47.830995Z" } }, "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=66), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Atlas created\n" ] } ], "source": [ "dset_dir = '../../data/processed/canary/'\n", "\n", "canary_atlas = atlas(\n", " species = 'canary',\n", " dset_dir = dset_dir,\n", " um_mult = 1,\n", " smoothing = []#['Brain', 'Brainregions']\n", ")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:12:10.800442Z", "start_time": "2019-02-27T02:12:10.794609Z" } }, "outputs": [ { "data": { "text/plain": [ "Index(['Nuclei', 'Skull', 'Tracts', 'Brain', 'Combined_set', 'Subdivisions',\n", " 'T2_rare_3d', 'T2_flash_3d_hr'],\n", " dtype='object')" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "canary_atlas.voxel_data.index" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:12:10.904120Z", "start_time": "2019-02-27T02:12:10.802186Z" } }, "outputs": [], "source": [ "nuclei = [[reg, 'Nuclei'] for reg in list(canary_atlas.brain_labels[canary_atlas.brain_labels.type_ == 'Nuclei'].region.values)]" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:12:29.012062Z", "start_time": "2019-02-27T02:12:10.907489Z" } }, "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=24), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\r" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "6046a5b95ddc4144b9918b78f66d6236", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Output()" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "c212932237574c378db6f95686a5d48d", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FloatSlider(value=0.0, description='medial-lateral:', max=9000.0, min=-8880.0, step=100.0)" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "c3949a489f4246788fb47468e63fcbe1", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FloatSlider(value=0.0, description='posterior-anterior:', max=10980.0, min=-13020.0, step=100.0)" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "94513eeac23a4f7f8fc2297aadc56d73", "version_major": 2, "version_minor": 0 }, "text/plain": [ "FloatSlider(value=0.0, description='ventral-dorsal:', max=2760.0, min=-25860.0, step=100.0)" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "49b2178955854166b16460d092908f38", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Dropdown(description='Region:', index=24, options=('L2', 'HVC', 'OB', 'E', 'lMAN', 'mMAN', 'area X', 'Bas', 'R…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plot, vec = plot_regions_3d(canary_atlas, regions_to_plot = nuclei, downsample_pct = 1,\n", " polygon_simplification = 0,\n", " verbose=False)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2019-02-27T02:12:37.049374Z", "start_time": "2019-02-27T02:12:29.015601Z" } }, "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 the pot\n", "rotate_plot(plot, n_frames = 60, fr=32, nrot = 4, radius = 8000)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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 }