Created
November 11, 2025 18:44
-
-
Save akhanf/d85a4a78555b5a1b2a7f189af6a263c0 to your computer and use it in GitHub Desktop.
Simple zarrnii example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 1, | |
| "id": "265214bd-bd9b-4d06-bc67-b0b98eaa90ab", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "from zarrnii import ZarrNii, ZarrNiiAtlas\n", | |
| "\n", | |
| "img = ZarrNii.from_ome_zarr('/nfs/trident3/lightsheet/prado/mouse_app_lecanemab_ki3/bids/sub-AS134F3/micr/sub-AS134F3_sample-brain_acq-imaris4x_SPIM.ome.zarr', channel_labels=['Iba1'],level=5,downsample_near_isotropic=True)\n", | |
| "\n" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 2, | |
| "id": "ba5d0f34-03a7-4990-800e-0adf07133940", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/html": [ | |
| "\n", | |
| " <div style=\"margin-bottom: 10px;\">\n", | |
| " <strong>ZarrNii Object</strong>\n", | |
| " <table style=\"margin-left: 20px; border-collapse: collapse;\">\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>name:</strong></td><td style=\"padding: 2px;\">image</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>shape:</strong></td><td style=\"padding: 2px;\">(1, 192, 312, 212)</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>dims:</strong></td><td style=\"padding: 2px;\">['c', 'z', 'y', 'x']</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>axes_order:</strong></td><td style=\"padding: 2px;\">ZYX</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>xyz_orientation:</strong></td><td style=\"padding: 2px;\">RPI</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>scale:</strong></td><td style=\"padding: 2px;\">{'c': 1, 'z': 0.035216000000000004, 'y': 0.052, 'x': 0.052}</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>dtype:</strong></td><td style=\"padding: 2px;\">uint16</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>chunksize:</strong></td><td style=\"padding: 2px;\">(1, 1, 312, 212)</td></tr>\n", | |
| " </table>\n", | |
| " </div>\n", | |
| " \n", | |
| " <div style=\"margin-top: 10px;\">\n", | |
| " <strong>Dask Array:</strong>\n", | |
| " <table>\n", | |
| " <tr>\n", | |
| " <td>\n", | |
| " <table style=\"border-collapse: collapse;\">\n", | |
| " <thead>\n", | |
| " <tr>\n", | |
| " <td> </td>\n", | |
| " <th> Array </th>\n", | |
| " <th> Chunk </th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " \n", | |
| " <tr>\n", | |
| " <th> Bytes </th>\n", | |
| " <td> 24.22 MiB </td>\n", | |
| " <td> 129.19 kiB </td>\n", | |
| " </tr>\n", | |
| " \n", | |
| " <tr>\n", | |
| " <th> Shape </th>\n", | |
| " <td> (1, 192, 312, 212) </td>\n", | |
| " <td> (1, 1, 312, 212) </td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th> Dask graph </th>\n", | |
| " <td colspan=\"2\"> 192 chunks in 4 graph layers </td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th> Data type </th>\n", | |
| " <td colspan=\"2\"> uint16 numpy.ndarray </td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| " </table>\n", | |
| " </td>\n", | |
| " <td>\n", | |
| " <svg width=\"364\" height=\"213\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"0\" y1=\"0\" x2=\"25\" y2=\"0\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"0\" y1=\"25\" x2=\"25\" y2=\"25\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"25\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"25\" y1=\"0\" x2=\"25\" y2=\"25\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"0.0,0.0 25.412616514582485,0.0 25.412616514582485,25.412616514582485 0.0,25.412616514582485\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Text -->\n", | |
| " <text x=\"12.706308\" y=\"45.412617\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >1</text>\n", | |
| " <text x=\"45.412617\" y=\"12.706308\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(0,45.412617,12.706308)\">1</text>\n", | |
| "\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"138\" y2=\"43\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"95\" y1=\"120\" x2=\"138\" y2=\"163\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"95\" y2=\"120\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"96\" y1=\"1\" x2=\"96\" y2=\"121\" />\n", | |
| " <line x1=\"97\" y1=\"2\" x2=\"97\" y2=\"122\" />\n", | |
| " <line x1=\"99\" y1=\"4\" x2=\"99\" y2=\"124\" />\n", | |
| " <line x1=\"100\" y1=\"5\" x2=\"100\" y2=\"125\" />\n", | |
| " <line x1=\"101\" y1=\"6\" x2=\"101\" y2=\"126\" />\n", | |
| " <line x1=\"103\" y1=\"8\" x2=\"103\" y2=\"128\" />\n", | |
| " <line x1=\"104\" y1=\"9\" x2=\"104\" y2=\"129\" />\n", | |
| " <line x1=\"105\" y1=\"10\" x2=\"105\" y2=\"130\" />\n", | |
| " <line x1=\"107\" y1=\"12\" x2=\"107\" y2=\"132\" />\n", | |
| " <line x1=\"108\" y1=\"13\" x2=\"108\" y2=\"133\" />\n", | |
| " <line x1=\"109\" y1=\"14\" x2=\"109\" y2=\"134\" />\n", | |
| " <line x1=\"111\" y1=\"16\" x2=\"111\" y2=\"136\" />\n", | |
| " <line x1=\"112\" y1=\"17\" x2=\"112\" y2=\"137\" />\n", | |
| " <line x1=\"114\" y1=\"19\" x2=\"114\" y2=\"139\" />\n", | |
| " <line x1=\"115\" y1=\"20\" x2=\"115\" y2=\"140\" />\n", | |
| " <line x1=\"116\" y1=\"21\" x2=\"116\" y2=\"141\" />\n", | |
| " <line x1=\"118\" y1=\"23\" x2=\"118\" y2=\"143\" />\n", | |
| " <line x1=\"119\" y1=\"24\" x2=\"119\" y2=\"144\" />\n", | |
| " <line x1=\"120\" y1=\"25\" x2=\"120\" y2=\"145\" />\n", | |
| " <line x1=\"122\" y1=\"27\" x2=\"122\" y2=\"147\" />\n", | |
| " <line x1=\"123\" y1=\"28\" x2=\"123\" y2=\"148\" />\n", | |
| " <line x1=\"124\" y1=\"29\" x2=\"124\" y2=\"149\" />\n", | |
| " <line x1=\"126\" y1=\"31\" x2=\"126\" y2=\"151\" />\n", | |
| " <line x1=\"127\" y1=\"32\" x2=\"127\" y2=\"152\" />\n", | |
| " <line x1=\"128\" y1=\"33\" x2=\"128\" y2=\"153\" />\n", | |
| " <line x1=\"130\" y1=\"35\" x2=\"130\" y2=\"155\" />\n", | |
| " <line x1=\"131\" y1=\"36\" x2=\"131\" y2=\"156\" />\n", | |
| " <line x1=\"133\" y1=\"38\" x2=\"133\" y2=\"158\" />\n", | |
| " <line x1=\"134\" y1=\"39\" x2=\"134\" y2=\"159\" />\n", | |
| " <line x1=\"135\" y1=\"40\" x2=\"135\" y2=\"160\" />\n", | |
| " <line x1=\"137\" y1=\"42\" x2=\"137\" y2=\"162\" />\n", | |
| " <line x1=\"138\" y1=\"43\" x2=\"138\" y2=\"163\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"95.0,0.0 138.4389140271493,43.438914027149316 138.4389140271493,163.4389140271493 95.0,120.0\" style=\"fill:#8B4903A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"176\" y2=\"0\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"96\" y1=\"1\" x2=\"177\" y2=\"1\" />\n", | |
| " <line x1=\"97\" y1=\"2\" x2=\"179\" y2=\"2\" />\n", | |
| " <line x1=\"99\" y1=\"4\" x2=\"180\" y2=\"4\" />\n", | |
| " <line x1=\"100\" y1=\"5\" x2=\"181\" y2=\"5\" />\n", | |
| " <line x1=\"101\" y1=\"6\" x2=\"183\" y2=\"6\" />\n", | |
| " <line x1=\"103\" y1=\"8\" x2=\"184\" y2=\"8\" />\n", | |
| " <line x1=\"104\" y1=\"9\" x2=\"186\" y2=\"9\" />\n", | |
| " <line x1=\"105\" y1=\"10\" x2=\"187\" y2=\"10\" />\n", | |
| " <line x1=\"107\" y1=\"12\" x2=\"188\" y2=\"12\" />\n", | |
| " <line x1=\"108\" y1=\"13\" x2=\"190\" y2=\"13\" />\n", | |
| " <line x1=\"109\" y1=\"14\" x2=\"191\" y2=\"14\" />\n", | |
| " <line x1=\"111\" y1=\"16\" x2=\"192\" y2=\"16\" />\n", | |
| " <line x1=\"112\" y1=\"17\" x2=\"194\" y2=\"17\" />\n", | |
| " <line x1=\"114\" y1=\"19\" x2=\"195\" y2=\"19\" />\n", | |
| " <line x1=\"115\" y1=\"20\" x2=\"196\" y2=\"20\" />\n", | |
| " <line x1=\"116\" y1=\"21\" x2=\"198\" y2=\"21\" />\n", | |
| " <line x1=\"118\" y1=\"23\" x2=\"199\" y2=\"23\" />\n", | |
| " <line x1=\"119\" y1=\"24\" x2=\"200\" y2=\"24\" />\n", | |
| " <line x1=\"120\" y1=\"25\" x2=\"202\" y2=\"25\" />\n", | |
| " <line x1=\"122\" y1=\"27\" x2=\"203\" y2=\"27\" />\n", | |
| " <line x1=\"123\" y1=\"28\" x2=\"205\" y2=\"28\" />\n", | |
| " <line x1=\"124\" y1=\"29\" x2=\"206\" y2=\"29\" />\n", | |
| " <line x1=\"126\" y1=\"31\" x2=\"207\" y2=\"31\" />\n", | |
| " <line x1=\"127\" y1=\"32\" x2=\"209\" y2=\"32\" />\n", | |
| " <line x1=\"128\" y1=\"33\" x2=\"210\" y2=\"33\" />\n", | |
| " <line x1=\"130\" y1=\"35\" x2=\"211\" y2=\"35\" />\n", | |
| " <line x1=\"131\" y1=\"36\" x2=\"213\" y2=\"36\" />\n", | |
| " <line x1=\"133\" y1=\"38\" x2=\"214\" y2=\"38\" />\n", | |
| " <line x1=\"134\" y1=\"39\" x2=\"215\" y2=\"39\" />\n", | |
| " <line x1=\"135\" y1=\"40\" x2=\"217\" y2=\"40\" />\n", | |
| " <line x1=\"137\" y1=\"42\" x2=\"218\" y2=\"42\" />\n", | |
| " <line x1=\"138\" y1=\"43\" x2=\"219\" y2=\"43\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"138\" y2=\"43\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"176\" y1=\"0\" x2=\"219\" y2=\"43\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"95.0,0.0 176.53846153846155,0.0 219.97737556561086,43.438914027149316 138.4389140271493,43.438914027149316\" style=\"fill:#8B4903A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"138\" y1=\"43\" x2=\"219\" y2=\"43\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"138\" y1=\"163\" x2=\"219\" y2=\"163\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"138\" y1=\"43\" x2=\"138\" y2=\"163\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"219\" y1=\"43\" x2=\"219\" y2=\"163\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"138.4389140271493,43.438914027149316 219.97737556561086,43.438914027149316 219.97737556561086,163.4389140271493 138.4389140271493,163.4389140271493\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Text -->\n", | |
| " <text x=\"179.208145\" y=\"183.438914\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >212</text>\n", | |
| " <text x=\"239.977376\" y=\"103.438914\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(-90,239.977376,103.438914)\">312</text>\n", | |
| " <text x=\"106.719457\" y=\"161.719457\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,106.719457,161.719457)\">192</text>\n", | |
| "</svg>\n", | |
| " </td>\n", | |
| " </tr>\n", | |
| "</table>\n", | |
| " </div>\n", | |
| " " | |
| ], | |
| "text/plain": [ | |
| "ZarrNii(\n", | |
| " name='image', shape=(1, 192, 312, 212), dims=['c', 'z', 'y', 'x'],\n", | |
| " axes_order='ZYX', xyz_orientation='RPI',\n", | |
| " scale={'c': 1, 'z': 0.035216000000000004, 'y': 0.052, 'x': 0.052},\n", | |
| " dtype=uint16, chunksize=(1, 1, 312, 212)\n", | |
| ")" | |
| ] | |
| }, | |
| "execution_count": 2, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "img" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 3, | |
| "id": "0db711f8-4590-497a-9d85-de41b10b8df9", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "'iba.nii'" | |
| ] | |
| }, | |
| "execution_count": 3, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "img.to_nifti('iba.nii')" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 4, | |
| "id": "cd0b556a-eaa5-4b95-a4f1-211116a56742", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "atlas = ZarrNiiAtlas.from_files('/nfs/trident3/lightsheet/prado/mouse_app_lecanemab_ki3/derivatives/spimquant_aae813e/sub-AS134F3/micr/sub-AS134F3_sample-brain_acq-imaris4x_seg-all_from-ABAv3_level-5_desc-deform_dseg.nii.gz',\n", | |
| " '/nfs/trident3/lightsheet/prado/mouse_app_lecanemab_ki3/derivatives/spimquant_aae813e/tpl-ABAv3/seg-all_tpl-ABAv3_dseg.tsv')" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 5, | |
| "id": "256d2df7-8d4c-4105-816b-0c0ad2278e84", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/html": [ | |
| "\n", | |
| " <div style=\"margin-bottom: 10px;\">\n", | |
| " <strong>ZarrNii Object</strong>\n", | |
| " <table style=\"margin-left: 20px; border-collapse: collapse;\">\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>name:</strong></td><td style=\"padding: 2px;\">nifti_image_/nfs/trident3/lightsheet/prado/mouse_app_lecanemab_ki3/derivatives/spimquant_aae813e/sub-AS134F3/micr/sub-AS134F3_sample-brain_acq-imaris4x_seg-all_from-ABAv3_level-5_desc-deform_dseg.nii.gz</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>shape:</strong></td><td style=\"padding: 2px;\">(1, 212, 312, 192)</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>dims:</strong></td><td style=\"padding: 2px;\">['c', 'x', 'y', 'z']</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>axes_order:</strong></td><td style=\"padding: 2px;\">XYZ</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>xyz_orientation:</strong></td><td style=\"padding: 2px;\">RPI</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>scale:</strong></td><td style=\"padding: 2px;\">{'x': 0.052000001072883606, 'y': 0.052000001072883606, 'z': 0.03521599993109703}</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>dtype:</strong></td><td style=\"padding: 2px;\">float64</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>chunksize:</strong></td><td style=\"padding: 2px;\">(1, 212, 312, 192)</td></tr>\n", | |
| " </table>\n", | |
| " </div>\n", | |
| " \n", | |
| " <div style=\"margin-top: 10px;\">\n", | |
| " <strong>Dask Array:</strong>\n", | |
| " <table>\n", | |
| " <tr>\n", | |
| " <td>\n", | |
| " <table style=\"border-collapse: collapse;\">\n", | |
| " <thead>\n", | |
| " <tr>\n", | |
| " <td> </td>\n", | |
| " <th> Array </th>\n", | |
| " <th> Chunk </th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " \n", | |
| " <tr>\n", | |
| " <th> Bytes </th>\n", | |
| " <td> 96.89 MiB </td>\n", | |
| " <td> 96.89 MiB </td>\n", | |
| " </tr>\n", | |
| " \n", | |
| " <tr>\n", | |
| " <th> Shape </th>\n", | |
| " <td> (1, 212, 312, 192) </td>\n", | |
| " <td> (1, 212, 312, 192) </td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th> Dask graph </th>\n", | |
| " <td colspan=\"2\"> 1 chunks in 2 graph layers </td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th> Data type </th>\n", | |
| " <td colspan=\"2\"> float64 numpy.ndarray </td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| " </table>\n", | |
| " </td>\n", | |
| " <td>\n", | |
| " <svg width=\"361\" height=\"217\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"0\" y1=\"0\" x2=\"25\" y2=\"0\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"0\" y1=\"25\" x2=\"25\" y2=\"25\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"25\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"25\" y1=\"0\" x2=\"25\" y2=\"25\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"0.0,0.0 25.412616514582485,0.0 25.412616514582485,25.412616514582485 0.0,25.412616514582485\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Text -->\n", | |
| " <text x=\"12.706308\" y=\"45.412617\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >1</text>\n", | |
| " <text x=\"45.412617\" y=\"12.706308\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(0,45.412617,12.706308)\">1</text>\n", | |
| "\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"142\" y2=\"47\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"95\" y1=\"120\" x2=\"142\" y2=\"167\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"95\" y2=\"120\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"142\" y1=\"47\" x2=\"142\" y2=\"167\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"95.0,0.0 142.96380090497738,47.96380090497738 142.96380090497738,167.96380090497738 95.0,120.0\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"168\" y2=\"0\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"142\" y1=\"47\" x2=\"216\" y2=\"47\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"142\" y2=\"47\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"168\" y1=\"0\" x2=\"216\" y2=\"47\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"95.0,0.0 168.84615384615384,0.0 216.80995475113122,47.96380090497738 142.96380090497738,47.96380090497738\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"142\" y1=\"47\" x2=\"216\" y2=\"47\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"142\" y1=\"167\" x2=\"216\" y2=\"167\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"142\" y1=\"47\" x2=\"142\" y2=\"167\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"216\" y1=\"47\" x2=\"216\" y2=\"167\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"142.96380090497738,47.96380090497738 216.80995475113122,47.96380090497738 216.80995475113122,167.96380090497738 142.96380090497738,167.96380090497738\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Text -->\n", | |
| " <text x=\"179.886878\" y=\"187.963801\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >192</text>\n", | |
| " <text x=\"236.809955\" y=\"107.963801\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(-90,236.809955,107.963801)\">312</text>\n", | |
| " <text x=\"108.981900\" y=\"163.981900\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,108.981900,163.981900)\">212</text>\n", | |
| "</svg>\n", | |
| " </td>\n", | |
| " </tr>\n", | |
| "</table>\n", | |
| " </div>\n", | |
| " " | |
| ], | |
| "text/plain": [ | |
| "ZarrNiiAtlas(ngff_image=NgffImage(data=dask.array<getitem, shape=(1, 212, 312, 192), dtype=float64, chunksize=(1, 212, 312, 192), chunktype=numpy.ndarray>, dims=['c', 'x', 'y', 'z'], scale={'x': 0.052000001072883606, 'y': 0.052000001072883606, 'z': 0.03521599993109703}, translation={'x': -0.0, 'y': -0.0, 'z': 0.0}, name='nifti_image_/nfs/trident3/lightsheet/prado/mouse_app_lecanemab_ki3/derivatives/spimquant_aae813e/sub-AS134F3/micr/sub-AS134F3_sample-brain_acq-imaris4x_seg-all_from-ABAv3_level-5_desc-deform_dseg.nii.gz', axes_units=None, axes_orientations=None, computed_callbacks=[]), axes_order='XYZ', xyz_orientation='RPI', _omero=None, labels_df= index name abbreviation color\n", | |
| "0 0 left root root-L 000000\n", | |
| "1 1 left Basic cell groups and regions grey-L BFDAE3\n", | |
| "2 2 left Cerebrum CH-L B0F0FF\n", | |
| "3 3 left Cerebral cortex CTX-L B0FFB8\n", | |
| "4 4 left Cortical plate CTXpl-L 70FF70\n", | |
| "... ... ... ... ...\n", | |
| "2649 11322 right intraparafloccular fissure ipf-R A9A9AA\n", | |
| "2650 11323 right paramedian sulcus pms-R A9A9A9\n", | |
| "2651 11324 right parafloccular sulcus pfs-R AAAAA8\n", | |
| "2652 11325 right Interpeduncular fossa IPF-R A9A8A9\n", | |
| "2653 11326 right retina retina-R 7F2E7E\n", | |
| "\n", | |
| "[2654 rows x 4 columns], label_column='index', name_column='name', abbrev_column='abbreviation')" | |
| ] | |
| }, | |
| "execution_count": 5, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "atlas\n" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 6, | |
| "id": "2e8c7e85-b140-4802-9eea-3e8db42fcb1e", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "cropped = img.crop_with_bounding_box(*atlas.get_region_bounding_box(regex='Hipp'),ras_coords=True)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 7, | |
| "id": "f3e8eb06-c648-41af-9420-97798c6009ed", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/html": [ | |
| "\n", | |
| " <div style=\"margin-bottom: 10px;\">\n", | |
| " <strong>ZarrNii Object</strong>\n", | |
| " <table style=\"margin-left: 20px; border-collapse: collapse;\">\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>name:</strong></td><td style=\"padding: 2px;\">image</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>shape:</strong></td><td style=\"padding: 2px;\">(1, 144, 116, 158)</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>dims:</strong></td><td style=\"padding: 2px;\">['c', 'z', 'y', 'x']</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>axes_order:</strong></td><td style=\"padding: 2px;\">ZYX</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>xyz_orientation:</strong></td><td style=\"padding: 2px;\">RPI</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>scale:</strong></td><td style=\"padding: 2px;\">{'c': 1, 'z': 0.035216000000000004, 'y': 0.052, 'x': 0.052}</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>dtype:</strong></td><td style=\"padding: 2px;\">uint16</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>chunksize:</strong></td><td style=\"padding: 2px;\">(1, 1, 116, 158)</td></tr>\n", | |
| " </table>\n", | |
| " </div>\n", | |
| " \n", | |
| " <div style=\"margin-top: 10px;\">\n", | |
| " <strong>Dask Array:</strong>\n", | |
| " <table>\n", | |
| " <tr>\n", | |
| " <td>\n", | |
| " <table style=\"border-collapse: collapse;\">\n", | |
| " <thead>\n", | |
| " <tr>\n", | |
| " <td> </td>\n", | |
| " <th> Array </th>\n", | |
| " <th> Chunk </th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " \n", | |
| " <tr>\n", | |
| " <th> Bytes </th>\n", | |
| " <td> 5.03 MiB </td>\n", | |
| " <td> 35.80 kiB </td>\n", | |
| " </tr>\n", | |
| " \n", | |
| " <tr>\n", | |
| " <th> Shape </th>\n", | |
| " <td> (1, 144, 116, 158) </td>\n", | |
| " <td> (1, 1, 116, 158) </td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th> Dask graph </th>\n", | |
| " <td colspan=\"2\"> 144 chunks in 5 graph layers </td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th> Data type </th>\n", | |
| " <td colspan=\"2\"> uint16 numpy.ndarray </td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| " </table>\n", | |
| " </td>\n", | |
| " <td>\n", | |
| " <svg width=\"424\" height=\"202\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"0\" y1=\"0\" x2=\"25\" y2=\"0\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"0\" y1=\"25\" x2=\"25\" y2=\"25\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"25\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"25\" y1=\"0\" x2=\"25\" y2=\"25\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"0.0,0.0 25.412616514582485,0.0 25.412616514582485,25.412616514582485 0.0,25.412616514582485\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Text -->\n", | |
| " <text x=\"12.706308\" y=\"45.412617\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >1</text>\n", | |
| " <text x=\"45.412617\" y=\"12.706308\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(0,45.412617,12.706308)\">1</text>\n", | |
| "\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"159\" y2=\"64\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"95\" y1=\"88\" x2=\"159\" y2=\"152\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"95\" y2=\"88\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"96\" y1=\"1\" x2=\"96\" y2=\"89\" />\n", | |
| " <line x1=\"99\" y1=\"4\" x2=\"99\" y2=\"92\" />\n", | |
| " <line x1=\"100\" y1=\"5\" x2=\"100\" y2=\"93\" />\n", | |
| " <line x1=\"103\" y1=\"8\" x2=\"103\" y2=\"96\" />\n", | |
| " <line x1=\"104\" y1=\"9\" x2=\"104\" y2=\"97\" />\n", | |
| " <line x1=\"107\" y1=\"12\" x2=\"107\" y2=\"100\" />\n", | |
| " <line x1=\"108\" y1=\"13\" x2=\"108\" y2=\"101\" />\n", | |
| " <line x1=\"111\" y1=\"16\" x2=\"111\" y2=\"104\" />\n", | |
| " <line x1=\"112\" y1=\"17\" x2=\"112\" y2=\"105\" />\n", | |
| " <line x1=\"115\" y1=\"20\" x2=\"115\" y2=\"108\" />\n", | |
| " <line x1=\"116\" y1=\"21\" x2=\"116\" y2=\"109\" />\n", | |
| " <line x1=\"119\" y1=\"24\" x2=\"119\" y2=\"112\" />\n", | |
| " <line x1=\"120\" y1=\"25\" x2=\"120\" y2=\"114\" />\n", | |
| " <line x1=\"123\" y1=\"28\" x2=\"123\" y2=\"116\" />\n", | |
| " <line x1=\"124\" y1=\"29\" x2=\"124\" y2=\"118\" />\n", | |
| " <line x1=\"127\" y1=\"32\" x2=\"127\" y2=\"120\" />\n", | |
| " <line x1=\"128\" y1=\"33\" x2=\"128\" y2=\"122\" />\n", | |
| " <line x1=\"131\" y1=\"36\" x2=\"131\" y2=\"124\" />\n", | |
| " <line x1=\"132\" y1=\"37\" x2=\"132\" y2=\"126\" />\n", | |
| " <line x1=\"135\" y1=\"40\" x2=\"135\" y2=\"128\" />\n", | |
| " <line x1=\"136\" y1=\"41\" x2=\"136\" y2=\"130\" />\n", | |
| " <line x1=\"139\" y1=\"44\" x2=\"139\" y2=\"132\" />\n", | |
| " <line x1=\"141\" y1=\"46\" x2=\"141\" y2=\"134\" />\n", | |
| " <line x1=\"143\" y1=\"48\" x2=\"143\" y2=\"136\" />\n", | |
| " <line x1=\"145\" y1=\"50\" x2=\"145\" y2=\"138\" />\n", | |
| " <line x1=\"147\" y1=\"52\" x2=\"147\" y2=\"140\" />\n", | |
| " <line x1=\"149\" y1=\"54\" x2=\"149\" y2=\"142\" />\n", | |
| " <line x1=\"151\" y1=\"56\" x2=\"151\" y2=\"144\" />\n", | |
| " <line x1=\"153\" y1=\"58\" x2=\"153\" y2=\"146\" />\n", | |
| " <line x1=\"155\" y1=\"60\" x2=\"155\" y2=\"148\" />\n", | |
| " <line x1=\"157\" y1=\"62\" x2=\"157\" y2=\"150\" />\n", | |
| " <line x1=\"159\" y1=\"64\" x2=\"159\" y2=\"152\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"95.0,0.0 159.33358153387937,64.33358153387937 159.33358153387937,152.4348473566642 95.0,88.10126582278481\" style=\"fill:#8B4903A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"215\" y2=\"0\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"96\" y1=\"1\" x2=\"216\" y2=\"1\" />\n", | |
| " <line x1=\"99\" y1=\"4\" x2=\"219\" y2=\"4\" />\n", | |
| " <line x1=\"100\" y1=\"5\" x2=\"220\" y2=\"5\" />\n", | |
| " <line x1=\"103\" y1=\"8\" x2=\"223\" y2=\"8\" />\n", | |
| " <line x1=\"104\" y1=\"9\" x2=\"224\" y2=\"9\" />\n", | |
| " <line x1=\"107\" y1=\"12\" x2=\"227\" y2=\"12\" />\n", | |
| " <line x1=\"108\" y1=\"13\" x2=\"228\" y2=\"13\" />\n", | |
| " <line x1=\"111\" y1=\"16\" x2=\"231\" y2=\"16\" />\n", | |
| " <line x1=\"112\" y1=\"17\" x2=\"232\" y2=\"17\" />\n", | |
| " <line x1=\"115\" y1=\"20\" x2=\"235\" y2=\"20\" />\n", | |
| " <line x1=\"116\" y1=\"21\" x2=\"236\" y2=\"21\" />\n", | |
| " <line x1=\"119\" y1=\"24\" x2=\"239\" y2=\"24\" />\n", | |
| " <line x1=\"120\" y1=\"25\" x2=\"240\" y2=\"25\" />\n", | |
| " <line x1=\"123\" y1=\"28\" x2=\"243\" y2=\"28\" />\n", | |
| " <line x1=\"124\" y1=\"29\" x2=\"244\" y2=\"29\" />\n", | |
| " <line x1=\"127\" y1=\"32\" x2=\"247\" y2=\"32\" />\n", | |
| " <line x1=\"128\" y1=\"33\" x2=\"248\" y2=\"33\" />\n", | |
| " <line x1=\"131\" y1=\"36\" x2=\"251\" y2=\"36\" />\n", | |
| " <line x1=\"132\" y1=\"37\" x2=\"252\" y2=\"37\" />\n", | |
| " <line x1=\"135\" y1=\"40\" x2=\"255\" y2=\"40\" />\n", | |
| " <line x1=\"136\" y1=\"41\" x2=\"256\" y2=\"41\" />\n", | |
| " <line x1=\"139\" y1=\"44\" x2=\"259\" y2=\"44\" />\n", | |
| " <line x1=\"141\" y1=\"46\" x2=\"261\" y2=\"46\" />\n", | |
| " <line x1=\"143\" y1=\"48\" x2=\"263\" y2=\"48\" />\n", | |
| " <line x1=\"145\" y1=\"50\" x2=\"265\" y2=\"50\" />\n", | |
| " <line x1=\"147\" y1=\"52\" x2=\"267\" y2=\"52\" />\n", | |
| " <line x1=\"149\" y1=\"54\" x2=\"269\" y2=\"54\" />\n", | |
| " <line x1=\"151\" y1=\"56\" x2=\"271\" y2=\"56\" />\n", | |
| " <line x1=\"153\" y1=\"58\" x2=\"273\" y2=\"58\" />\n", | |
| " <line x1=\"155\" y1=\"60\" x2=\"275\" y2=\"60\" />\n", | |
| " <line x1=\"157\" y1=\"62\" x2=\"277\" y2=\"62\" />\n", | |
| " <line x1=\"159\" y1=\"64\" x2=\"279\" y2=\"64\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"159\" y2=\"64\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"215\" y1=\"0\" x2=\"279\" y2=\"64\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"95.0,0.0 215.0,0.0 279.3335815338794,64.33358153387937 159.33358153387937,64.33358153387937\" style=\"fill:#8B4903A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"159\" y1=\"64\" x2=\"279\" y2=\"64\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"159\" y1=\"152\" x2=\"279\" y2=\"152\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"159\" y1=\"64\" x2=\"159\" y2=\"152\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"279\" y1=\"64\" x2=\"279\" y2=\"152\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"159.33358153387937,64.33358153387937 279.3335815338794,64.33358153387937 279.3335815338794,152.4348473566642 159.33358153387937,152.4348473566642\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Text -->\n", | |
| " <text x=\"219.333582\" y=\"172.434847\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >158</text>\n", | |
| " <text x=\"299.333582\" y=\"108.384214\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(-90,299.333582,108.384214)\">116</text>\n", | |
| " <text x=\"117.166791\" y=\"140.268057\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,117.166791,140.268057)\">144</text>\n", | |
| "</svg>\n", | |
| " </td>\n", | |
| " </tr>\n", | |
| "</table>\n", | |
| " </div>\n", | |
| " " | |
| ], | |
| "text/plain": [ | |
| "ZarrNii(\n", | |
| " name='image', shape=(1, 144, 116, 158), dims=['c', 'z', 'y', 'x'],\n", | |
| " axes_order='ZYX', xyz_orientation='RPI',\n", | |
| " scale={'c': 1, 'z': 0.035216000000000004, 'y': 0.052, 'x': 0.052},\n", | |
| " dtype=uint16, chunksize=(1, 1, 116, 158)\n", | |
| ")" | |
| ] | |
| }, | |
| "execution_count": 7, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "cropped" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 8, | |
| "id": "36d0f991-7695-4cef-98e4-4a60d6a0001f", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "fullresimg = ZarrNii.from_ome_zarr('/nfs/trident3/lightsheet/prado/mouse_app_lecanemab_ki3/bids/sub-AS134F3/micr/sub-AS134F3_sample-brain_acq-imaris4x_SPIM.ome.zarr', channel_labels=['Iba1'],level=0)\n" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 9, | |
| "id": "8b4cd37c-6cf9-4de2-b0e9-9ad889e4370d", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "croppedfullres = fullresimg.crop_with_bounding_box(*atlas.get_region_bounding_box(regex='Left Hipp'),ras_coords=True)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 10, | |
| "id": "0cdc6e4d-a6fb-4b38-be5a-f961f7ac8ddf", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/html": [ | |
| "\n", | |
| " <div style=\"margin-bottom: 10px;\">\n", | |
| " <strong>ZarrNii Object</strong>\n", | |
| " <table style=\"margin-left: 20px; border-collapse: collapse;\">\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>name:</strong></td><td style=\"padding: 2px;\">image</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>shape:</strong></td><td style=\"padding: 2px;\">(1, 2096, 2496, 2368)</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>dims:</strong></td><td style=\"padding: 2px;\">['c', 'z', 'y', 'x']</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>axes_order:</strong></td><td style=\"padding: 2px;\">ZYX</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>xyz_orientation:</strong></td><td style=\"padding: 2px;\">RPI</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>scale:</strong></td><td style=\"padding: 2px;\">{'c': 1, 'z': 0.0022010000000000003, 'y': 0.001625, 'x': 0.001625}</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>dtype:</strong></td><td style=\"padding: 2px;\">uint16</td></tr>\n", | |
| " <tr><td style=\"padding: 2px;\"><strong>chunksize:</strong></td><td style=\"padding: 2px;\">(1, 1, 2496, 2368)</td></tr>\n", | |
| " </table>\n", | |
| " </div>\n", | |
| " \n", | |
| " <div style=\"margin-top: 10px;\">\n", | |
| " <strong>Dask Array:</strong>\n", | |
| " <table>\n", | |
| " <tr>\n", | |
| " <td>\n", | |
| " <table style=\"border-collapse: collapse;\">\n", | |
| " <thead>\n", | |
| " <tr>\n", | |
| " <td> </td>\n", | |
| " <th> Array </th>\n", | |
| " <th> Chunk </th>\n", | |
| " </tr>\n", | |
| " </thead>\n", | |
| " <tbody>\n", | |
| " \n", | |
| " <tr>\n", | |
| " <th> Bytes </th>\n", | |
| " <td> 23.08 GiB </td>\n", | |
| " <td> 11.27 MiB </td>\n", | |
| " </tr>\n", | |
| " \n", | |
| " <tr>\n", | |
| " <th> Shape </th>\n", | |
| " <td> (1, 2096, 2496, 2368) </td>\n", | |
| " <td> (1, 1, 2496, 2368) </td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th> Dask graph </th>\n", | |
| " <td colspan=\"2\"> 2096 chunks in 4 graph layers </td>\n", | |
| " </tr>\n", | |
| " <tr>\n", | |
| " <th> Data type </th>\n", | |
| " <td colspan=\"2\"> uint16 numpy.ndarray </td>\n", | |
| " </tr>\n", | |
| " </tbody>\n", | |
| " </table>\n", | |
| " </td>\n", | |
| " <td>\n", | |
| " <svg width=\"413\" height=\"229\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"0\" y1=\"0\" x2=\"25\" y2=\"0\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"0\" y1=\"25\" x2=\"25\" y2=\"25\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"25\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"25\" y1=\"0\" x2=\"25\" y2=\"25\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"0.0,0.0 25.412616514582485,0.0 25.412616514582485,25.412616514582485 0.0,25.412616514582485\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Text -->\n", | |
| " <text x=\"12.706308\" y=\"45.412617\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >1</text>\n", | |
| " <text x=\"45.412617\" y=\"12.706308\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(0,45.412617,12.706308)\">1</text>\n", | |
| "\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"154\" y2=\"59\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"95\" y1=\"120\" x2=\"154\" y2=\"179\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"95\" y2=\"120\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"96\" y1=\"1\" x2=\"96\" y2=\"121\" />\n", | |
| " <line x1=\"98\" y1=\"3\" x2=\"98\" y2=\"123\" />\n", | |
| " <line x1=\"100\" y1=\"5\" x2=\"100\" y2=\"125\" />\n", | |
| " <line x1=\"102\" y1=\"7\" x2=\"102\" y2=\"127\" />\n", | |
| " <line x1=\"104\" y1=\"9\" x2=\"104\" y2=\"129\" />\n", | |
| " <line x1=\"106\" y1=\"11\" x2=\"106\" y2=\"131\" />\n", | |
| " <line x1=\"107\" y1=\"12\" x2=\"107\" y2=\"132\" />\n", | |
| " <line x1=\"109\" y1=\"14\" x2=\"109\" y2=\"134\" />\n", | |
| " <line x1=\"111\" y1=\"16\" x2=\"111\" y2=\"136\" />\n", | |
| " <line x1=\"113\" y1=\"18\" x2=\"113\" y2=\"138\" />\n", | |
| " <line x1=\"115\" y1=\"20\" x2=\"115\" y2=\"140\" />\n", | |
| " <line x1=\"117\" y1=\"22\" x2=\"117\" y2=\"142\" />\n", | |
| " <line x1=\"119\" y1=\"24\" x2=\"119\" y2=\"144\" />\n", | |
| " <line x1=\"120\" y1=\"25\" x2=\"120\" y2=\"145\" />\n", | |
| " <line x1=\"122\" y1=\"27\" x2=\"122\" y2=\"147\" />\n", | |
| " <line x1=\"124\" y1=\"29\" x2=\"124\" y2=\"149\" />\n", | |
| " <line x1=\"126\" y1=\"31\" x2=\"126\" y2=\"151\" />\n", | |
| " <line x1=\"128\" y1=\"33\" x2=\"128\" y2=\"153\" />\n", | |
| " <line x1=\"130\" y1=\"35\" x2=\"130\" y2=\"155\" />\n", | |
| " <line x1=\"132\" y1=\"37\" x2=\"132\" y2=\"157\" />\n", | |
| " <line x1=\"133\" y1=\"38\" x2=\"133\" y2=\"158\" />\n", | |
| " <line x1=\"135\" y1=\"40\" x2=\"135\" y2=\"160\" />\n", | |
| " <line x1=\"137\" y1=\"42\" x2=\"137\" y2=\"162\" />\n", | |
| " <line x1=\"139\" y1=\"44\" x2=\"139\" y2=\"164\" />\n", | |
| " <line x1=\"141\" y1=\"46\" x2=\"141\" y2=\"166\" />\n", | |
| " <line x1=\"143\" y1=\"48\" x2=\"143\" y2=\"168\" />\n", | |
| " <line x1=\"145\" y1=\"50\" x2=\"145\" y2=\"170\" />\n", | |
| " <line x1=\"146\" y1=\"51\" x2=\"146\" y2=\"171\" />\n", | |
| " <line x1=\"148\" y1=\"53\" x2=\"148\" y2=\"173\" />\n", | |
| " <line x1=\"150\" y1=\"55\" x2=\"150\" y2=\"175\" />\n", | |
| " <line x1=\"152\" y1=\"57\" x2=\"152\" y2=\"177\" />\n", | |
| " <line x1=\"154\" y1=\"59\" x2=\"154\" y2=\"179\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"95.0,0.0 154.2760180995475,59.276018099547514 154.2760180995475,179.2760180995475 95.0,120.0\" style=\"fill:#8B4903A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"208\" y2=\"0\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"96\" y1=\"1\" x2=\"210\" y2=\"1\" />\n", | |
| " <line x1=\"98\" y1=\"3\" x2=\"212\" y2=\"3\" />\n", | |
| " <line x1=\"100\" y1=\"5\" x2=\"214\" y2=\"5\" />\n", | |
| " <line x1=\"102\" y1=\"7\" x2=\"216\" y2=\"7\" />\n", | |
| " <line x1=\"104\" y1=\"9\" x2=\"218\" y2=\"9\" />\n", | |
| " <line x1=\"106\" y1=\"11\" x2=\"219\" y2=\"11\" />\n", | |
| " <line x1=\"107\" y1=\"12\" x2=\"221\" y2=\"12\" />\n", | |
| " <line x1=\"109\" y1=\"14\" x2=\"223\" y2=\"14\" />\n", | |
| " <line x1=\"111\" y1=\"16\" x2=\"225\" y2=\"16\" />\n", | |
| " <line x1=\"113\" y1=\"18\" x2=\"227\" y2=\"18\" />\n", | |
| " <line x1=\"115\" y1=\"20\" x2=\"229\" y2=\"20\" />\n", | |
| " <line x1=\"117\" y1=\"22\" x2=\"231\" y2=\"22\" />\n", | |
| " <line x1=\"119\" y1=\"24\" x2=\"232\" y2=\"24\" />\n", | |
| " <line x1=\"120\" y1=\"25\" x2=\"234\" y2=\"25\" />\n", | |
| " <line x1=\"122\" y1=\"27\" x2=\"236\" y2=\"27\" />\n", | |
| " <line x1=\"124\" y1=\"29\" x2=\"238\" y2=\"29\" />\n", | |
| " <line x1=\"126\" y1=\"31\" x2=\"240\" y2=\"31\" />\n", | |
| " <line x1=\"128\" y1=\"33\" x2=\"242\" y2=\"33\" />\n", | |
| " <line x1=\"130\" y1=\"35\" x2=\"244\" y2=\"35\" />\n", | |
| " <line x1=\"132\" y1=\"37\" x2=\"245\" y2=\"37\" />\n", | |
| " <line x1=\"133\" y1=\"38\" x2=\"247\" y2=\"38\" />\n", | |
| " <line x1=\"135\" y1=\"40\" x2=\"249\" y2=\"40\" />\n", | |
| " <line x1=\"137\" y1=\"42\" x2=\"251\" y2=\"42\" />\n", | |
| " <line x1=\"139\" y1=\"44\" x2=\"253\" y2=\"44\" />\n", | |
| " <line x1=\"141\" y1=\"46\" x2=\"255\" y2=\"46\" />\n", | |
| " <line x1=\"143\" y1=\"48\" x2=\"257\" y2=\"48\" />\n", | |
| " <line x1=\"145\" y1=\"50\" x2=\"258\" y2=\"50\" />\n", | |
| " <line x1=\"146\" y1=\"51\" x2=\"260\" y2=\"51\" />\n", | |
| " <line x1=\"148\" y1=\"53\" x2=\"262\" y2=\"53\" />\n", | |
| " <line x1=\"150\" y1=\"55\" x2=\"264\" y2=\"55\" />\n", | |
| " <line x1=\"152\" y1=\"57\" x2=\"266\" y2=\"57\" />\n", | |
| " <line x1=\"154\" y1=\"59\" x2=\"268\" y2=\"59\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"95\" y1=\"0\" x2=\"154\" y2=\"59\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"208\" y1=\"0\" x2=\"268\" y2=\"59\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"95.0,0.0 208.84615384615387,0.0 268.1221719457014,59.276018099547514 154.2760180995475,59.276018099547514\" style=\"fill:#8B4903A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Horizontal lines -->\n", | |
| " <line x1=\"154\" y1=\"59\" x2=\"268\" y2=\"59\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"154\" y1=\"179\" x2=\"268\" y2=\"179\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Vertical lines -->\n", | |
| " <line x1=\"154\" y1=\"59\" x2=\"154\" y2=\"179\" style=\"stroke-width:2\" />\n", | |
| " <line x1=\"268\" y1=\"59\" x2=\"268\" y2=\"179\" style=\"stroke-width:2\" />\n", | |
| "\n", | |
| " <!-- Colored Rectangle -->\n", | |
| " <polygon points=\"154.2760180995475,59.276018099547514 268.1221719457014,59.276018099547514 268.1221719457014,179.2760180995475 154.2760180995475,179.2760180995475\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n", | |
| "\n", | |
| " <!-- Text -->\n", | |
| " <text x=\"211.199095\" y=\"199.276018\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >2368</text>\n", | |
| " <text x=\"288.122172\" y=\"119.276018\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(-90,288.122172,119.276018)\">2496</text>\n", | |
| " <text x=\"114.638009\" y=\"169.638009\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,114.638009,169.638009)\">2096</text>\n", | |
| "</svg>\n", | |
| " </td>\n", | |
| " </tr>\n", | |
| "</table>\n", | |
| " </div>\n", | |
| " " | |
| ], | |
| "text/plain": [ | |
| "ZarrNii(\n", | |
| " name='image', shape=(1, 2096, 2496, 2368), dims=['c', 'z', 'y', 'x'],\n", | |
| " axes_order='ZYX', xyz_orientation='RPI',\n", | |
| " scale={'c': 1, 'z': 0.0022010000000000003, 'y': 0.001625, 'x': 0.001625},\n", | |
| " dtype=uint16, chunksize=(1, 1, 2496, 2368)\n", | |
| ")" | |
| ] | |
| }, | |
| "execution_count": 10, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "croppedfullres" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 13, | |
| "id": "3cde61c1-844b-470e-9907-f663c7fb235e", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "[########################################] | 100% Completed | 202.25 ms\n", | |
| "[########################################] | 100% Completed | 202.07 ms\n", | |
| "[########################################] | 100% Completed | 204.44 ms\n", | |
| "[########################################] | 100% Completed | 202.75 ms\n", | |
| "[########################################] | 100% Completed | 22.72 s\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "from dask.diagnostics import ProgressBar\n", | |
| "\n", | |
| "with ProgressBar():\n", | |
| " ZarrNii.from_ome_zarr('/nfs/trident3/lightsheet/prado/mouse_app_lecanemab_ki3/bids/sub-AS134F3/micr/sub-AS134F3_sample-brain_acq-imaris4x_SPIM.ome.zarr', channel_labels=['Abeta'],level=2, downsample_near_isotropic=True).crop_with_bounding_box(*atlas.get_region_bounding_box(regex='Field CA1'),ras_coords=True).to_nifti('abeta_lhipp.nii')" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "id": "4847a7ce-1fee-4606-a3df-9e3ca9adf22b", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Python 3 (ipykernel)", | |
| "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.12.12" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 5 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment