{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import copy\n", "import sys\n", "\n", "import numpy as np\n", "from numpy.random import default_rng\n", "import pydicom\n", "\n", "import pymedphys\n", "from pymedphys._dicom import create" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Create two 100 × 100 × 100 dose grids with corresponding axes:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "WIDTH=100\n", "\n", "DOSE_GRID_SHAPE = (WIDTH, WIDTH, WIDTH)\n", "\n", "axes_ref = (\n", " np.arange(-DOSE_GRID_SHAPE[0]+1, DOSE_GRID_SHAPE[0], 2),\n", " np.arange(-DOSE_GRID_SHAPE[1]+1, DOSE_GRID_SHAPE[0], 2),\n", " np.arange(-DOSE_GRID_SHAPE[2]+1, DOSE_GRID_SHAPE[0], 2),\n", ")\n", "axes_eval = axes_ref\n", "\n", "rng = default_rng()\n", "\n", "dose_ref = rng.normal(loc=2, scale=0.04, size=DOSE_GRID_SHAPE) # 2% RSU\n", "dose_eval = rng.normal(loc=2, scale=0.04, size=DOSE_GRID_SHAPE)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Gamma" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "dose_percent_thresh = 2\n", "dist_mm_thresh = 2" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%time\n", "\n", "gamma = pymedphys.gamma(\n", " axes_ref, dose_ref, \n", " axes_eval, dose_eval, \n", " dose_percent_thresh, dist_mm_thresh, interpolator=\"scipy\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%time\n", "\n", "gamma = pymedphys.gamma(\n", " axes_ref, dose_ref, \n", " axes_eval, dose_eval, \n", " dose_percent_thresh, dist_mm_thresh, interpolator=\"econforge\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3.10.4 64-bit ('3.10.4')", "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.4" }, "vscode": { "interpreter": { "hash": "230eda8d05a12a922d797cf449b5880ef3cb2c4fc4c236520724aa1fd769a33d" } } }, "nbformat": 4, "nbformat_minor": 2 }