Skip to content

feat(tutoCpp): convert tuto 08 and 09 to use C++

Emilie WERNERT requested to merge tuto-controller into dev

What does this MR do?

The new Samples Tuto08GenericSceneCpp and Tuto09MesherWithGenericSceneCpp are equivalent to the existing samples (same name without 'Ctrl') but they doesn't use XML configuration.

All the services are managed in C++ in the application Plugin class. The services' configurations are written with ::boost::property::tree.

Add a new helper : ::fwServices::AppManager:
It simplifies the management of objects/services/connections in an application.

The IService API is improved to register the required object in each service constructor using this->registerObject(<key>, <Access>, <autoConnect>, <optional>). Currently only the services used by Tuto08 and Tuto09 have been updated:

    // SNegatoMPR.cpp
    this->registerObject(s_IMAGE_INOUT, AccessType::INOUT, true);
    this->registerObject(s_TF_INOUT, AccessType::INOUT, false, true);

To check if the service has all its required objects, you can use service->hasAllRequiredObjects();

To register a deferred data, you just has to define:

   service->setObjectId(s_IMAGE_INOUT, imageId);

The service must be managed by the AppManager using appMgr->addService(...)

Where imageId is the identifier to associate the object to different services. When the object is generated by a service (as output), it will be automatically managed by the AppManager and set to the service that require it.

If the object is not deferred, you can add it directly to the AppManager appMgr->addObject(object, objectId) or register directly the object into the service using the existing API registerInput() or registerInOut.

A temporary define REMOVE_DEPRECATED is added in fwServices to prepare the removing of the deprecated methods.

This MR is the first step of the Qml integration
See #2 (closed)

Depends

Related

How to test it?

fwServicesTest:

  • launch fwServicesTest

Tuto08GenericSceneCpp:

  • open an image and use the different editors/sliders
  • open a model and a texture

Tuto09MesherWithGenericSceneCpp:

  • open a 3D image mask
  • generate a modelSeries
  • play with the organ manager editor

Data

For Tuto08, you will need a 3D image, a model with texture coordinates and a texture image.
For Tuto09, you will need a 3D image mask.

You can find some data here For the texture, you can use this mesh: sphere_uv.vtk

Edited by Emilie WERNERT

Merge request reports