Skip to content

Commit

Permalink
Update cmap function in example notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pchlap committed Aug 14, 2023
1 parent 9ee91b0 commit 5211145
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions examples/dvh_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
" !pip install platipy\n",
" import platipy\n",
"\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"import SimpleITK as sitk\n",
"\n",
Expand Down Expand Up @@ -103,7 +104,7 @@
"source": [
"vis = ImageVisualiser(ct_image, cut=get_com(structures[\"PTV60\"]))\n",
"\n",
"vis.add_scalar_overlay(dose, discrete_levels=20, colormap=plt.cm.get_cmap(\"inferno\"), name=\"Dose (Gy)\")\n",
"vis.add_scalar_overlay(dose, discrete_levels=20, colormap=matplotlib.colormaps.get_cmap(\"inferno\"), name=\"Dose (Gy)\")\n",
"vis.add_contour(structures)\n",
"\n",
"fig = vis.show()"
Expand Down Expand Up @@ -160,7 +161,7 @@
"\n",
"# Plot the DVH\n",
"fig, ax = plt.subplots()\n",
"plt_dvh.plot(ax=ax, kind=\"line\", colormap=plt.cm.get_cmap(\"rainbow\"), legend=False)\n",
"plt_dvh.plot(ax=ax, kind=\"line\", colormap=matplotlib.colormaps.get_cmap(\"rainbow\"), legend=False)\n",
"\n",
"# Add labels and show plot\n",
"plt.legend(loc='best')\n",
Expand Down Expand Up @@ -226,8 +227,8 @@
" d_cc_points=[10],\n",
" structure_for_limits=dose>5,\n",
" expansion_for_limits=40,\n",
" contour_cmap=plt.cm.get_cmap(\"rainbow\"),\n",
" dose_cmap=plt.cm.get_cmap(\"inferno\"),\n",
" contour_cmap=matplotlib.colormaps.get_cmap(\"rainbow\"),\n",
" dose_cmap=matplotlib.colormaps.get_cmap(\"inferno\"),\n",
" title=\"TCGA_CV_5977 Dose Metrics\")"
]
},
Expand Down
9 changes: 5 additions & 4 deletions examples/visualise.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
"# Function to grab some test data\n",
"from platipy.imaging.tests.data import get_lung_nifti\n",
"\n",
"# Usual suspects\n",
"# Import some common libraries which we need\n",
"import numpy as np\n",
"import SimpleITK as sitk\n",
"from pathlib import Path\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# Some utilities we use for generating interesting data\n",
Expand Down Expand Up @@ -153,7 +154,7 @@
"metadata": {},
"outputs": [],
"source": [
"image_visualiser = ImageVisualiser(ct_image, window=(-900, 1100), colormap=plt.cm.get_cmap(\"terrain\"), figure_size_in=6)\n",
"image_visualiser = ImageVisualiser(ct_image, window=(-900, 1100), colormap=matplotlib.colormaps.get_cmap(\"terrain\"), figure_size_in=6)\n",
"\n",
"image_visualiser.set_limits_from_label(contours[\"LUNG_L\"] + contours[\"LUNG_R\"])\n",
"\n",
Expand Down Expand Up @@ -238,7 +239,7 @@
"image_visualiser.add_vector_overlay(\n",
" dvf_expansion,\n",
" name=\"DVF magnitude [mm]\",\n",
" colormap=plt.cm.get_cmap(\"gnuplot2\"),\n",
" colormap=matplotlib.colormaps.get_cmap(\"gnuplot2\"),\n",
" alpha=0.75,\n",
" arrow_scale=1,\n",
" arrow_width=1,\n",
Expand Down Expand Up @@ -314,7 +315,7 @@
"image_visualiser.add_vector_overlay(\n",
" dvf_expansion,\n",
" name=\"DVF magnitude [mm]\",\n",
" colormap=plt.cm.get_cmap(\"gnuplot2\"),\n",
" colormap=matplotlib.colormaps.get_cmap(\"gnuplot2\"),\n",
" alpha=0.5,\n",
" arrow_scale=1,\n",
" arrow_width=1,\n",
Expand Down

0 comments on commit 5211145

Please sign in to comment.