Import 2017-06-07 23:51:09: master 02d79603

Author Committer Branch Timestamp Parent
jcfr jcfr master 2015-10-07 19:50:27 master 9d89b7d4
Changeset

ENH: Improve vtkMRMLDoubleArrayNode set/get methods

Until now vtkMRMLDoubleArrayNode values could only be obtained using
'GetXYValue(int, double, double)', by passing the index and pointers
to doubles. In python such a method can not be wrapped if it passes
pointers. Within VTK classes such methods are wrapped but the mechanism
is not available to external classes [1][2].

[1] http://www.vtk.org/Wiki/VTK/Python_Wrapper_Enhancement#GetTuple.2FSetTuple_.28done_as_of_Aug_6.2C_2010.29
[2] https://github.com/Kitware/VTK/blob/077fcb394f32c76b4c05a2456b61d000563a19d5/Wrapping/Tools/vtkWrap.c#L661-L697

To overcome this limitation, this commit adds:
(1) the methods 'GetValues', 'SetValues' and 'AddValues', that are
managing the whole vectors of components for each datapoint or the
array (not just XY or XYZ)
(2) the methods 'GetValue', 'SetValue' and 'Addvalue' in order to
retrieve/set/add values not just defined by the datapoint index, but
also by the component index. These methods are conveniently wrapped
in python.

The former set/get methods limited to XY values, as well as the new
methods dealing with only one component value, are based on the methods
managing the entire datapoint vectors.

This commit also applies more robust conditions on the index and the
component number.

Rational :

We were interested in creating this method for vtkMRMLDoubleArrayNode
because this node can be used to transfer double vectors between CLIs
and Slicer [3]. 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)

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

This commit offers features that can greatly facilitate the exchange
of numerical values between Slicer and the CLI modules.

Co-authored-by: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>

From: Alexis Girault <alexis.girault@kitware.com>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@24613 3bd1e089-480b-0410-8dfb-8563597acbee

mod - Libs/MRML/Core/vtkMRMLDoubleArrayNode.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLDoubleArrayNode.h Diff File