{"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":"markdown","source":"# Introduction\nJust a quick first look at the data.  Open the first tomogram (Experiment TS_6_4) with zarr and plot the 2D images.","metadata":{}},{"cell_type":"code","source":"# Install zarr\n!pip install zarr","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:24:33.050268Z","iopub.execute_input":"2024-11-11T21:24:33.050727Z","iopub.status.idle":"2024-11-11T21:24:43.901616Z","shell.execute_reply.started":"2024-11-11T21:24:33.050681Z","shell.execute_reply":"2024-11-11T21:24:43.900395Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Imports\nimport json\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport zarr","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T22:12:39.857474Z","iopub.execute_input":"2024-11-11T22:12:39.857859Z","iopub.status.idle":"2024-11-11T22:12:39.863396Z","shell.execute_reply.started":"2024-11-11T22:12:39.857825Z","shell.execute_reply":"2024-11-11T22:12:39.861952Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Load the first zarr.\nz_ts_6_4 = zarr.open('/kaggle/input/czii-cryo-et-object-identification/test/static/ExperimentRuns/TS_6_4/VoxelSpacing10.000/denoised.zarr', mode='r')\nz_ts_6_4_iso = zarr.open('/kaggle/input/czii-cryo-et-object-identification/train/static/ExperimentRuns/TS_6_4/VoxelSpacing10.000/isonetcorrected.zarr', mode='r')\nz_ts_6_4_dcon = zarr.open('/kaggle/input/czii-cryo-et-object-identification/train/static/ExperimentRuns/TS_6_4/VoxelSpacing10.000/ctfdeconvolved.zarr', mode='r')\nz_ts_6_4_wbp = zarr.open('/kaggle/input/czii-cryo-et-object-identification/train/static/ExperimentRuns/TS_6_4/VoxelSpacing10.000/wbp.zarr', mode='r')\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-04T19:29:54.432613Z","iopub.execute_input":"2024-12-04T19:29:54.433033Z","iopub.status.idle":"2024-12-04T19:29:54.710697Z","shell.execute_reply.started":"2024-12-04T19:29:54.432992Z","shell.execute_reply":"2024-12-04T19:29:54.709330Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Load the first zarr.\nz_ts_6_4 = zarr.open('/kaggle/input/czii-cryo-et-object-identification/test/static/ExperimentRuns/TS_6_4/VoxelSpacing10.000/denoised.zarr', mode='r')\nz_ts_6_4_iso = zarr.open('/kaggle/input/czii-cryo-et-object-identification/train/static/ExperimentRuns/TS_6_4/VoxelSpacing10.000/isonetcorrected.zarr', mode='r')\nz_ts_6_4_dcon = zarr.open('/kaggle/input/czii-cryo-et-object-identification/train/static/ExperimentRuns/TS_6_4/VoxelSpacing10.000/ctfdeconvolved.zarr', mode='r')\nz_ts_6_4_wbp = zarr.open('/kaggle/input/czii-cryo-et-object-identification/train/static/ExperimentRuns/TS_6_4/VoxelSpacing10.000/wbp.zarr', mode='r')\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-04T19:30:11.775203Z","iopub.execute_input":"2024-12-04T19:30:11.775660Z","iopub.status.idle":"2024-12-04T19:30:11.800369Z","shell.execute_reply.started":"2024-12-04T19:30:11.775617Z","shell.execute_reply":"2024-12-04T19:30:11.799017Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(z_ts_6_4)\nprint(z_ts_6_4[0].shape)\nprint(z_ts_6_4[1].shape)\nprint(z_ts_6_4[2].shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:24:43.997441Z","iopub.execute_input":"2024-11-11T21:24:43.998153Z","iopub.status.idle":"2024-11-11T21:24:44.043329Z","shell.execute_reply.started":"2024-11-11T21:24:43.998078Z","shell.execute_reply":"2024-11-11T21:24:44.038729Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# High Resolution\nPlot the first image at 100 dpi.  Plot all 184 images in a grid after that.","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(6.3,6.3))\n_ = plt.imshow(z_ts_6_4[0][0])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:24:44.049892Z","iopub.execute_input":"2024-11-11T21:24:44.051084Z","iopub.status.idle":"2024-11-11T21:24:46.507356Z","shell.execute_reply.started":"2024-11-11T21:24:44.051019Z","shell.execute_reply":"2024-11-11T21:24:46.505921Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Plot the first 25 of...not sure what we're looking at yet.  :)\nfig = plt.figure(figsize=(10,74))\nfor i in range(184):\n    ax = plt.subplot(37, 5, i + 1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.imshow(z_ts_6_4[0][i])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:24:46.508714Z","iopub.execute_input":"2024-11-11T21:24:46.509158Z","iopub.status.idle":"2024-11-11T21:26:17.968601Z","shell.execute_reply.started":"2024-11-11T21:24:46.509113Z","shell.execute_reply":"2024-11-11T21:26:17.96697Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Medium Resolution\nPlot the first image at 100 dpi.  Plot all 92 images in a grid after that.","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(3.15,3.15))\n_ = plt.imshow(z_ts_6_4[1][0])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:17.970341Z","iopub.execute_input":"2024-11-11T21:26:17.970759Z","iopub.status.idle":"2024-11-11T21:26:18.754964Z","shell.execute_reply.started":"2024-11-11T21:26:17.970725Z","shell.execute_reply":"2024-11-11T21:26:18.753623Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,38))\nfor i in range(92):\n    ax = plt.subplot(19, 5, i + 1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.imshow(z_ts_6_4[1][i])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:18.75672Z","iopub.execute_input":"2024-11-11T21:26:18.757074Z","iopub.status.idle":"2024-11-11T21:26:36.446175Z","shell.execute_reply.started":"2024-11-11T21:26:18.757035Z","shell.execute_reply":"2024-11-11T21:26:36.444737Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Low Resolution\nPlot the first image at 100 dpi.  Plot all 46 images in a grid after that.","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(1.58,1.58))\n_ = plt.imshow(z_ts_6_4[2][0])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:36.448056Z","iopub.execute_input":"2024-11-11T21:26:36.448522Z","iopub.status.idle":"2024-11-11T21:26:36.682108Z","shell.execute_reply.started":"2024-11-11T21:26:36.448478Z","shell.execute_reply":"2024-11-11T21:26:36.680779Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,20))\nfor i in range(46):\n    ax = plt.subplot(10, 5, i + 1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.imshow(z_ts_6_4[2][i])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:36.683812Z","iopub.execute_input":"2024-11-11T21:26:36.685068Z","iopub.status.idle":"2024-11-11T21:26:40.683943Z","shell.execute_reply.started":"2024-11-11T21:26:36.685006Z","shell.execute_reply":"2024-11-11T21:26:40.682992Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Denoised, IsoNet Corrected, CTF Deconvolved, and Weighted Back Projection\n\nNext plot each of the different image types present in the training directories.  This time just one high resolution image each of the same layer.","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,10))\nax = plt.subplot(2, 2, 1)\nplt.xticks([])\nplt.yticks([])\nplt.title('Denoised')\nplt.imshow(z_ts_6_4[0][62], cmap='gray')\nax = plt.subplot(2, 2, 2)\nplt.xticks([])\nplt.yticks([])\nplt.title('IsoNet Corrected')\nplt.imshow(z_ts_6_4_iso[0][62], cmap='gray')\nax = plt.subplot(2, 2, 3)\nplt.xticks([])\nplt.yticks([])\nplt.title('CTF Deconvolved')\nplt.imshow(z_ts_6_4_dcon[0][62], cmap='gray')\nax = plt.subplot(2, 2, 4)\nplt.xticks([])\nplt.yticks([])\nplt.title('Weighted Back Projection')\n_ = plt.imshow(z_ts_6_4_wbp[0][62], cmap='gray')\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:44:57.757185Z","iopub.execute_input":"2024-11-11T21:44:57.758077Z","iopub.status.idle":"2024-11-11T21:45:00.136157Z","shell.execute_reply.started":"2024-11-11T21:44:57.758016Z","shell.execute_reply":"2024-11-11T21:45:00.1351Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Ribosome Identification\n\nNow that we can plot the images the next step is to try to identify structures of interest.  Lists of those structures for TS_6_4 are in the train/overlay directory.  We'll start with ribosomes.\n\nFind all of the ribosomes between 600 and 650 in the z-axis, and plot them on slide 62 to see if we get something reasonable.  If we do that suggests the origin is in the upper left in the x and y directions, and in the first image in the z direction.","metadata":{}},{"cell_type":"code","source":"ribosomes_x = []\nribosomes_y = []\nf = open('/kaggle/input/czii-cryo-et-object-identification/train/overlay/ExperimentRuns/TS_6_4/Picks/ribosome.json')\nfor p in json.loads(f.read())['points']:\n    z = float(p['location']['z'])\n    if z >= 600 and z < 650:\n        ribosomes_x.append(float(p['location']['x'])/10)\n        ribosomes_y.append(float(p['location']['y'])/10)\n        print(p['location'])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:40.685188Z","iopub.execute_input":"2024-11-11T21:26:40.685498Z","iopub.status.idle":"2024-11-11T21:26:40.709537Z","shell.execute_reply.started":"2024-11-11T21:26:40.685466Z","shell.execute_reply":"2024-11-11T21:26:40.708571Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Looking at the plotted images, we seem to have compelling matches.","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,5))\nax = plt.subplot(1, 2, 1)\nplt.xticks([])\nplt.yticks([])\nplt.imshow(z_ts_6_4[0][62], cmap='gray', vmin=-0.00005, vmax=0.00005)\nax = plt.subplot(1, 2, 2)\nplt.xticks([])\nplt.yticks([])\nplt.imshow(z_ts_6_4[0][62], cmap='gray', vmin=-0.00005, vmax=0.00005)\n_ = plt.scatter(ribosomes_x, ribosomes_y, edgecolor='red', facecolor='none')\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:40.710911Z","iopub.execute_input":"2024-11-11T21:26:40.711223Z","iopub.status.idle":"2024-11-11T21:26:41.704997Z","shell.execute_reply.started":"2024-11-11T21:26:40.711193Z","shell.execute_reply":"2024-11-11T21:26:41.703701Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Virus Identification\n\nRepeat the same process for viruses except with a different z-value.","metadata":{}},{"cell_type":"code","source":"virus_x = []\nvirus_y = []\nf = open('/kaggle/input/czii-cryo-et-object-identification/train/overlay/ExperimentRuns/TS_6_4/Picks/virus-like-particle.json')\nfor p in json.loads(f.read())['points']:\n    z = float(p['location']['z'])\n    if z >= 670 and z < 700:\n        virus_x.append(float(p['location']['x'])/10)\n        virus_y.append(float(p['location']['y'])/10)\n        print(p['location'])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:41.706569Z","iopub.execute_input":"2024-11-11T21:26:41.70709Z","iopub.status.idle":"2024-11-11T21:26:41.719371Z","shell.execute_reply.started":"2024-11-11T21:26:41.707038Z","shell.execute_reply":"2024-11-11T21:26:41.718191Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Good matches again.","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,5))\nax = plt.subplot(1, 2, 1)\nplt.xticks([])\nplt.yticks([])\nplt.imshow(z_ts_6_4[0][68], cmap='gray', vmin=-0.00005, vmax=0.00005)\nax = plt.subplot(1, 2, 2)\nplt.xticks([])\nplt.yticks([])\nplt.imshow(z_ts_6_4[0][68], cmap='gray', vmin=-0.00005, vmax=0.00005)\n_ = plt.scatter(virus_x, virus_y, edgecolor='red', facecolor='none')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:41.724292Z","iopub.execute_input":"2024-11-11T21:26:41.724773Z","iopub.status.idle":"2024-11-11T21:26:42.699084Z","shell.execute_reply.started":"2024-11-11T21:26:41.724738Z","shell.execute_reply":"2024-11-11T21:26:42.697885Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Apo-Ferritin Identification","metadata":{}},{"cell_type":"code","source":"apo_ferritin_x = []\napo_ferritin_y = []\nf = open('/kaggle/input/czii-cryo-et-object-identification/train/overlay/ExperimentRuns/TS_6_4/Picks/apo-ferritin.json')\nfor p in json.loads(f.read())['points']:\n    z = float(p['location']['z'])\n    if z >= 400 and z < 450:\n        apo_ferritin_x.append(float(p['location']['x'])/10)\n        apo_ferritin_y.append(float(p['location']['y'])/10)\n        print(p['location'])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:42.701073Z","iopub.execute_input":"2024-11-11T21:26:42.701603Z","iopub.status.idle":"2024-11-11T21:26:42.715966Z","shell.execute_reply.started":"2024-11-11T21:26:42.701549Z","shell.execute_reply":"2024-11-11T21:26:42.71452Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,5))\nax = plt.subplot(1, 2, 1)\nplt.xticks([])\nplt.yticks([])\nplt.imshow(z_ts_6_4[0][42], cmap='gray', vmin=-0.00005, vmax=0.00005)\nax = plt.subplot(1, 2, 2)\nplt.xticks([])\nplt.yticks([])\nplt.imshow(z_ts_6_4[0][42], cmap='gray', vmin=-0.00005, vmax=0.00005)\n_ = plt.scatter(apo_ferritin_x, apo_ferritin_y, edgecolor='red', facecolor='none')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:42.717551Z","iopub.execute_input":"2024-11-11T21:26:42.718044Z","iopub.status.idle":"2024-11-11T21:26:43.702915Z","shell.execute_reply.started":"2024-11-11T21:26:42.718002Z","shell.execute_reply":"2024-11-11T21:26:43.701572Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Beta-Galactosidase Identification","metadata":{}},{"cell_type":"code","source":"beta_galactosidase_x = []\nbeta_galactosidase_y = []\nf = open('/kaggle/input/czii-cryo-et-object-identification/train/overlay/ExperimentRuns/TS_6_4/Picks/beta-galactosidase.json')\nfor p in json.loads(f.read())['points']:\n    z = float(p['location']['z'])\n    if z >= 450 and z < 500:\n        beta_galactosidase_x.append(float(p['location']['x'])/10)\n        beta_galactosidase_y.append(float(p['location']['y'])/10)\n        print(p['location'])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:43.704292Z","iopub.execute_input":"2024-11-11T21:26:43.704638Z","iopub.status.idle":"2024-11-11T21:26:43.715569Z","shell.execute_reply.started":"2024-11-11T21:26:43.704607Z","shell.execute_reply":"2024-11-11T21:26:43.714701Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,5))\nax = plt.subplot(1, 2, 1)\nplt.xticks([])\nplt.yticks([])\nplt.imshow(z_ts_6_4[0][47], cmap='gray', vmin=-0.00005, vmax=0.00005)\nax = plt.subplot(1, 2, 2)\nplt.xticks([])\nplt.yticks([])\nplt.imshow(z_ts_6_4[0][47], cmap='gray', vmin=-0.00005, vmax=0.00005)\n_ = plt.scatter(beta_galactosidase_x, beta_galactosidase_y, edgecolor='red', facecolor='none')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:43.71708Z","iopub.execute_input":"2024-11-11T21:26:43.717517Z","iopub.status.idle":"2024-11-11T21:26:44.78181Z","shell.execute_reply.started":"2024-11-11T21:26:43.717439Z","shell.execute_reply":"2024-11-11T21:26:44.780747Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Thyroglobulin Identification","metadata":{}},{"cell_type":"code","source":"thyroglobulin_x = []\nthyroglobulin_y = []\nf = open('/kaggle/input/czii-cryo-et-object-identification/train/overlay/ExperimentRuns/TS_6_4/Picks/thyroglobulin.json')\nfor p in json.loads(f.read())['points']:\n    z = float(p['location']['z'])\n    if z >= 550 and z < 600:\n        thyroglobulin_x.append(float(p['location']['x'])/10)\n        thyroglobulin_y.append(float(p['location']['y'])/10)\n        print(p['location'])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:44.78336Z","iopub.execute_input":"2024-11-11T21:26:44.783701Z","iopub.status.idle":"2024-11-11T21:26:44.795999Z","shell.execute_reply.started":"2024-11-11T21:26:44.783632Z","shell.execute_reply":"2024-11-11T21:26:44.794532Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,5))\nax = plt.subplot(1, 2, 1)\nplt.xticks([])\nplt.yticks([])\nplt.imshow(z_ts_6_4[0][57], cmap='gray', vmin=-0.00005, vmax=0.00005)\nax = plt.subplot(1, 2, 2)\nplt.xticks([])\nplt.yticks([])\nplt.imshow(z_ts_6_4[0][57], cmap='gray', vmin=-0.00005, vmax=0.00005)\n_ = plt.scatter(thyroglobulin_x, thyroglobulin_y, edgecolor='red', facecolor='none')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T21:26:44.797042Z","iopub.execute_input":"2024-11-11T21:26:44.797343Z","iopub.status.idle":"2024-11-11T21:26:45.786495Z","shell.execute_reply.started":"2024-11-11T21:26:44.797312Z","shell.execute_reply":"2024-11-11T21:26:45.78505Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Ribosome Close-Up","metadata":{}},{"cell_type":"code","source":"# {'x': 5106.838, 'y': 4835.263, 'z': 619.225}\nfig = plt.figure(figsize=(10,2.5))\nax = plt.subplot(1, 4, 1)\nplt.xticks([])\nplt.yticks([])\nplt.title('Original')\nplt.imshow(z_ts_6_4[0][61], cmap='gray', vmin=-0.00005, vmax=0.00005)\n_ = plt.scatter([5106.838/10], [4835.263/10], edgecolor='red', facecolor='none')\nax = plt.subplot(1, 4, 2)\nplt.xticks([])\nplt.yticks([])\nplt.title('Straight On')\nplt.imshow(z_ts_6_4[0][61, 461:505, 488:532], cmap='gray')\nax = plt.subplot(1, 4, 3)\nplt.xticks([])\nplt.yticks([])\nplt.title('Side View')\nplt.imshow(np.transpose(z_ts_6_4[0], axes=(2,1,0))[510, 461:505, 39:83], cmap='gray')\nax = plt.subplot(1, 4, 4)\nplt.xticks([])\nplt.yticks([])\nplt.title('Top View')\n_ = plt.imshow(np.transpose(z_ts_6_4[0], axes=(1,0,2))[483, 39:83, 488:532], cmap='gray')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T22:32:41.179239Z","iopub.execute_input":"2024-11-11T22:32:41.179726Z","iopub.status.idle":"2024-11-11T22:32:43.080642Z","shell.execute_reply.started":"2024-11-11T22:32:41.179685Z","shell.execute_reply":"2024-11-11T22:32:43.078685Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Virus Close-Up","metadata":{}},{"cell_type":"code","source":"# {'x': 5580.108, 'y': 1240.86, 'z': 692.222}\nfig = plt.figure(figsize=(10,2.5))\nax = plt.subplot(1, 4, 1)\nplt.xticks([])\nplt.yticks([])\nplt.title('Original')\nplt.imshow(z_ts_6_4[0][69], cmap='gray', vmin=-0.00005, vmax=0.00005)\n_ = plt.scatter([5580.108/10], [1240.86/10], edgecolor='red', facecolor='none')\nax = plt.subplot(1, 4, 2)\nplt.xticks([])\nplt.yticks([])\nplt.title('Straight On')\nplt.imshow(z_ts_6_4[0][69, 102:146, 536:580], cmap='gray')\nax = plt.subplot(1, 4, 3)\nplt.xticks([])\nplt.yticks([])\nplt.title('Side View')\nplt.imshow(np.transpose(z_ts_6_4[0], axes=(2,1,0))[558, 102:146, 47:91], cmap='gray')\nax = plt.subplot(1, 4, 4)\nplt.xticks([])\nplt.yticks([])\nplt.title('Top View')\n_ = plt.imshow(np.transpose(z_ts_6_4[0], axes=(1,0,2))[124, 47:91, 536:580], cmap='gray')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T22:40:42.33733Z","iopub.execute_input":"2024-11-11T22:40:42.33781Z","iopub.status.idle":"2024-11-11T22:40:44.195758Z","shell.execute_reply.started":"2024-11-11T22:40:42.33777Z","shell.execute_reply":"2024-11-11T22:40:44.194701Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Apo-Ferritin Close-Up","metadata":{}},{"cell_type":"code","source":"# {'x': 1019.831, 'y': 1859.831, 'z': 400.424}\nfig = plt.figure(figsize=(10,2.5))\nax = plt.subplot(1, 4, 1)\nplt.xticks([])\nplt.yticks([])\nplt.title('Original')\nplt.imshow(z_ts_6_4[0][40], cmap='gray', vmin=-0.00005, vmax=0.00005)\n_ = plt.scatter([1019.831/10], [1859.831/10], edgecolor='red', facecolor='none')\nax = plt.subplot(1, 4, 2)\nplt.xticks([])\nplt.yticks([])\nplt.title('Straight On')\nplt.imshow(z_ts_6_4[0][40, 163:207, 79:123], cmap='gray')\nax = plt.subplot(1, 4, 3)\nplt.xticks([])\nplt.yticks([])\nplt.title('Side View')\nplt.imshow(np.transpose(z_ts_6_4[0], axes=(2,1,0))[101, 163:207, 18:62], cmap='gray')\nax = plt.subplot(1, 4, 4)\nplt.xticks([])\nplt.yticks([])\nplt.title('Top View')\n_ = plt.imshow(np.transpose(z_ts_6_4[0], axes=(1,0,2))[185, 18:62, 79:123], cmap='gray')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T23:00:07.043559Z","iopub.execute_input":"2024-11-11T23:00:07.044038Z","iopub.status.idle":"2024-11-11T23:00:08.812738Z","shell.execute_reply.started":"2024-11-11T23:00:07.043999Z","shell.execute_reply":"2024-11-11T23:00:08.811413Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Beta-Galactosidase Close-Up","metadata":{}},{"cell_type":"code","source":"# {'x': 804.615, 'y': 1977.846, 'z': 489.385}\nfig = plt.figure(figsize=(10,2.5))\nax = plt.subplot(1, 4, 1)\nplt.xticks([])\nplt.yticks([])\nplt.title('Original')\nplt.imshow(z_ts_6_4[0][48], cmap='gray', vmin=-0.00005, vmax=0.00005)\n_ = plt.scatter([804.615/10], [1977.846/10], edgecolor='red', facecolor='none')\nax = plt.subplot(1, 4, 2)\nplt.xticks([])\nplt.yticks([])\nplt.title('Straight On')\nplt.imshow(z_ts_6_4[0][48, 175:219, 58:102], cmap='gray')\nax = plt.subplot(1, 4, 3)\nplt.xticks([])\nplt.yticks([])\nplt.title('Side View')\nplt.imshow(np.transpose(z_ts_6_4[0], axes=(2,1,0))[80, 175:219, 26:70], cmap='gray')\nax = plt.subplot(1, 4, 4)\nplt.xticks([])\nplt.yticks([])\nplt.title('Top View')\n_ = plt.imshow(np.transpose(z_ts_6_4[0], axes=(1,0,2))[197, 26:70, 58:102], cmap='gray')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-12T00:19:00.782394Z","iopub.execute_input":"2024-11-12T00:19:00.782898Z","iopub.status.idle":"2024-11-12T00:19:02.678374Z","shell.execute_reply.started":"2024-11-12T00:19:00.782854Z","shell.execute_reply":"2024-11-12T00:19:02.673892Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Thyroglobulin Identification","metadata":{}},{"cell_type":"code","source":"# {'x': 1242.919, 'y': 1464.644, 'z': 581.353}\nfig = plt.figure(figsize=(10,2.5))\nax = plt.subplot(1, 4, 1)\nplt.xticks([])\nplt.yticks([])\nplt.title('Original')\nplt.imshow(z_ts_6_4[0][58], cmap='gray', vmin=-0.00005, vmax=0.00005)\n_ = plt.scatter([1242.919/10], [1464.644/10], edgecolor='red', facecolor='none')\nax = plt.subplot(1, 4, 2)\nplt.xticks([])\nplt.yticks([])\nplt.title('Straight On')\nplt.imshow(z_ts_6_4[0][58, 124:168, 102:146], cmap='gray')\nax = plt.subplot(1, 4, 3)\nplt.xticks([])\nplt.yticks([])\nplt.title('Side View')\nplt.imshow(np.transpose(z_ts_6_4[0], axes=(2,1,0))[124, 175:219, 36:80], cmap='gray')\nax = plt.subplot(1, 4, 4)\nplt.xticks([])\nplt.yticks([])\nplt.title('Top View')\n_ = plt.imshow(np.transpose(z_ts_6_4[0], axes=(1,0,2))[146, 36:80, 102:146], cmap='gray')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-12T00:22:36.98391Z","iopub.execute_input":"2024-11-12T00:22:36.984354Z","iopub.status.idle":"2024-11-12T00:22:38.835635Z","shell.execute_reply.started":"2024-11-12T00:22:36.984315Z","shell.execute_reply":"2024-11-12T00:22:38.834685Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Low Res from the Side","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,64))\nfor i in range(158):\n    ax = plt.subplot(18, 9, i + 1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.imshow(np.transpose(z_ts_6_4[2], axes=(2,1,0))[i])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T23:26:38.425569Z","iopub.execute_input":"2024-11-11T23:26:38.426015Z","iopub.status.idle":"2024-11-11T23:26:52.321763Z","shell.execute_reply.started":"2024-11-11T23:26:38.425977Z","shell.execute_reply":"2024-11-11T23:26:52.319299Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Low Res from the Top","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(10,64))\nfor i in range(158):\n    ax = plt.subplot(53, 3, i + 1)\n    plt.xticks([])\n    plt.yticks([])\n    plt.imshow(np.transpose(z_ts_6_4[2], axes=(1,0,2))[i])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-11T23:19:08.283045Z","iopub.execute_input":"2024-11-11T23:19:08.283428Z","iopub.status.idle":"2024-11-11T23:19:21.981036Z","shell.execute_reply.started":"2024-11-11T23:19:08.283387Z","shell.execute_reply":"2024-11-11T23:19:21.977705Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"# Conclusion\n\nThe mapping between the x, y, and z coordinates so far appears quite straightforward.  For the highest resolution images 10 units per pixel in all 3 directions with the origin in the first image in the upper left had corner seems to work.  The wikipedia article on cryoET suggests the sample is twisted when generating the images, but so far that hasn't seemed to create any complications here.  That said it might be worth identifying structures in \"worst-case\" locations to confirm that we didn't just get lucky.","metadata":{}}]}