Page MenuHomePhabricator

Cleanup and document mitk::Transferfunction
Closed, ResolvedPublic

Description

While working on serialization of scenes, I found that the mitk::TransferFunction class does not behave as I expected. Also, there is no documentation.

Here's what I expected from the interface

  • (by offering raw pointers to vtk classes, I guess that the application level will directly manipulate these)
  • control points defining the transfer function are manipulated through the interface
  • requesting the control points return non-empty lists if the rendering does display nice volume rendering

Cleaning up the interface and documentation on the intended use of this class would be nice. Once this is done, it should be possible to serialize transfer functions.

Related Objects

StatusAssignedTask
Wontfixkislinsk
InvalidNone
ResolvedNone

Event Timeline

Fixed with r18044.

mitk::TransferFunction is basically a wrapper class the three types of transfer function frequently used in VTK (volume) rendering: scalar opacity, gradient opacity, and color. Therefore, the class internally holds three VTK transfer function objects, and provides methods for manipulating these objects. Full access to these VTK objects from outside is however required during rendering to pass them to VTK classes.

A major problem with the previous implementation was that mitk::TransferFunction also kept a list of transfer function control points which was not updated when the wrapped VTK transfer functions were changed directly. This has been resolved by re-building the control-point lists on request instead of maintaining a separate list all the time.

The following changes were made:

  • Improvement of interface to be more consistent with VTK (in particular, scalar and gradient transfer functions are no longer accessed by a "channel" index, but by two separate methods)
  • Separate list of control points are no longer maintained in Set() and Remove() methods, but are generated only on request
  • Class and method documentation has been added

r18173

  • Fixed incorrect generation of color transfer function array copy
  • Change interface of point remove methods: the original VTK return value is now passed (-1 for "point not existing", all other values give the index of the removed point)