(viz): adapt default transfer function to the image
Description
When an image is loaded or created, a default transfer function is used. It can be changed afterwards by selecting a different TF sight::module::ui::qt::image::STransferFunction
, or by modifying it in sight::module::viz::scene2d::STransferFunction
. But still, it is very convenient to have a first appropriate visualisation without changing anything.
Actually, the default transfer function is adapted to 16 bits signed integer CT images, and potentially MRI images. It is not appropriate for other formats or modalities, such as 8 bits unsigned integer ultrasound images.
Proposal
Adapt the default transfer function to the image format and modality. Several options are possible:
- Each visualisation adaptor generates a default TF. This looks like what we used to do before the transfer function rework of 2022, so this is probably a bad idea. This would again lead to a complicated logic with the input TF and the TF stored in the image field.
- Modify the
sight::module::ui::qt::image::STransferFunction
editor to adapt the default transfer function to the pixel format of the image. This removes the need to change the visualization adaptors, but this forces us to use this editor even when we don't want the selector in the UI (we can still hide it with thevisible
attribute).
Functional specifications
We choose option 2. This implies we can also remove the transfer function embedded in the image data object.
In the future development, the reader/writer may take a transfer function as inout/input.
Technical specifications
- Add a function to generate a transfer function according to the pixel type.
- Modify the
sight::module::ui::qt::image::STransferFunction
editor to adapt the default transfer function to the pixel format of the image. - Remove the default transfer function stored as a field of the image and the associated functions in
sight::data::helper::MedicalImage
.
Test plan
- Manual test of SightViewer and tutorials with images (2, 3, 7, etc...)