{ "cells": [ { "metadata": {}, "cell_type": "markdown", "source": "# Example notebook `neuralib.atlas`", "id": "d554af79863e6491" }, { "metadata": {}, "cell_type": "code", "outputs": [], "execution_count": null, "source": [ "import matplotlib.pyplot as plt\n", "\n", "from neuralib.atlas.data import get_children\n", "from neuralib.atlas.view import get_slice_view" ], "id": "caf8ddaf8dde6427" }, { "metadata": {}, "cell_type": "code", "outputs": [], "execution_count": null, "source": [ "%load_ext autoreload\n", "%autoreload" ], "id": "8dd2102aed296798" }, { "metadata": {}, "cell_type": "markdown", "source": [ "### Example of ML offset in coronal slice\n", "\n", "- Use `plane.with_angle_offset(deg_x=...)` for ML axis offset in a reference view" ], "id": "cce8e8f856205935" }, { "metadata": {}, "cell_type": "code", "outputs": [], "execution_count": null, "source": [ "slice_index = 700\n", "plane = get_slice_view('reference', plane_type='coronal', resolution=10).plane_at(slice_index)\n", "\n", "_, ax = plt.subplots(ncols=2, figsize=(20, 10))\n", "\n", "plane.plot(ax=ax[0], boundaries=True)\n", "ax[0].set_title('without offset')\n", "\n", "plane.with_angle_offset(deg_x=10).plot(ax=ax[1], boundaries=True)\n", "ax[1].set_title('+10 degree ML offset')" ], "id": "24f641c7fdf95ab2" }, { "metadata": {}, "cell_type": "markdown", "source": [ "### Example of DV offset in sagittal slice\n", "\n", "- Use `plane.with_angle_offset(deg_y=...)` for DV axis offset in an annotation view" ], "id": "d015c4495a3a8240" }, { "metadata": {}, "cell_type": "code", "outputs": [], "execution_count": null, "source": [ "slice_index = 500\n", "plane = get_slice_view('annotation', plane_type='sagittal', resolution=10).plane_at(slice_index)\n", "\n", "_, ax = plt.subplots(ncols=2, figsize=(20, 10))\n", "plane.plot(ax=ax[0], boundaries=True)\n", "ax[0].set_title('without offset')\n", "\n", "plane.with_angle_offset(deg_y=20).plot(ax=ax[1], boundaries=True)\n", "ax[1].set_title('+20 degree DV offset')" ], "id": "d4bc3a2e2a2d6b2d" }, { "metadata": {}, "cell_type": "markdown", "source": [ "### Example of Annotate regions\n", "- Annotation Hippocampal CA1 and Primary Visual Cortex (VISp)\n", "- Also works in offset view and detailed tree regions" ], "id": "a10e63243ddb47e4" }, { "metadata": {}, "cell_type": "code", "outputs": [], "execution_count": null, "source": [ "slice_index = 900\n", "plane = get_slice_view('reference', plane_type='coronal', resolution=10).plane_at(slice_index)\n", "\n", "_, ax = plt.subplots(ncols=2, figsize=(20, 10))\n", "plane.plot(ax=ax[0], boundaries=True, annotation_region=['CA1', 'VISp'])\n", "\n", "#\n", "primary_visual_layers = get_children('VISp', dataframe=False)\n", "print(primary_visual_layers)\n", "plane.with_angle_offset(deg_x=10).plot(ax=ax[1], boundaries=True, annotation_region=['CA1'] + primary_visual_layers)\n" ], "id": "edd06789ed9e063a" }, { "metadata": {}, "cell_type": "markdown", "source": "### Example of Annotate regions in transverse view", "id": "29c226a118d26723" }, { "metadata": {}, "cell_type": "code", "outputs": [], "execution_count": null, "source": [ "slice_index = 300\n", "plane = get_slice_view('reference', plane_type='transverse', resolution=10).plane_at(slice_index)\n", "\n", "_, ax = plt.subplots(ncols=2, figsize=(20, 10))\n", "plane.plot(ax=ax[0], annotation_region=['ACA', 'LP'])\n", "plane.plot(ax=ax[1], annotation_region=['SS', 'MO'], annotation_cmap='PiYG', boundaries=True)" ], "id": "b4dd56e9f9e0d915" }, { "metadata": {}, "cell_type": "markdown", "source": [ "### Example of max projection\n", "- All visual areas max projection in transverse section plane\n" ], "id": "1fea0394fbb7ad0d" }, { "metadata": {}, "cell_type": "code", "outputs": [], "execution_count": null, "source": [ "view = get_slice_view('reference', plane_type='transverse', resolution=10)\n", "\n", "_, ax = plt.subplots()\n", "regions = get_children('VIS')\n", "print(regions)\n", "view.plot_max_projection(ax, annotation_regions=regions)" ], "id": "4ebc4138e85eafcd" } ], "metadata": { "kernelspec": { "display_name": "py310", "language": "python", "name": "py310" }, "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.9.16" } }, "nbformat": 4, "nbformat_minor": 5 }