{"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 zarr","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-13T16:24:08.525135Z","iopub.execute_input":"2024-11-13T16:24:08.525766Z","iopub.status.idle":"2024-11-13T16:24:22.790047Z","shell.execute_reply.started":"2024-11-13T16:24:08.525693Z","shell.execute_reply":"2024-11-13T16:24:22.788461Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import zarr\n\nzarr_path = '/kaggle/input/czii-cryo-et-object-identification/train/static/ExperimentRuns/TS_5_4/VoxelSpacing10.000/isonetcorrected.zarr'\nzarr_data = zarr.open(zarr_path, mode='r')\n\n# Display the Zarr structure to identify available datasets\nprint(zarr_data.tree())\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-13T16:01:51.952984Z","iopub.execute_input":"2024-11-13T16:01:51.953487Z","iopub.status.idle":"2024-11-13T16:01:51.971798Z","shell.execute_reply.started":"2024-11-13T16:01:51.953441Z","shell.execute_reply":"2024-11-13T16:01:51.970566Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import zarr\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n# Path to your Zarr directory\n\nzarr_data = zarr.open(zarr_path, mode='r')\n\n# Specify the dataset name you want to work with\ndataset_name = '1'  # Change to '1' or '2' to view other datasets\n\n# Load the selected dataset\narray_data = zarr_data[dataset_name][:]\n\n# Iterate through each slice in the selected dataset\nfor i in range(array_data.shape[0]):  # array_data.shape[0] is the number of slices\n    single_slice = array_data[i]  # Select the i-th slice\n    \n    # Normalize the slice for display\n    normalized_slice = (single_slice - np.min(single_slice)) / (np.max(single_slice) - np.min(single_slice)) * 255\n    normalized_slice = normalized_slice.astype(np.uint8)\n    \n    # Display the slice\n    plt.figure(figsize=(6, 6))\n    plt.imshow(normalized_slice, cmap='gray')\n    plt.title(f\"Dataset {dataset_name} - Slice {i + 1}\")\n    plt.axis('off')\n    plt.show()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-13T16:01:54.237933Z","iopub.execute_input":"2024-11-13T16:01:54.238695Z","iopub.status.idle":"2024-11-13T16:02:07.073051Z","shell.execute_reply.started":"2024-11-13T16:01:54.238615Z","shell.execute_reply":"2024-11-13T16:02:07.071083Z"}},"outputs":[],"execution_count":null}]}