Skip to content

ENH: Create function GetValue()

Created by: agirault

Until now vtkMRMLDoubleArrayNode values could only be obtained using GetXYValue(int, double_, double_), by passing the index as a copy and the values we want to get as pointers. In python such a method can not be wrapped if it passes pointers.

The function double GetValue(int, int, int&) allows to return one value by giving its index, and specifying the component number. The last parameter is a reference to indicate if the method succeeded or not, so that we can use GetValue() within GetXYValue(). We also apply more robust conditions on the index and the component number.

We were interested in creating this method for vtkMRMLDoubleArrayNode because this node can be used to transfer double vectors between CLIs and Slicer [1]. The needs we had were : (1) Getting the returned values in a python module running the CLIs (2) Being able to get a specified component (not limited to X and Y)

[1] https://github.com/Slicer/Slicer/blob/866900a/Modules/CLI/ExecutionModelTour/ExecutionModelTour.xml#L183-L199

Merge request reports

Loading