fix(core): transfer function is overwritten by defaults when launching a config
Description
When we pass a transfer function as a parameter to a configuration, it is overwritten by the default transfer function.
Steps to reproduce
Reproducing the problem in SightViewer requires some code changes:
- in the plugin.xml, specify the values of the transfer function like:
<object uid="volumeTF" type="sight::data::TransferFunction">
<name>Bones</name>
<colors isClamped="false">
<step color="#FF800000" value="266" />
<step color="#FFFFB8BB" value="270" />
<step color="#FFFFFFCA" value="341" />
</colors>
</object>
- in TransferFunctionWidget.xml, comment out the option input image to avoid recomputing the TF
<service uid="transferFunctionEditorSrv" type="sight::module::ui::qt::image::STransferFunction" >
<!-- <in key="image" uid="${image}" /> -->
<inout key="tf" uid="${currentTF}" />
<config deleteicon="sight::module::ui::flaticons/RedDeleteFile.svg"
newicon="sight::module::ui::flaticons/GreenNewFile.svg"
copyicon="sight::module::ui::flaticons/GreenCopyFile.svg"
reinitializeicon="sight::module::ui::flaticons/RedResetFile.svg"
renameicon="sight::module::ui::flaticons/YellowRenameFile.svg"
importicon="sight::module::ui::flaticons/BlueLoad.svg"
exporticon="sight::module::ui::flaticons/BlueSave.svg"/>
</service>
- launch
SightViewer
and load a CT image - observe in the volume rendering that the applied transfer function is the default now (GreyLevel) instead of the one we specified, which should only display bones
Functional specifications
Data-specific XML parsers are executed whenever an object is created in an XML configuration. We discovered they were also executed with referenced objects, which could lead to objects overwritten with defaults. This happened for instance with transfer functions.
The fix is to no longer execute the parsers in this case.
However, fixing this made us realize these parsers are not executed for objects created in activities. In the case of transfer functions, this leads to getting empty objects, because this is the parser which sets the object to the default transfer function. Thus, we also need to execute these parsers when creating in activities.
Technical specifications
- Modify AppConfigManager to not execute the parsers for referenced objects.
- Execute the parsers in activity launchers, such as
sight::ui::qt::activity::SLauncher
andsight::ui::qt::activity::SSequencer
.
Along the road, some cleaning needs to be performed.
Test plan
- Test of ExActivities, SightCalibrator.