opengate ======== .. py:module:: opengate Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/opengate/actions/index /autoapi/opengate/actors/index /autoapi/opengate/base/index /autoapi/opengate/bin/index /autoapi/opengate/contrib/index /autoapi/opengate/decorators/index /autoapi/opengate/definitions/index /autoapi/opengate/element/index /autoapi/opengate/engines/index /autoapi/opengate/exception/index /autoapi/opengate/geometry/index /autoapi/opengate/image/index /autoapi/opengate/logger/index /autoapi/opengate/mac/index /autoapi/opengate/managers/index /autoapi/opengate/physics/index /autoapi/opengate/processing/index /autoapi/opengate/runtiming/index /autoapi/opengate/serialization/index /autoapi/opengate/sources/index /autoapi/opengate/tests/index /autoapi/opengate/uisessions/index /autoapi/opengate/userelement/index /autoapi/opengate/userhooks/index /autoapi/opengate/userinfo/index /autoapi/opengate/utility/index Attributes ---------- .. autoapisummary:: opengate.g4_units Classes ------- .. autoapisummary:: opengate.Simulation Package Contents ---------------- .. py:class:: Simulation(name='simulation') Bases: :py:obj:`opengate.base.GateObject` Main class that store a simulation. It contains: - a set of global user parameters (SimulationUserInfo) - user parameters for Volume, Source, Actors and Filters, Physics - a list of g4 commands that will be set to G4 engine after the initialization There is NO Geant4 engine here, it is only a set of parameters and options. .. py:attribute:: user_info_defaults .. py:attribute:: verbose_getstate :value: False .. py:attribute:: verbose_close :value: False .. py:attribute:: volume_manager .. py:attribute:: source_manager .. py:attribute:: actor_manager .. py:attribute:: physics_manager .. py:attribute:: filter_manager .. py:attribute:: output :value: None .. py:attribute:: user_hook_after_init :value: None .. py:attribute:: user_hook_after_run :value: None .. py:method:: __str__() .. py:property:: use_multithread .. py:property:: world .. py:method:: to_dictionary() .. py:method:: from_dictionary(d) .. py:method:: to_json_string() .. py:method:: to_json_file(directory=None, filename=None) .. py:method:: from_json_string(json_string) .. py:method:: from_json_file(path) .. py:method:: copy_input_files(directory=None, dct=None) .. py:method:: get_output_path(path=None, is_file_or_directory='file') .. py:method:: add_g4_command_after_init(command) For the moment, only use it *after* runManager.Initialize .. py:method:: add_g4_command_before_init(command) For the moment, only use it *after* runManager.Initialize .. py:method:: get_source_user_info(name) .. py:method:: get_actor_user_info(name) .. py:method:: add_volume(volume, name=None) .. py:method:: add_parallel_world(name) .. py:method:: add_source(source_type, name) .. py:method:: add_actor(actor_type, name) .. py:method:: add_filter(filter_type, name) .. py:property:: multithreaded .. py:method:: _run_simulation_engine(start_new_process) Method that creates a simulation engine in a context (with ...) and runs a simulation. Args: q (:obj: queue, optional) : A queue object to which simulation output can be added if run in a subprocess. The dispatching function needs to extract the output from the queue. start_new_process (bool, optional) : A flag passed to the engine so it knows if it is running in a subprocess. Returns: :obj:SimulationOutput : The output of the simulation run. .. py:method:: run(start_new_process=False) .. py:method:: voxelize_geometry(extent='auto', spacing=(3, 3, 3), margin=0, filename=None, return_path=False) Create a voxelized three-dimensional representation of the simulation geometry. The user can specify the sub-portion (a rectangular box) of the simulation which is to be extracted. Args: extent : By default ('auto'), GATE automatically determines the sub-portion to contain all volumes of the simulation. Alternatively, extent can be either a tuple of 3-vectors indicating the two diagonally opposite corners of the box-shaped sub-portion of the geometry to be extracted, or a volume or list volumes. In the latter case, the box is automatically determined to contain the volume(s). spacing (tuple) : The voxel spacing in x-, y-, z-direction. margin : Width (in voxels) of the additional margin around the extracted box-shaped sub-portion indicated by `extent`. filename (str, optional) : The filename/path to which the voxelized image and labels are written. Suffix added automatically. Path can be relative to the global output directory of the simulation. return_path (bool) : Return the absolute path where the voxelixed image was written? Returns: dict, itk image, (path) : A dictionary containing the label to volume LUT; the voxelized geoemtry; optionally: the absolute path where the image was written, if applicable. .. py:method:: _get_voxelized_geometry(extent, spacing, margin) Private method which returns a voxelized image of the simulation geometry given the extent, spacing and margin. The voxelization does not check which volume is voxelized. Every voxel will be assigned an ID corresponding to the material at this position in the world. .. py:data:: g4_units