opentps.core.processing.doseCalculation namespace

Subpackages

Submodules

opentps.core.processing.doseCalculation.abstractDoseCalculator module

class AbstractDoseCalculator

Bases: object

Abstract class for dose calculation

property beamModel
abstract computeDose(ct: CTImage, plan: RTPlan) DoseImage
property ctCalibration: AbstractCTCalibration | None

opentps.core.processing.doseCalculation.abstractDoseInfluenceCalculator module

class AbstractDoseInfluenceCalculator

Bases: object

Abstract class for dose influence calculation

property beamModel
abstract computeBeamlets(ct: CTImage, plan: RTPlan, roi: ROIMask | None = None)
property ctCalibration: AbstractCTCalibration | None

opentps.core.processing.doseCalculation.abstractMCDoseCalculator module

class AbstractMCDoseCalculator

Bases: AbstractDoseCalculator

Abstract class for Monte Carlo dose calculation

property nbPrimaries: int

opentps.core.processing.doseCalculation.doseCalculationConfig module

class DoseCalculationConfig(*args, **kwargs)

Bases: AbstractApplicationConfig

Configuration for dose calculation using Event

property bdlFile: str
property beamletPrimaries: int
property finalDosePrimaries: int
property scannerFolder: str

opentps.core.processing.doseCalculation.geant4DoseCalculator module

opentps.core.processing.doseCalculation.mcsquareDoseCalculator module

class MCsquareDoseCalculator

Bases: AbstractMCDoseCalculator, AbstractDoseInfluenceCalculator

Class for Monte Carlo dose calculation using MCsquare. This class is a wrapper for the MCsquare dose calculation engine.

Variables:
  • _ctCalibration (AbstractCTCalibration) – CT calibration (Optional)

  • _ct (Image3D) – the CT image of the patient (Optional)

  • _plan (RTPlan) – Treatment plan (Optional)

  • _roi (ROIMask) – ROI mask

  • _config (MCsquareConfig) – MCsquare configuration

  • _mcsquareCTCalibration (BDL) – MCsquare CT calibration

  • _beamModel (BDL) – MCsquare beam model

  • _nbPrimaries (int) – Number of primaries proton

  • _statUncertainty (float) – Statistical uncertainty for MCsquare

  • _scoringVoxelSpacing (float) – Scoring voxel spacing of dose image

  • _simulationDirectory (str) – Simulation directory path

  • _simulationFolderName (str) – Simulation folder name

  • _computeDVHOnly (int) – Compute DVH only (True if > 0)

  • _computeLETDistribution (int) – Compute Linear Energy transfer (LET) distribution in the patient (True if > 0)

  • _subprocess (subprocess.Popen) – Subprocess if used

  • _subprocessKilled (bool) – Subprocess killed (if subprocess is used)

  • _sparseLETFilePath (str) – Sparse LET file path

  • _sparseDoseFilePath (str) – Sparse dose file path

  • _sparseDoseScenarioToRead (int) – Sparse dose scenario to read

property beamModel: BDL
computeBeamlets(ct: CTImage, plan: RTPlan, roi: Sequence[ROIContour | ROIMask] | None = None) SparseBeamlets

Compute beamlets using MCsquare

Parameters:
  • ct (CTImage) – CT image of the patient

  • plan (RTPlan) – RT plan

  • roi (Optional[Sequence[Union[ROIContour, ROIMask]]], optional) – ROI contours or masks on which beamlets will be cropped at import, by default None

Returns:

beamletDose – Beamlets dose with same grid size and spacing as the CT image

Return type:

SparseBeamlets

computeBeamletsAndLET(ct: CTImage, plan: RTPlan, roi: Sequence[ROIContour | ROIMask] | None = None) Tuple[SparseBeamlets, SparseBeamlets]

Compute beamlets and LET using MCsquare

Parameters:
  • ct (CTImage) – CT image of the patient

  • plan (RTPlan) – RT plan

  • roi (Optional[Sequence[Union[ROIContour, ROIMask]]], optional) – ROI contours or masks, by default None

Returns:

  • beamletDose (SparseBeamlets) – Beamlets dose with same grid size and spacing as the CT image

  • beamletLET (SparseBeamlets) – Beamlets LET with same grid size and spacing as the CT image

computeDose(ct: CTImage, plan: RTPlan, roi: Sequence[ROIContour] | None = None) DoseImage

Compute dose distribution in the patient using MCsquare

Parameters:
  • ct (CTImage) – CT image of the patient

  • plan (RTPlan) – RT plan

  • roi (Optional[Sequence[ROIContour]], optional) – ROI contours, by default None

Returns:

Dose distribution with same grid size and spacing as the CT image

Return type:

DoseImage

computeDoseAndLET(ct: CTImage, plan: RTPlan, roi: Sequence[ROIContour] | None = None) Tuple[DoseImage, LETImage]

Compute dose and LET distribution in the patient using MCsquare

Parameters:
  • ct (CTImage) – CT image of the patient

  • plan (RTPlan) – RT plan

  • roi (Optional[Sequence[ROIContour]], optional) – ROI contours, by default None

Returns:

Dose and LET distribution with same grid size and spacing as the CT image

Return type:

Tuple[DoseImage, LETImage]

computeRobustScenario(ct: CTImage, plan: RTPlan, roi: [Sequence[Union[opentps.core.data._roiContour.ROIContour, opentps.core.data.images._roiMask.ROIMask]]]) Robustness

Compute robustness scenario using MCsquare

Parameters:
  • ct (CTImage) – CT image of the patient

  • plan (RTPlan) – RT plan

  • roi ([Sequence[Union[ROIContour, ROIMask]]]) – ROI contours or masks

Returns:

scenarios – Robustness with nominal and error scenarios

Return type:

Robustness

computeRobustScenarioBeamlets(ct: CTImage, plan: RTPlan, roi: Sequence[ROIContour | ROIMask] | None = None, storePath: str | None = None) Tuple[SparseBeamlets, Sequence[SparseBeamlets]]

Compute nominal and error scenarios beamlets using MCsquare

Parameters:
  • ct (CTImage) – CT image of the patient

  • plan (RTPlan) – RT plan

  • roi (Optional[Sequence[Union[ROIContour, ROIMask]]], optional) – ROI contours or masks on which beamlets will be cropped at import, by default None

  • storePath (Optional[str], optional) – Path to store the beamlets, by default None

Returns:

  • nominal (SparseBeamlets) – Nominal beamlets dose with same grid size and spacing as the CT image

  • scenarios (Sequence[SparseBeamlets]) – Error scenarios beamlets dose with same grid size and spacing as the CT image

property ct
property ctCalibration: AbstractCTCalibration | None
getSimulationProgress()

Get the number of simulated particles and the uncertainty

Returns:

  • numParticles (int) – Number of simulated particles

  • uncertainty (float) – Uncertainty (%)

property independentScoringGrid: bool
kill()
property nbPrimaries: int
optimizeBeamletFree(ct: CTImage, plan: RTPlan, roi: [Sequence[Union[opentps.core.data._roiContour.ROIContour, opentps.core.data.images._roiMask.ROIMask]]]) DoseImage

Optimize weights using beamlet free optimization

Parameters:
  • ct (CTImage) – CT image of the patient

  • plan (RTPlan) – RT plan

  • roi ([Sequence[Union[ROIContour, ROIMask]]]) – ROI contours or masks

Returns:

DoseImage – Optimized dose

Return type:

doseImage

property scoringGridSize
property scoringOrigin
property scoringVoxelSpacing: Sequence[float]
setScoringParameters(scoringGridSize: Sequence[int] | None = None, scoringSpacing: Sequence[float] | None = None, scoringOrigin: Sequence[int] | None = None, adapt_gridSize_to_new_spacing=False)

Sets the scoring parameters

Parameters:
  • scoringGridSize (Sequence[int]) – scoring grid size

  • scoringSpacing (Sequence[float]) – scoring spacing

  • scoringOrigin (Sequence[float]) – scoring origin

  • adapt_gridSize_to_new_spacing (bool) – If True, automatically adapt the gridSize to the new spacing

property simulationDirectory: str
property simulationFolderName
property statUncertainty: float