{"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":"!pip install -q zarr","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import os\nfrom glob import glob\n\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom matplotlib import animation, rc\n\nimport zarr","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# show functions","metadata":{}},{"cell_type":"code","source":"def create_animation(ims):\n    rc('animation', html='jshtml')\n    fig = plt.figure(figsize=(3, 3))\n    plt.axis('off')\n    im = plt.imshow(ims[0], cmap=\"gray\")\n    text = plt.text(0.05, 0.05, f'index {1}', transform=fig.transFigure, fontsize=16, color='darkblue')\n    def animate_func(i):\n        im.set_array(ims[i])\n        text.set_text(f'index {i+1}')  \n        return [im]\n    plt.close() \n    return animation.FuncAnimation(fig, animate_func, frames=len(ims), interval=1000//10)\n\ndef show_data_animation(data, data_dir_name=\"0\"):\n    images = data[data_dir_name]\n    return create_animation(images)","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"VOXEL = \"VoxelSpacing10.000\"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# ctdeconvolved","metadata":{}},{"cell_type":"code","source":"exp_runs_dir = \"/kaggle/input/czii-cryo-et-object-identification/train/static/ExperimentRuns/\"\ndata_name = \"isonetcorrected.zarr\"\n\nexp_dir_list = sorted(glob(os.path.join(exp_runs_dir, \"*\")))\nprint(exp_dir_list)","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"len(exp_dir_list)","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# TS_5_4","metadata":{}},{"cell_type":"code","source":"exp_dir = exp_dir_list[0]\ntarget_data_path = os.path.join(exp_dir, VOXEL, data_name)\nprint(target_data_path)\n\ntarget_store = zarr.open(target_data_path)\nprint(target_store.tree())\n\nshow_data_animation(target_store, data_dir_name=\"0\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"1\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"2\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# TS_69_2","metadata":{}},{"cell_type":"code","source":"exp_dir = exp_dir_list[1]\ntarget_data_path = os.path.join(exp_dir, VOXEL, data_name)\nprint(target_data_path)\n\ntarget_store = zarr.open(target_data_path)\nprint(target_store.tree())\n\nshow_data_animation(target_store, data_dir_name=\"0\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"1\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"2\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## TS_6_4","metadata":{}},{"cell_type":"code","source":"exp_dir = exp_dir_list[2]\ntarget_data_path = os.path.join(exp_dir, VOXEL, data_name)\nprint(target_data_path)\n\ntarget_store = zarr.open(target_data_path)\nprint(target_store.tree())\n\nshow_data_animation(target_store, data_dir_name=\"0\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"1\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"2\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# TS_6_6","metadata":{}},{"cell_type":"code","source":"exp_dir = exp_dir_list[3]\ntarget_data_path = os.path.join(exp_dir, VOXEL, data_name)\nprint(target_data_path)\n\ntarget_store = zarr.open(target_data_path)\nprint(target_store.tree())\n\nshow_data_animation(target_store, data_dir_name=\"0\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"1\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"2\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## TS_73_6","metadata":{}},{"cell_type":"code","source":"exp_dir = exp_dir_list[4]\ntarget_data_path = os.path.join(exp_dir, VOXEL, data_name)\nprint(target_data_path)\n\ntarget_store = zarr.open(target_data_path)\nprint(target_store.tree())\n\nshow_data_animation(target_store, data_dir_name=\"0\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"1\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"2\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# TS_86_3","metadata":{}},{"cell_type":"code","source":"exp_dir = exp_dir_list[5]\ntarget_data_path = os.path.join(exp_dir, VOXEL, data_name)\nprint(target_data_path)\n\ntarget_store = zarr.open(target_data_path)\nprint(target_store.tree())\n\nshow_data_animation(target_store, data_dir_name=\"0\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"1\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"2\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# TS_99_9","metadata":{}},{"cell_type":"code","source":"exp_dir = exp_dir_list[6]\ntarget_data_path = os.path.join(exp_dir, VOXEL, data_name)\nprint(target_data_path)\n\ntarget_store = zarr.open(target_data_path)\nprint(target_store.tree())\n\nshow_data_animation(target_store, data_dir_name=\"0\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"1\")","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"show_data_animation(target_store, data_dir_name=\"2\")","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}