avid.actions.rttb.doseAcc.DoseAccAction
- class avid.actions.rttb.doseAcc.DoseAccAction(doses, registrations=None, plans=None, weight=None, planned_fraction_property='planned_fractions', interpolator='linear', operator='+', outputExt='nrrd', actionTag='doseAcc', alwaysDo=False, session=None, additionalActionProps=None, actionConfig=None, propInheritanceDict=None, cli_connector=None)
Bases:
CLIActionBaseClass that wraps the single action for the tool doseAcc.
The action implements the following strategy to deduce the weights for the dose accumulation: 1. If weight are set explicitly in __init__ they will always be used. 2. If plans are set in __init__, the action will try to deduce the number of planned fractions and compute the weights accordingly. 3. Action will try to deduce the number of planned fractions (stored in an artefact property) from the dose artefact. 4. Action will assume (a) in case of + operation that the weight equals 1/number of doses or (b) in case of * operation that the weight equals 1.
- __init__(doses, registrations=None, plans=None, weight=None, planned_fraction_property='planned_fractions', interpolator='linear', operator='+', outputExt='nrrd', actionTag='doseAcc', alwaysDo=False, session=None, additionalActionProps=None, actionConfig=None, propInheritanceDict=None, cli_connector=None)
- Parameters:
doses – List of dose artefacts that should be accumulated.
registrations – List of registration artefacts that should be used to map the doses befor accumulation. It is expected that this list is either None, a list equal in size to doses or a list that has one item less than doses (because the first dose will never be mapped.
plans – list of plans that will be used to deduced to number of fractions and therefore the accumulation weigth for each dose.
weight (float, int) – Possibility to set the weight that should be used for accumulating the doses.
planned_fraction_property – Name of the property in the dose artefact or the plan artefact that encodes the number of fractions.
interpolator – String that defines the interpolator that should be used. Is defined by doseAcc.
operator – String that defines the type of accumulation. Is defined by doseAcc.
Methods
__init__(doses[, registrations, plans, ...])- param doses:
List of dose artefacts that should be accumulated.
do()Triggers the processing of an action instance.
Function that has to be called after the data processing of an action processing to finalize the action state and do the bookkeeping (e.g. notifying the session, checking the validity and existence of the outputs).
Function that has to be called to do the data processing of an action processing.
do_setup()Function that has to be called to prepare an action for the processing.
generateArtefact([reference, ...])Helper method that can be used in derived action classes in their indicateOutputs() implementation.
Return a list of artefact entries the action will produce if do_setup() is called.
Attributes
Indicating the skipping of the (last) execution of an action.
Indicating that the action instance is currently generating the outputs.
Indicating that the action instance is in an uninitialized state.
Indicating that the action instance was not executed so far.
Indicating the failure of the (last) execution of an action instance.
ACTION_UNINITactionInstanceUIDactionTagaction_tag_selectorreturns the current working directory that is used by the action when executing the tool.
has_warningsinstanceNameisFailureisPendingisRunningisSkippedisSuccessis_uninitializedlast_cli_call_file_pathlast_exec_statelast_warningsReturns the path of the error log file that contains the std::error stream of the execution, the action instance is associated with.
Returns the path of the log file that contains the std::out stream of the execution, the action instance is associated with.
outputArtefacts- ACTION_FAILURE = 'FAILURE'
Indicating the skipping of the (last) execution of an action. As any outputs the action instance would produce are available and still up to date.
- ACTION_PENDING = 'PENDING'
Indicating that the action instance is currently generating the outputs.
- ACTION_RUNNING = 'RUNNING'
Indicating that the action instance is in an uninitialized state.
- ACTION_SKIPPED = 'SKIPPED'
Indicating that the action instance was not executed so far.
- ACTION_SUCCESS = 'SUCCESS'
Indicating the failure of the (last) execution of an action instance.
- property cwd
returns the current working directory that is used by the action when executing the tool.
- do()
Triggers the processing of an action instance. This should be used as public trigger of an action. It is a convenient version that will trigger do_setup, do_process and do_finalize in the right way. Returns the action instance itself.
- do_finalize()
Function that has to be called after the data processing of an action processing to finalize the action state and do the bookkeeping (e.g. notifying the session, checking the validity and existence of the outputs). After the call of the method the outputs of action instance are collected and verified. It is advised to use do(), which will use do_finalize() appropriately.
- do_processing()
Function that has to be called to do the data processing of an action processing. After the call of the method the outputs of action instance are computed. It is advised to use do(), which will use do_processing() appropriately.
- do_setup()
Function that has to be called to prepare an action for the processing. After the call of the method the action instance is able to process the data (if needed). The return value indicates of the instance can/needs to process (true) or not (false). It is advised to use do(), which will use do_setup() appropriately. After the call of this method, the instance will have one of the following states: (1) pending: expected state. Indicating that action should/needs to process and no waiting for triggering do_process() (2) skipped: indicated ouput data is already there and valid. No need for do_process, directly trigger do_finalize() (3) failed: indicated that the setup failed (e.g. because inputs are invalid). No need for do_process, directly trigger do_finalize()
- generateArtefact(reference=None, copyAdditionalPropsFromReference=True, userDefinedProps=None, url_user_defined_part=None, url_extension=None, use_no_url_id=False)
Helper method that can be used in derived action classes in their indicateOutputs() implementation. The generation will be done in following steps: 1) It generates an artefact that has the actionTag of the current action. 2) Other properties will be taken from the reference (if given). 3) If a self._propInheritanceDict is specified it will be used to inherit property values. 4) self._additionalActionProps will be transferd. 5) the property values defined in userDefinedProps will be transfered. Remark: ActionTag will always be of this action. Remark: As default the URL will be None. If parameter url_user_defined_part or url_extension are not None, an artefact URL will be created. In this case the following pattern will be used: <artefact_path>[<url_user_defined_part>.]<artefact_id>[<><url_extension>] artefact_path: Return of artefactHelper.generateArtefactPath using the configured new artefact. url_user_defined_part: Parameter of the call artefact_id: ID of the new artefact extension_seperator: OS specific file extension seperator url_extension: Parameter of the call REMARK: Currently if self has a _propInheritanceDict specified, only the first artefact of the indicated input selection will be used to inherit the property. @param reference An other artefact as reference. If given, the following properties will be copied to the new artefact: Case, timepoint, type, format, objective. @param copyAdditionalPropsFromReference Indicates if also the additional properties should be transfered from the reference to the new artefact (only relevant of reference is not None). @param userDefinedProps Properties specified by the user that should be set for the new artefact. Parameter is a dictionary. The keys are the property ids and the dict values their value. Passing None indicates that there are no props @url_user_defined_part: specifies the humand readable prefix of the artefact url. If set a URL will be generated. @url_extension: specifies the file extension of the artefact url. If set a URL will be generated. @use_no_url_id Bool. If set to true, the unique id at the end of generated filenames will be removed, giving the user full control of the resulting filenames. WARNING: When using this option, the user has to take care themselves to avoid collisions between generated files.
- indicateOutputs()
Return a list of artefact entries the action will produce if do_setup() is called. The method should return complete entries. Therefore, the entries should already contain the url where they will be stored if the action is executed. Remark: The output indication might not represent the final result of an action (e.g. because an action is not able to determine the outputs before they are actually generated.). This the list might only indicate the assumed outputs. Also An action can return None to signal that it cannot indicate the outputs before generation. :return: Either a list of indicated outputs or None.
- property logErrorFilePath
Returns the path of the error log file that contains the std::error stream of the execution, the action instance is associated with. If it is None the action was not executed so far.
- property logFilePath
Returns the path of the log file that contains the std::out stream of the execution, the action instance is associated with. If it is None the action was not executed so far.