pyskindose.plotting package

Submodules

pyskindose.plotting.create_dose_map_plot module

create_dose_map_plot(patient: Phantom, settings: PyskindoseSettings, dose_map: ndarray) None

Plot a map of the absorbed skindose upon the patient phantom.

This function creates and plots an offline plotly graph of the skin dose distribution on the phantom. The colorscale is mapped to the absorbed skin dose value. Only available for phantom type: “plane”, “cylinder” or “human.”

Parameters:
  • patient (Phantom) – patient phantom

  • settings (PyskindoseSettings) – Settings class for PySkinDose

  • dose_map (np.ndarray) – array with dose matrix, where each element is to be mapped to the corresponding skin cell of the patient.

pyskindose.plotting.create_geometry_plot module

create_geometry_plot(normalized_data: DataFrame, table: Phantom, pad: Phantom, settings: PyskindoseSettings) None

Create any of the geometry plots available in PySkinDose.

Parameters:
  • normalized_data (pd.DataFrame) – RDSR data, normalized for compliance with PySkinDose

  • table (Phantom) – Patient support table phantom

  • pad (Phantom) – Patient support pad phantom

  • settings (PyskindoseSettings) – Settings class for PySkinDose

pyskindose.plotting.create_geometry_plot_texts module

create_geometry_plot_texts(beam: Beam, table: Phantom, pad: Phantom, patient: Phantom | None = None) Tuple[List[str], List[str], List[str], List[str], List[str], List[str] | None]

Create lists text strings to show when hovering in geometry plots

Parameters:
  • beam (Beam) – Instance of the Beam class containing info needed for the X-ray source, beam and detector texts

  • table (Phantom) – Table phantom from instance of class Phantom. phantom_model must be “table”

  • pad (Phantom) – Pad phantom from instance of class Phantom. phantom_model must be “pad”

  • patient (Optional[Phantom]) – Patient phantom from instance of class Phantom. Can be of phantom_model “plane”, “cylinder” or “human”

pyskindose.plotting.create_irradiation_event_procedure_plot_data module

create_irradiation_event_procedure_plot_data(data_norm: DataFrame, include_patient: bool, visible_status: bool, event: int, table: Phantom, pad: Phantom, patient: Phantom | None = None) Dict[str, Scatter3d | Mesh3d]

pyskindose.plotting.create_layout_for_dose_map_plots module

create_layout_for_dose_map_plots(PLOT_MARGINS, PLOT_HEIGHT, PLOT_WIDTH, COLOR_PLOT_TEXT, COLOR_CANVAS)

pyskindose.plotting.create_mesh3d module

create_mesh_3d_general(obj: Phantom | Beam, color: str, mesh_text: List[str], opacity: float | None = None, mesh_name: str | None = None, lighting: Dict | None = None, detector_mesh: bool = False, visible_status: bool | None = True) Mesh3d

pyskindose.plotting.create_notebook_dose_map_plot module

create_notebook_dose_map_plot(names: List[Path])

pyskindose.plotting.create_plot_and_save_to_file module

create_plot_and_save_to_file(mode: str, data: List[Mesh3d | Scatter3d], layout: Layout)
Parameters:
  • mode

  • data

  • layout

Returns:

pyskindose.plotting.create_ploty_ijk_indices module

pyskindose.plotting.create_setup_and_event_plot module

create_setup_and_event_plot(patient: Phantom, table: Phantom, pad: Phantom, beam: Beam, mode: str, patient_text: List[str], source_text: List[str], table_text: List[str], detectors_text: List[str], pad_text: List[str], beam_text: List[str], title: str, dark_mode=True, notebook_mode: bool = False)

pyskindose.plotting.create_wireframes module

create_wireframes(beam: Beam, table: Phantom, pad: Phantom, line_width: int = 4, visible: bool = True)

Create wireframe versions of the mesh3d objects in plot_geometry.

The purpose of this function is to enhance the plot_geometry plot by adding wireframes.

Parameters:
  • beam (Beam) – X-ray beam, i.e. instance of class Beam. See beam_class for more info

  • table (Phantom) – Table phantom from instance of class Phantom. phantom_type must be “table”

  • pad (Phantom) – Table phantom from instance of class Phantom. phantom_type must be “pad”

  • line_width (int, optional) – Line width of the wireframes. Default value is 4.

  • visible (bool, optional) – Set the visibility of each of the wireframe traces

pyskindose.plotting.get_camera_view module

get_camera_view() Dict[str, Dict[str, float]]

pyskindose.plotting.get_visual_offset module

pyskindose.plotting.plot_event module

plot_event(mode: str, data_norm: DataFrame, event: int, patient: Phantom, table: Phantom, pad: Phantom, dark_mode: bool = True, notebook_mode: bool = False)

Visualize the geometry from a specific irradiation event.

This function plots an irradiation event with the patient, table, pad, and beam positioned according to the irradiation event specified by the parameter event

Parameters:
  • mode (str) – The function will only run if this is set to “plot_event”.

  • data_norm (pd.DataFrame) – Table containing dicom RDSR information from each irradiation event. See rdsr_normalizer.py for more information.

  • event (int, optional) – choose specific irradiation event if mode “plot_event” are used. Default is 0, in which the first irradiation event is considered.

  • patient (Phantom) – Patient phantom from instance of class Phantom. Can be of phantom_model “plane”, “cylinder” or “human”

  • table (Phantom) – Table phantom from instance of class Phantom. phantom_model must be “table”

  • pad (Phantom) – Pad phantom from instance of class Phantom. phantom_model must be “pad”

  • dark_mode (bool, optional) – Set dark mode for plot, default is True

  • notebook_mode (bool, optional) – optimize plot size for notebooks, default is False.

pyskindose.plotting.plot_geometry module

plot_geometry(patient: Phantom, table: Phantom, pad: Phantom, data_norm: DataFrame, mode: str, event: int = 0, dark_mode: bool = True, notebook_mode: bool = False, include_patient: bool = False) None

Visualize the geometry from the irradiation events.

This function plots the phantom, table, pad, beam and detector. The type of plot is specified in the parameter mode.

Parameters:
  • patient (Phantom) – Patient phantom from instance of class Phantom. Can be of phantom_model “plane”, “cylinder” or “human”

  • table (Phantom) – Table phantom from instance of class Phantom. phantom_model must be “table”

  • pad (Phantom) – Pad phantom from instance of class Phantom. phantom_model must be “pad”

  • data_norm (pd.DataFrame) – Table containing dicom RDSR information from each irradiation event. See rdsr_normalizer.py for more information.

  • mode (str) –

    Choose between “plot_setup”, “plot_event” and “plot_procedure”.

    ”plot_setup” plots the patient, table and pad in reference position together with the X-ray system with zero angulation. This is a debugging feature

    ”plot_event” plots a specific irradiation event, in which the patient, table, pad, and beam are positioned according to the irradiation event specified by the parameter event

    ”plot_procedure” plots out the X-ray system, table and pad for all irradiation events in the procedure The visible event are chosen by a event slider

  • event (int, optional) – choose specific irradiation event if mode “plot_event” are used. Default is 0, in which the first irradiation event is considered.

  • dark_mode (bool, optional) – set dark mode for plots

  • notebook_mode (bool, optional) – optimize plot size for notebooks, default is True.

  • include_patient (bool, optional) – Choose if the patient phantom should be included in the plot_procedure function. WARNING, very heavy on memory. Default is False.

pyskindose.plotting.plot_procedure module

plot_procedure(mode: str, data_norm: DataFrame, table: Phantom, pad: Phantom, include_patient: bool, patient: Phantom | None = None, dark_mode: bool = True, notebook_mode: bool = False)

Create plot_procedure plot.

Parameters:
  • mode (str) – The function will only run if this is set to “plot_procedure”.

  • data_norm (pd.DataFrame) – RDSR data, normalized for compliance with PySkinDose.

  • table (Phantom) – Patient support table phantom

  • pad (Phantom) – Patient support pad phantom

  • include_patient (bool) – Choose if the patient phantom should be included

  • patient (Optional[Phantom], optional) – patient phantom, by default None

  • dark_mode (bool, optional) – set dark mode for plots, by default True

  • notebook_mode (bool, optional) – optimize plot size for notebooks, default is True.

Raises:

IOError – Raises error if patient not provided when include_patient = True

pyskindose.plotting.plot_settings module

fetch_plot_colors(dark_mode: bool)

Fetch correct colors scheme for plotly plots.

Parameters:

dark_mode (bool) – Specifies whether dark mode should be implemented

fetch_plot_margin(notebook_mode: bool)

Fetch correct margins for plotly plots.

Parameters:

notebook_mode (bool) – Specifies whether plot margins should be optimized for notebooks

fetch_plot_size(notebook_mode: bool)

Fetch correct plot size for plotly plots.

Parameters:

notebook_mode (bool) – specifies whether plot size should be optimized for notebooks

fetch_slider_colors(dark_mode: bool)

Fetch correct colors scheme for plotly sliders.

Parameters:

dark_mode (bool) – Specifies whether dark mode should be implemented

fetch_slider_padding(notebook_mode: bool)

Fetch correct slider margins for plot procedure.

Parameters:

notebook_mode (bool) – Specifies whether the slider padding should be optimized for notebooks

pyskindose.plotting.plot_setup module

plot_setup(mode: str, data_norm: DataFrame, patient: Phantom, table: Phantom, pad: Phantom, dark_mode: bool = True, notebook_mode: bool = False)

Debugging feature for visualizing the geometry setup.

This function plots the patient, table and pad in reference position together with the X-ray system with zero angulation.

Parameters:
  • mode (str) – The function will only run if this is set to “plot_setup”.

  • data_norm (pd.DataFrame) – Table containing dicom RDSR information from each irradiation event. See rdsr_normalizer.py for more information.

  • patient (Phantom) – Patient phantom from instance of class Phantom. Can be of phantom_model “plane”, “cylinder” or “human”

  • table (Phantom) – Table phantom from instance of class Phantom. phantom_model must be “table”

  • pad (Phantom) – Pad phantom from instance of class Phantom. phantom_model must be “pad”

  • dark_mode (bool, optional) – set dark mode for plot

  • notebook_mode (bool, optional) – optimize plot size for notebooks, default is True.

Module contents