Implement variable radius curve

Hi,

In SlicerCAT I’m implementing a module to work with curves and scalar values that may be displayed as a radius of the curve or as its color. Thus I need vtkTubeFilter.
There should be an opportunity to interactively change coefficient that multiplies scalar values and thus changing variant radius (for example by QSliderWidget).

I find vtkMRMLMarkupsCurveNode is pretty attractive but I don’t understand how interactively manage such parameters like variant radius i.e. what to connect QSliderWidget to? I suspect I need to have access to the vtkTubeFilter instance wich is stored in vtkSlicerCurveRepresentation. Is it controlled by vtkMRMLMarkupsDisplayNode?

Currently point scalars (radius, curvature, etc.) can only be used for coloring of the tube, but not for adjusting the tube radius. We anticipated that this will emerge as a need, so we designed markup curves so that with a few little changes this sizing mode can be added:

  • In vtkMRMLMarkupsDisplayNode: add a new UseActiveScalar to CurveLineSizeMode
  • In vtkSlicerCurveRepresentation2D and vtkSlicerCurveRepresentation3D if you find that CurveLineSizeMode == UseActiveScalar set the TubeFilter to use the active scalar (see example)
  • Expose the new feature on the GUI: probably changing the “Line thickness” absolute toggle button to a combobox (with the options: absolute, relative, active scalar) would be sufficient.
2 Likes

Thank you, I did as you said and I just got first results, seems pretty good. May I implement this in PR?

1 Like

This looks very promising! Yes, please submit a pull request with the proposed changes.

1 Like

The PR is here.

As vtkTubeFilter 's variant radius is controlled not only by scalars but also by SetRadius(double) and SetFactorRadius(double) I decided not to edit CurveLineSizeModeso the user can control both these parameters in VariableRadius mode.

Also in my case I expect that scalar values will have both negative and positive values. Using such scalars as radius lead to some unwanted results.
So I would like to have a possibility to translate all scalars to positive range by adding scalar value that is equal to something like abs(min(scalars)).

If someone has ideas how to do that I could probably try to implement that.

Hi,

How do you think how to fix the issue with incorrect diameter and color in slice view? I think I should look in vtkSlicerCurveRepresentation2D implementation but can’t find anything appropriate.