opentps.core.processing.planOptimization.objectives package
Submodules
opentps.core.processing.planOptimization.objectives.baseFunction module
- class BaseFunc(**kwargs)
Bases:
object
Function object interface The instanced objects are meant to be passed to the :func: “solver.solve” solving function
- cap(x)
Test the capabilities of the function object
- Parameters:
x (array_like) – Point at which the capabilities are tested
- Returns:
cap – List of capabilities
- Return type:
list
- eval(x)
Function evaluation
- Parameters:
x (array_like) – Point at which the function is evaluated
- Returns:
sol – Function value at x
- Return type:
float
- grad(x)
Function gradient
- Parameters:
x (array_like) – Point at which the gradient is evaluated
- Returns:
sol – Gradient value at x
- Return type:
array_like
- prox(x, T)
Function proximal operator
- Parameters:
x (array_like) – Point at which the proximal operator is evaluated
T (float) – Proximal operator parameter
- Returns:
sol – Proximal operator value at x
- Return type:
array_like
opentps.core.processing.planOptimization.objectives.doseFidelity module
- class DoseFidelity(plan, xSquare=True, GPU_acceleration=False)
Bases:
BaseFunc
Dose fidelity objective class. Inherits from BaseFunc.
- Variables:
list (list) – List of objectives
xSquare (bool) – If true, the weights are squared. If false, the weights are not squared.
beamlets (sparse matrix) – Beamlet matrix
scenariosBL (list) – List of scenarios
GPU_acceleration (bool (default: False)) – If true, the GPU is used for the computation of the fidelity function and gradient.
- computeFidelityFunction(x, returnWorstCase=False)
Computes the fidelity function.
- Parameters:
x (array) – Weights
returnWorstCase (bool) – If true, the worst case scenario is returned. If false, the nominal scenario is returned.
- Returns:
fTot (float) – Fidelity function value
worstCase (int (only if robust objectives are present)) – Worst case scenario index (-1 for nominal)
- computeFidelityGradient(x)
Computes the fidelity gradient.
- Parameters:
x (array) – Weights
- Returns:
dfTot – Fidelity gradient
- Return type:
array
- Raises:
Exception – If the objective metric is not supported.
- unload_blGPU()
opentps.core.processing.planOptimization.objectives.energySequencing module
- class EnergySeq(plan, gamma, factor=0.001, **kwargs)
Bases:
BaseFunc
Energy sequencing function (eval, grad): regularization used to sequence the energy layers by descending order (favor high-to-low energy sequence) gamma is the regularization parameter. Inherited from BaseFunc.
- Variables:
plan (Plan) – Plan of which the energy sequencing function is calculated.
gamma (float) – Regularization parameter.
factor (float) – Factor used to scale the energy sequencing function.
opentps.core.processing.planOptimization.objectives.logBarrier module
- class LogBarrier(plan, beta, **kwargs)
Bases:
BaseFunc
Log barrier function (eval, grad): regularization function used to distribute the selected layers to the whole gantry rotating range. The term sums up the intensity of each beam and penalizes the zero intensities, therefore forcing each beam to keep at least one layer selected. beta is the regularization parameter for the log barrier function. Inherits from BaseFunc.
- Variables:
plan (Plan) – The plan to be optimized.
beta (float) – Regularization parameter for the log barrier function.
struct (WeightStructure) – Weight structure of the plan.
- dlogCols(x)
Calculates derivative log of each layer and sum in each beam
- Parameters:
x (list) – List of beams and layers.
- Returns:
res – List of derivative log of each layer and sum in each beam.
- Return type:
list
- logCols(x)
Calculates log of each beam
- Parameters:
x (list) – List of beams and layers.
- Returns:
res – List of log of each beam.
- Return type:
list
opentps.core.processing.planOptimization.objectives.norms module
- class Norm(lambda_=1, **kwargs)
Bases:
BaseFunc
Base class which defines the attributes of the norm objects. Inherit from BaseFunc. Code from EPFL LTS2 toolbox.
- Variables:
lambda (float (default: 1)) – Regularization parameter.
- class NormL1(**kwargs)
Bases:
Norm
L1-norm (eval, prox). Inherits from Norm. Code from EPFL LTS2 toolbox.
- class NormL2(**kwargs)
Bases:
Norm
L2-norm (eval, prox, grad). Inherits from Norm. Code from EPFL LTS2 toolbox.
- class NormL21(plan=None, scaleReg='group_size', oldRegularisation=False, **kwargs)
Bases:
Norm
L2,1-norm (eval, prox) for matrix (list of lists in our case): Sum of the Euclidean norms of the columns (items) of the matrix (list) The proximal operator for reg*||w||_2 (not squared). source lasso. Inherit from Norm. Code from EPFL LTS2 toolbox.
- sumMuInlayer(X, index)
opentps.core.processing.planOptimization.objectives.projections module
- class BaseProj(epsilon=1, method='FISTA', **kwargs)
Bases:
BaseFunc
Base class which defines the attributes of the proj objects. Code from EPFL LTS2 toolbox.
- Variables:
epsilon (float (default: 1)) – Regularization parameter.
method (str (default: 'FISTA')) – Method used to solve the proximal problem.
- class Indicator(plan, smooth_fun, eps, **kwargs)
Bases:
BaseProj
Projection on ? (eval, prox) Regularization function used to distribute the selected layers to the whole gantry rotating range. This function is the indicator function \(i_S(z)\) of the set S which is zero if z is in the set and infinite otherwise. The set S is defined by ? ?: Indicator activated if beam MU <= epsilon. If yes, MU redistributed on activated layers for the sum to reach epsilon (esp= regularization parameter). Inherits from BaseProj. Code from EPFL LTS2 toolbox.
- Variables:
plan (Plan) – Plan object.
smooth_fun (SmoothFunction) – Smooth function object.
eps (float) – Regularization parameter.
struct (WeightStructure) – Weight structure object.
- class PositiveProj(**kwargs)
Bases:
BaseProj
Projection on nonnegative orthant (eval, prox) This function is the indicator function \(i_S(z)\) of the set S which is zero if z is in the set and infinite otherwise. The set S is defined by mathbb{R}^N_+ . Inherits from BaseProj. Code from EPFL LTS2 toolbox.