{ "cells": [ { "cell_type": "markdown", "id": "f79ab52a", "metadata": {}, "source": [ "# Simple sinogram check\n", "author: Felipe Delestro (fima@dtu.dk)" ] }, { "cell_type": "code", "execution_count": 1, "id": "b5096870", "metadata": {}, "outputs": [], "source": [ "import qim3d\n", "import matplotlib.pyplot as plt\n", "import ipywidgets" ] }, { "cell_type": "code", "execution_count": 2, "id": "6b9a1f66", "metadata": {}, "outputs": [], "source": [ "vol = qim3d.io.load(\"../resources/img3d/small_foram.h5\", dataset_name=\"exchange/data\")" ] }, { "cell_type": "code", "execution_count": 46, "id": "99832d5a", "metadata": {}, "outputs": [], "source": [ "def plot_sinogram(vol, zpos, ypos):\n", " fig, axs = plt.subplots(nrows=1, ncols=2, figsize=(8,10), sharey=True)\n", " \n", " axs[0].imshow(vol[zpos,:,:])\n", " axs[0].axhline(ypos, color=\"#FF6633\")\n", " axs[0].axis(\"off\")\n", " \n", " axs[1].imshow(vol[:,ypos,:])\n", " axs[1].axis(\"off\")\n", " \n", " plt.show()" ] }, { "cell_type": "code", "execution_count": 47, "id": "0395e573", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b920afa7cc3b47d99cc824b3afad9589", "version_major": 2, "version_minor": 0 }, "text/plain": [ "interactive(children=(IntSlider(value=360, description='zpos', max=720), IntSlider(value=130, description='ypo…" ] }, "execution_count": 47, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ipywidgets.interactive(plot_sinogram,\n", " vol = ipywidgets.fixed(vol),\n", " zpos = ipywidgets.IntSlider(min=0, max=vol.shape[0]-1, value=int(vol.shape[0]/2)),\n", " ypos = ipywidgets.IntSlider(min=0, max=vol.shape[1]-1, value=int(vol.shape[1]/2)))" ] } ], "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.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }