stf#
Beam configurations and irradiation geometries.
- class Beam(**data)[source]#
Bases:
PyRadPlanBaseModelA class representing a single beam.
This class extends PyRadPlanBaseModel (Pydantic) and provides functionality to handle the steering information, including properties like gantry angle, couch angle, etc.
- gantry_angle#
The gantry angle of the beam in (°).
- couch_angle#
The couch angle of the beam in (°).
- bixel_width#
The width of the bixels in (mm).
- radiation_mode#
The radiation mode of the beam (e.g. photon, proton, carbon).
- machine#
The machine used for the beam. (e.g. ‘Generic’)
- sad#
The source to axis distance in (mm).
- iso_center#
The isocenter of the beam in (x, y, z) coordinates.
- num_of_rays#
The number of rays in the beam.
- ray#
dict containing the properties of each ray.
- source_point_bev#
The source point in BEV coordinates.
- source_point#
The source point in (x, y, z) coordinates.
- num_of_bixels_per_ray#
The number of bixels per ray in an array (1 x num_of_rays).
- longitudinal_spot_spacing#
The longitudinal spot spacing in (mm).
- total_number_of_bixels#
The total number of bixels in the beam.
- create_beam():
Validate and create a Beam object.
- validate_beam():
Validate and create a Beam object.
- Attributes:
bixel_ray_mapMap providing ray index in the beam for each bixel.
- energies
- energy_layers
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
- num_of_bixels_per_ray
- num_of_rays
- total_number_of_bixels
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
custom_rays_serializer(v, info)model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
Validate arrays to have floating point values.
Validate the rays attribute.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
validate_model_input
- property bixel_ray_map: int64]#
Map providing ray index in the beam for each bixel.
- bixel_width: float#
- couch_angle: float#
- property energies#
- property energy_layers#
- gantry_angle: float#
- iso_center: NDArray[Shape[3], float64]#
- longitudinal_spot_spacing: float#
- machine: str#
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property num_of_bixels_per_ray: ndarray#
- property num_of_rays: int#
- radiation_mode: str#
- sad: float#
- source_point: NDArray[Shape[3], float64]#
- source_point_bev: NDArray[Shape[3], float64]#
- property total_number_of_bixels: int#
- class Beamlet(**data)[source]#
Bases:
PyRadPlanBaseModelA class representing a single beamlet.
This class extends PyRadPlanBaseModel (pydantic) and provides functionality to handle the bemamlet information, including properties like energy & monitor units.
- energy#
The energy value for the beamlet
- Type:
float
- num_particles_per_mu#
The number of particles per monitor unit
- Type:
float
- relative_fluence#
The fluence of this beamlet relative to the central primary fluence. For example, due to a non-uniform primary fluence
- Type:
float
- weight#
The applied fluence weight of the beamlet
- Type:
float
- min_mu#
The minimum monitor unit
- Type:
float
- max_mu#
The maximum monitor unit
- Type:
float
- range_shifter#
The range shifter applied for the beamlet.
- Type:
- focus_ix#
The focus index identifying the focus setting for the beamlet.
- Type:
int
- Attributes:
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
field_typing(v, handler, info)Ensure correct serialization in various contexts.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
- energy: float#
- field_typing(v, handler, info)[source]#
Ensure correct serialization in various contexts.
- Return type:
Any
- focus_ix: int#
- max_mu: float#
- min_mu: float#
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- num_particles_per_mu: float#
- range_shifter: RangeShifter#
- relative_fluence: float#
- weight: float#
- class FieldShape(**data)[source]#
Bases:
BeamletBase class representing a shape object.
This class extends PyRadPlanBaseModel (pydantic) and provides functionality to handle the beamlet information for a shape.
Notes
Coordinates in FieldShapes are defined in BEV in LPS. Note that Beam Limiting Devices from DICOM are typically defined in IEC with the X axis flipped compared to BEV convention (when gantry and couch angle are 0).
- Attributes:
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
field_typing(v, handler, info)Ensure correct serialization in various contexts.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
resample
schema
schema_json
update_forward_refs
validate
validate_spatial_consistency
- field_width: float | None#
- grid: ndarray | None#
- is_field_based: bool#
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- resolution: float | None#
- class FieldShapeAsBLD(**data)[source]#
Bases:
FieldShapeA class representing a shape object computed from a beam limiting device.
This class extends PyRadPlanBaseModel (pydantic) and provides functionality to handle the beamlet information for a shape.
- bld#
The beam limiting device from which to compute the field shape mask.
- Type:
BeamLimitingDevice
- Attributes:
- mask
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
field_typing(v, handler, info)Ensure correct serialization in various contexts.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
resample
schema
schema_json
setup_spatial_parameters
update_forward_refs
validate
validate_spatial_consistency
- bld: BeamLimitingDevice#
- property mask: ndarray#
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class FieldShapeAsMask(**data)[source]#
Bases:
FieldShapeA class representing a shape object computed from a mask.
This class extends PyRadPlanBaseModel (pydantic) and provides functionality to handle the beamlet information for a shape.
- mask#
The mask representing the shape of the field.
- Type:
np.ndarray
Notes
The mask coordinates are defined in the beam’s eye view (BEV) in LPS.
- Attributes:
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
field_typing(v, handler, info)Ensure correct serialization in various contexts.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
resample
schema
schema_json
update_forward_refs
validate
validate_grid
validate_mask
validate_spatial_consistency
- mask: ndarray#
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class FieldShapeComposite(**data)[source]#
Bases:
FieldShapeA field shape composed of multiple shapes combined by element-wise mask multiplication.
This class represents a combined field shape where the total transmission is the product of the individual shape transmissions (e.g., multiple beam limiting devices applied simultaneously). Spatial parameters (resolution, field_width) are derived from the child shapes when not explicitly provided.
- shapes#
The child shapes whose masks are multiplied to form the composite mask.
- Type:
list[Union[FieldShapeAsMask, FieldShapeAsBLD]]
- Attributes:
- mask
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
field_typing(v, handler, info)Ensure correct serialization in various contexts.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
resample
schema
schema_json
setup_spatial
update_forward_refs
validate
validate_spatial_consistency
- property mask: ndarray#
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- shapes: list[FieldShapeAsMask | FieldShapeAsBLD]#
- class IonSpot(**data)[source]#
Bases:
BeamletA class representing a single beamlet.
This class extends PyRadPlanBaseModel (pydantic) and provides functionality to handle the beamlet information specific to particles, including properties like range shifter and focus index.
- range_shifter#
The range shifter applied for the beamlet.
- Type:
- focus_ix#
The focus index identifying the focus setting for the beamlet.
- Type:
int
- Attributes:
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
field_typing(v, handler, info)Ensure correct serialization in various contexts.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class PhotonBixel(**data)[source]#
Bases:
BeamletA class representing a single photon beamlet.
This class extends PyRadPlanBaseModel (pydantic) and provides functionality to handle the beamlet information for photons. Mainly the relative fluence of the beamlet / bixel due to its lateral position is stored in here.
- relative_fluence#
The fluence of this beamlet relative to the central primary fluence.
- Type:
float
- Attributes:
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
field_typing(v, handler, info)Ensure correct serialization in various contexts.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class RangeShifter(**data)[source]#
Bases:
PyRadPlanBaseModelA class representing a range shifter.
This class extends Pydantic’s BaseModel and provides functionality to handle the range shifter information, including properties like id, equivalent thickness, and source to range shifter distance.
- id#
The identifier for the range shifter.
- Type:
int
- eq_thickness#
The equivalent thickness of the range shifter.
- Type:
float
- source_rashi_distance#
The distance from the source to the range shifter.
- Type:
float
- Attributes:
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
- eq_thickness: float#
- id: int#
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- source_rashi_distance: float#
- class Ray(**data)[source]#
Bases:
PyRadPlanBaseModelA class representing a single ray.
This class extends PyRadPlanBaseModel (pydantic) and provides functionality to handle the ray information, including properties like ray positions, energy, focus index, etc.
- ray_pos_bev#
The ray positions in BEV coordinates.
- Type:
np.ndarray
- ray_pos#
The ray positions in (x, y, z) coordinates.
- Type:
np.ndarray
- target_point_bev#
The target point in BEV coordinates.
- Type:
np.ndarray
- target_point#
The target point in (x, y, z) coordinates.
- Type:
np.ndarray
- Attributes:
- energies
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
Create a helper model for matRad serialization.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
sanitize_beamlet_structure(data, handler, info)Sanitize the beamlet structure in the ray.
to_matrad([context])Serialize rays for matRad structure.
validate_nparray_dtype(v, handler, info)Validate / convert arrays to have floating point values.
construct
custom_beamlets_serializer
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
- beamlets: list[Beamlet | FieldShapeAsMask | FieldShapeAsBLD | FieldShapeComposite]#
- classmethod create_matrad_helper_model()[source]#
Create a helper model for matRad serialization.
This creates a dynamic pydantic model that takes the Beamlet fields and organizes them as lists within the Ray for serialization within matRad. This is quite hacked, because the fields wouldn’t need to carry the information. However, computed_fields do not work in create_model in pydantic>=2.11. Thus we create normal model fields, with a default factory that extracts the information from the beamlets.
- Return type:
Self
- property energies#
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- ray_pos: NDArray[Shape[3], float64]#
- ray_pos_bev: NDArray[Shape[3], float64]#
- classmethod sanitize_beamlet_structure(data, handler, info)[source]#
Sanitize the beamlet structure in the ray.
It may be structured differently (e.g. when coming from matRad.).
- Return type:
Any
- target_point: NDArray[Shape[3], float64] | None#
- target_point_bev: NDArray[Shape[3], float64] | None#
- class SteeringInformation(**data)[source]#
Bases:
PyRadPlanBaseModelA class representing the Steering Information (stf).
This class extends PyRadPlanBaseModel (based on pydantic) and provides functionality to handle single beams, including their properties. These are defined in the corresponding class (_Beam.py).
- beams#
beam class object containing the properties of the beam.
- Type:
List[Beam] - list consisting of Beam objects (pydantic)
- validate_model_input(data: Any) Any[source]#
Validates the input data before creating the model instance.
- to_matrad() dict[source]#
Creates a dictionary ready to save the stf model to a mat-file that can be read.
- Attributes:
bixel_beam_index_mapMapping of bixels to their respective beam index.
bixel_index_per_beam_mapMapping of bixels to their bixel index in the respective beam.
bixel_ray_index_per_beam_mapMapping of bixels to the ray index in the individual beams.
model_extraGet extra fields set during validation.
model_fields_setReturns the set of fields that have been explicitly set on this model instance.
- num_of_beams
- num_of_rays
- total_number_of_bixels
Methods
copy(*[, include, exclude, update, deep])Returns a copy of the model.
custom_beams_serializer(v, info)Serialize the beams fields in various contexts.
model_construct([_fields_set])Creates a new instance of the Model class with validated data.
model_copy(*[, update, deep])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
model_json_schema([by_alias, ref_template, ...])Generates a JSON schema for a model class.
model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
model_rebuild(*[, force, raise_errors, ...])Try to rebuild the pydantic-core schema for the model.
model_validate(obj, *[, strict, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])Validate the given object with string data against the Pydantic model.
to_matrad([context])Perform matRad compatible serialization.
validate_model_input(data, handler, info)Validate the input data for creating the model instance.
construct
dict
from_orm
json
parse_file
parse_obj
parse_raw
schema
schema_json
update_forward_refs
validate
- property bixel_beam_index_map: int64]#
Mapping of bixels to their respective beam index.
- property bixel_index_per_beam_map: int64]#
Mapping of bixels to their bixel index in the respective beam.
- property bixel_ray_index_per_beam_map: int64]#
Mapping of bixels to the ray index in the individual beams.
- custom_beams_serializer(v, info)[source]#
Serialize the beams fields in various contexts.
- Return type:
Any
- model_config: ClassVar[ConfigDict] = {'alias_generator': AliasGenerator(alias=<function to_camel>, validation_alias=None, serialization_alias=None), 'arbitrary_types_allowed': True, 'from_attributes': True, 'populate_by_name': True, 'validate_assignment': True, 'validate_by_alias': True, 'validate_by_name': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property num_of_beams: int#
- property num_of_rays: int#
- to_matrad(context='mat-file')[source]#
Perform matRad compatible serialization.
- Parameters:
context (
str) – The context in which the datastructure should be serialized, by default ‘mat-file’.- Returns:
A datastructre compatible with matRad in the given context
- Return type:
Any
Notes
Currently, the only supported context is ‘mat-file’. In the future, this could be extended to support other contexts, such as direct calling via the matlab engine or oct2py.
- property total_number_of_bixels: int#
- create_stf(stf=None, **kwargs)[source]#
Create a Steering Information object.
- Parameters:
stf (
Union[dict[str,Any],SteeringInformation,None]) – dictionary containing the data to create the stf object.**kwargs – Arbitrary keyword arguments.
- Returns:
A SteeringInformation class object.
- Return type:
- Raises:
ValueError – If the radiation mode is unknown or empty.
- get_available_generators(pln)[source]#
Get a list of available stf generators based on the plan.
- Parameters:
pln (
Union[Plan,dict[str]]) – A Plan object.- Returns:
A list of available generators.
- Return type:
dict[str,Type[StfGeneratorBase]]
- get_generator(pln)[source]#
Get the appropriate generator based on the plan.
- Parameters:
pln (
Union[Plan,dict]) – A Plan object.- Returns:
A Dose Generator object.
- Return type:
StfGeneratorBase
- register_generator(generator_cls)[source]#
Register a new stf generator for irradiation geometry.
- Parameters:
generator_cls (
Type[StfGeneratorBase]) – A Generator class.- Return type:
None
- validate_stf(stf=None, **kwargs)[source]#
Validate a Steering Information object.
Synonym to create_stf but should be used in validation context.
- Parameters:
stf (
Union[dict[str,Any],SteeringInformation,None]) – dictionary containing the data to create the stf object.- Returns:
A validated SteeringInformation class object.
- Return type: