I havev a question about table.
I have a table with two columns and I want to pop the last value, shift all the elements and insert a new value just for a single column.
Basically I need to have always the same number of rows, but I want to add a new value and removing the last one.
Which is the most efficient way to do this?
Thanks a lot!
The columns of a table are vtk arrays.
For example, in the documentation https://www.slicer.org/wiki/Documentation/Nightly/Developers/Plots are vtkFloatArray.
The vtk arrays should have an InsertTuple method, which should insert the new value at a certain index, see (https://vtk.org/doc/nightly/html/classvtkDataArray.html#a00d044d0893988ffc753e86fc5247ba8 https://vtk.org/doc/nightly/html/classvtkDataArray.html#af545503feb6c030a851f824d937e9869).
For removing the last value, you can use the Resize method.
P.S.: you get the column with the method GetColumn from table = tableNode.GetTable(). After modifying the vtk array, for updating the table and plot, you need to call table.Modify().