fw4spl
Activity configuration

An activity is defined by the extension "::fwActivities::registry::Activities". It is used to launch an AppConfig with the selected data, it will create a new data fwMedData::ActivitySeries that inherits from a fwMedData::Series.

The service activities::action::SActivityLauncher allows to launch an activity. Its role is to create the specific Activity associated with the selected data.

This action should be followed by the service guiQt::editor::DynamicView : this service listens the action signals and launchs the activity in a new tab.

1  <extension implements="::fwActivities::registry::Activities">
2  <id>myActivityId</id>
3  <title>3D Visu</title>
4  <desc>Activity description ...</desc>
5  <icon>media-0.1/icons/icon-3D.png</icon>
6  <requirements>
7  <requirement name="param1" type="::fwData::Image" /> <!-- defaults : minOccurs = 1, maxOccurs = 1-->
8  <requirement name="param2" type="::fwData::Mesh" maxOccurs="3" >
9  <key>Item1</key>
10  <key>Item2</key>
11  <key>Item3</key>
12  </requirement>
13  <requirement name="param3" type="::fwData::Mesh" maxOccurs="*" container="vector" />
14  <requirement name="imageSeries" type="::fwMedData::ImageSeries" minOccurs="0" maxOccurs="2" />
15  <requirement name="modelSeries" type="::fwMedData::ModelSeries" minOccurs="1" maxOccurs="1">
16  <desc>Description of the required data....</desc>
17  <validator>::fwActivities::validator::ImageProperties</validator>
18  </requirement>
19  <requirement name="transformationMatrix" type="::fwData::TransformationMatrix3D" minOccurs="0" maxOccurs="1"
20 create="true" />
21  <!-- ...-->
22  </requirements>
23  <builder>::fwActivities::builder::ActivitySeries</builder>
24  <validator>::fwActivities::validator::ImageProperties</validator><!-- pour fw4spl_0.9.2 -->
25  <appConfig id="myAppConfigId">
26  <parameters>
27  <parameter replace="registeredImageUid" by="@values.param1" />
28  <parameter replace="orientation" by="frontal" />
29  <!-- ...-->
30  </parameters>
31  </appConfig>
32  </extension>

The activity parameters are (in this order):

  • id: it is the activity unique identifier.
  • title: it is the activity title that will be displayed on the tab.
  • desc: it is the description of the activity. It is displayed by the SActivityLauncher when several activity can be launched with the selected data.
  • icon: it is the path to the activity icon. It is displayed by the SActivityLauncher when several activity can be launched with the selected data.
  • requirements: it is the list of the data required to launch the activity.
    • requirement: a required data.
      • name: key used to add the data in the activity Composite.
      • type: the data type (ex: fwMedData::ImageSeries).
      • minOccurs (optional, "1" by default): the minimum number of occurrences of this type of object in the vector.
      • maxOccurs (optional, "1" by default): the maximum number of occurrences of this type of object in the vector.
      • container (optional, "vector" or "composite", default: composite): container used to contain the data if minOccurs or maxOccurs are not "1". if the container is "composite", you need to specify the "key" of each object in the composite.
      • create (optional, default "false"): if true and (minOccurrs == 0 && maxOccurs == 1), the data will be automatically created if it is not present.
      • desc (optional): description of the parameter
      • validator (optional): validator to check if the associated data is well formed (inherited of ::fwAtivities::IObjectValidator)
  • builder: implementation of the activity builder. The default builder is fwActivities::builder::ActivitySeries : it creates the fwMedData::ActivitySeries and adds the required data in its composite with de defined key. The builder fwActivities::builder::ActivitySeriesInitData allows, in addition to what the default builder does, to create data when minOccurs == 0 et maxOccurs == 0.
  • validators (optional): it defines the list of validator. If you need only one validator, you don't need the "validators" tag (only "validator").
  • validator (optional): it allows to validate if the selected required object are correct for the activity. For example, the validator fwActivities::validator::ImageProperties checks that all the selected images have the same size, spacing and origin.
  • appConfig: it defines the AppConfig to launch and its parameters
  • id: identifier of the AppConfig
  • parameters: list of the parameters required by the AppConfig
    • parameter: defines a parameter
      • replace: name of the parameter as defined in the AppConfig
      • by: defines the string that will replace the parameter name. It should be a simple string (ex. frontal) or define a sesh@ path (ex. .myImage). The root object of the sesh@ path if the composite contained in the ActivitySeries.

Validators

There is three types of validator :

Pre-build validator

This type of validators checks if the current selection of data is correct to build the activity. It inherits of fwActivities::IValidator and must implement the methods:

ValidationType validate(
const ::fwActivities::registry::ActivityInfo& activityInfo,
SPTR(::fwData::Vector) currentSelection ) const;

Activity validator

This type of validator checks if the fwMedData::ActivitySeries is correct to launch its associated activity. It inherits of fwActivities::IActivityValidator and must implement the method:

ValidationType validate(const CSPTR(::fwMedData::ActivitySeries) &activity ) const;

The validator fwActivities::validator::DefaultActivity is applied if no other validator is defined. It checks if all the required objets are present in the series and if all the parameters delivered to the AppConfig are present.

It provides some method useful to implement your own validator.

Object validator

This type of validator checks if the required object is well formed. It can check a single object or a Vector or a Composite containing one type of object. It inherits of fwActivities::IObjectValidator and must implement the method:

ValidationType validate(const CSPTR(::fwData::Object) &currentData ) const;