{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.14","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":84969,"databundleVersionId":10033515,"sourceType":"competition"}],"dockerImageVersionId":30786,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"","metadata":{},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\nimport os","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-11-29T22:27:29.268619Z","iopub.execute_input":"2024-11-29T22:27:29.268997Z","iopub.status.idle":"2024-11-29T22:27:30.626153Z","shell.execute_reply.started":"2024-11-29T22:27:29.268961Z","shell.execute_reply":"2024-11-29T22:27:30.624913Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip list","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:27:30.628105Z","iopub.execute_input":"2024-11-29T22:27:30.628668Z","iopub.status.idle":"2024-11-29T22:27:35.434373Z","shell.execute_reply.started":"2024-11-29T22:27:30.628629Z","shell.execute_reply":"2024-11-29T22:27:35.433293Z"},"trusted":true,"collapsed":true,"jupyter":{"outputs_hidden":true}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!mkdir zarr-package","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-29T22:28:29.183508Z","iopub.execute_input":"2024-11-29T22:28:29.183956Z","iopub.status.idle":"2024-11-29T22:28:30.357079Z","shell.execute_reply.started":"2024-11-29T22:28:29.183917Z","shell.execute_reply":"2024-11-29T22:28:30.355683Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!ls","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-29T22:28:30.360029Z","iopub.execute_input":"2024-11-29T22:28:30.360580Z","iopub.status.idle":"2024-11-29T22:28:31.531843Z","shell.execute_reply.started":"2024-11-29T22:28:30.360523Z","shell.execute_reply":"2024-11-29T22:28:31.530439Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip download zarr numpy==1.26.4 -d ./zarr-package","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:28:31.533697Z","iopub.execute_input":"2024-11-29T22:28:31.534085Z","iopub.status.idle":"2024-11-29T22:28:36.051968Z","shell.execute_reply.started":"2024-11-29T22:28:31.534045Z","shell.execute_reply":"2024-11-29T22:28:36.050235Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"!pip install ./zarr-package/*.whl --find-links=./zarr-package","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:28:36.055148Z","iopub.execute_input":"2024-11-29T22:28:36.055599Z","iopub.status.idle":"2024-11-29T22:28:49.192352Z","shell.execute_reply.started":"2024-11-29T22:28:36.055559Z","shell.execute_reply":"2024-11-29T22:28:49.191007Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import zarr","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:29:20.102049Z","iopub.execute_input":"2024-11-29T22:29:20.102475Z","iopub.status.idle":"2024-11-29T22:29:20.107576Z","shell.execute_reply.started":"2024-11-29T22:29:20.102425Z","shell.execute_reply":"2024-11-29T22:29:20.106367Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"zstore_ts_5_4 = zarr.open(\"/kaggle/input/czii-cryo-et-object-identification/train/static/ExperimentRuns/TS_5_4/VoxelSpacing10.000/wbp.zarr\", mode='r')","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:29:22.733360Z","iopub.execute_input":"2024-11-29T22:29:22.733812Z","iopub.status.idle":"2024-11-29T22:29:22.743477Z","shell.execute_reply.started":"2024-11-29T22:29:22.733775Z","shell.execute_reply":"2024-11-29T22:29:22.742279Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"type(zstore_ts_5_4)","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:29:35.359400Z","iopub.execute_input":"2024-11-29T22:29:35.359885Z","iopub.status.idle":"2024-11-29T22:29:35.368146Z","shell.execute_reply.started":"2024-11-29T22:29:35.359850Z","shell.execute_reply":"2024-11-29T22:29:35.366986Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{},"outputs":[],"execution_count":null},{"cell_type":"code","source":"data0 = zstore_ts_5_4[0][:]","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:29:57.206464Z","iopub.execute_input":"2024-11-29T22:29:57.206915Z","iopub.status.idle":"2024-11-29T22:29:57.993339Z","shell.execute_reply.started":"2024-11-29T22:29:57.206877Z","shell.execute_reply":"2024-11-29T22:29:57.992339Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"data0.shape","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:29:57.996838Z","iopub.execute_input":"2024-11-29T22:29:57.997784Z","iopub.status.idle":"2024-11-29T22:29:58.005752Z","shell.execute_reply.started":"2024-11-29T22:29:57.997730Z","shell.execute_reply":"2024-11-29T22:29:58.004523Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:29:59.164972Z","iopub.execute_input":"2024-11-29T22:29:59.165378Z","iopub.status.idle":"2024-11-29T22:29:59.170268Z","shell.execute_reply.started":"2024-11-29T22:29:59.165343Z","shell.execute_reply":"2024-11-29T22:29:59.169214Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.imshow(data0[184//2,:,:], cmap='gray')","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:29:59.653557Z","iopub.execute_input":"2024-11-29T22:29:59.653948Z","iopub.status.idle":"2024-11-29T22:30:00.094167Z","shell.execute_reply.started":"2024-11-29T22:29:59.653913Z","shell.execute_reply":"2024-11-29T22:30:00.092972Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(data0.max())\nprint(data0.min())","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:30:00.837794Z","iopub.execute_input":"2024-11-29T22:30:00.838191Z","iopub.status.idle":"2024-11-29T22:30:00.902675Z","shell.execute_reply.started":"2024-11-29T22:30:00.838157Z","shell.execute_reply":"2024-11-29T22:30:00.901603Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"data1 = zstore_ts_5_4[1][:]\nplt.imshow(data1[92//2,:,:], cmap='gray')","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:30:01.445440Z","iopub.execute_input":"2024-11-29T22:30:01.445865Z","iopub.status.idle":"2024-11-29T22:30:02.830632Z","shell.execute_reply.started":"2024-11-29T22:30:01.445820Z","shell.execute_reply":"2024-11-29T22:30:02.829608Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from ipywidgets import interact\nimport ipywidgets as widgets","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:30:04.197315Z","iopub.execute_input":"2024-11-29T22:30:04.198149Z","iopub.status.idle":"2024-11-29T22:30:04.289869Z","shell.execute_reply.started":"2024-11-29T22:30:04.198105Z","shell.execute_reply":"2024-11-29T22:30:04.288819Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig,ax = plt.subplots()\n\nax_interactive = ax.imshow(data0[20,:,:])\n\nix = 0\n\ndef update_slice(z):\n    ax_interactive.set_data(data0[z,:,:])\n    #ax.relim() # Recalculate the limits ax.autoscale_view() # Autoscale the view\n    #ax.autoscale_view() # Autoscale the view fig.canvas.draw_idle() # Redraw the canvas\n    fig.canvas.draw_idle() # Redraw the canvas\n    #print(z)\n    \ninteract(update_slice, z = widgets.IntSlider(value=20, min=0, max=data0.shape[0]-1,step=1 ))","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:30:05.910595Z","iopub.execute_input":"2024-11-29T22:30:05.910963Z","iopub.status.idle":"2024-11-29T22:30:06.346793Z","shell.execute_reply.started":"2024-11-29T22:30:05.910931Z","shell.execute_reply":"2024-11-29T22:30:06.345380Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"def update_slice(z):\n    fig1,ax1 = plt.subplots()\n    slice0 = data0[z,:,:]\n    ax1.imshow(slice0, vmax=slice0.max(), vmin=slice0.min(), cmap='gray')\n    \ninteract(update_slice, z = widgets.IntSlider(value=20, min=0, max=data0.shape[0]-1,step=1 ))","metadata":{"execution":{"iopub.status.busy":"2024-11-29T22:30:11.037955Z","iopub.execute_input":"2024-11-29T22:30:11.038359Z","iopub.status.idle":"2024-11-29T22:30:11.400584Z","shell.execute_reply.started":"2024-11-29T22:30:11.038322Z","shell.execute_reply":"2024-11-29T22:30:11.399440Z"},"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{},"outputs":[],"execution_count":null},{"cell_type":"code","source":"","metadata":{},"outputs":[],"execution_count":null}]}