Dose#

Dose Volume Histograms (DVH)#

platipy.imaging.dose.dvh.calculate_d_cc_x(dvh, x, label=None)#

Compute the dose which is received by cc of the volume

Parameters:
  • dvh (pandas.DataFrame) – DVH DataFrame as produced by calculate_dvh_for_labels

  • x (float|list) – The cc (or list of cc’s) to compute the dose at.

  • label (str, optional) – The label to compute the metric for. Computes for all metrics if not set. Defaults to None.

Returns:

Data frame with a row for each label containing the metric and value.

Return type:

pandas.DataFrame

platipy.imaging.dose.dvh.calculate_d_x(dvh, x, label=None)#

Calculate the dose which x percent of the volume receives

Parameters:
  • dvh (pandas.DataFrame) – DVH DataFrame as produced by calculate_dvh_for_labels

  • x (float|list) – The dose threshold (or list of dose thresholds) which x percent of the volume receives

  • label (str, optional) – The label to compute the metric for. Computes for all metrics if not set. Defaults to None.

Returns:

Data frame with a row for each label containing the metric and value.

Return type:

pandas.DataFrame

platipy.imaging.dose.dvh.calculate_dvh(dose_grid, label, bins=1001)#

Calculates a dose-volume histogram

Parameters:
  • dose_grid (SimpleITK.Image) – The dose grid.

  • label (SimpleITK.Image) – The (binary) label defining a structure.

  • bins (int | list | np.ndarray, optional) – Passed to np.histogram, can be an int (number of bins), or a list (specifying bin edges). Defaults to 1001.

Returns:

The points of the dose bins values (numpy.ndarray): The DVH values

Return type:

bins (numpy.ndarray)

platipy.imaging.dose.dvh.calculate_dvh_for_labels(dose_grid, labels, bin_width=0.1, max_dose=None)#

Calculate the DVH for multiple labels

Parameters:
  • dose_grid (SimpleITK.Image) – Dose grid

  • labels (dict) – Dictionary of labels with the label name as key and SimpleITK.Image mask as value.

  • bin_width (float, optional) – The width of each bin of the DVH (Gy). Defaults to 0.1.

  • max_dose (float, optional) – The maximum dose of the DVH. If not set then maximum dose from dose grid is used.Defaults to None.

Returns:

The DVH for each structure along with the mean dose and size in cubic

centimetres as a data frame.

Return type:

pandas.DataFrame

platipy.imaging.dose.dvh.calculate_v_x(dvh, x, label=None)#

Get the volume (in cc) which receives x dose

Parameters:
  • dvh (pandas.DataFrame) – DVH DataFrame as produced by calculate_dvh_for_labels

  • x (float|list) – The dose threshold (or list of dose thresholds) to get the volume for.

  • label (str, optional) – The label to compute the metric for. Computes for all metrics if not set. Defaults to None.

Returns:

Data frame with a row for each label containing the metric and value.

Return type:

pandas.DataFrame