[vtk-developers] [slicer-devel] Array Calculator to combine two vtk arrays

Saeed Mahdizadeh Bakhshmand saeedbakhshmand at gmail.com
Tue Oct 13 03:03:32 EDT 2015


Thanks for your helpful hints, So here is roughly how my code looks now:
Labels = Model.GetPolyData().GetPointData()
Label1 = Labels.GetArray(1)  /* Label1(name:alpha) and Label2(name:betha)
are vtkfloatarray */
Label2 = Labels.GetArray(2)
calc = vtkArrayCalculator()
calc.AddScalarArrayName('alpha')
calc.AddScalarArrayName('betha')
calc.SetFunction('betha+alpha') // I am not sure if "+" will concatenate
these two arrays??

And in almost every example of vtkArrayCalculator, there is a
SetInputConnection function to be assigned that I couldn't find what to
import! Neither Model or any of it's members have a GetOutputPort.

 Alternative to this could be using vtkConcatenateArray. I wonder why that
is not available in the slicer!?
http://www.vtk.org/doc/release/5.10/html/classvtkConcatenateArray.html
On Oct 12, 2015 6:16 PM, "Andras Lasso" <lasso at queensu.ca> wrote:

> You can get the vtkPolyData object from the model node. You then follow
> VTK documentation to process the data, add attributes, etc. If you add a
> new scalar point attribute then you can choose to show it in the Models
> module.
>
> There are multiple detailed examples and tests, even in Python, that
> demonstrate the use of vtkArrayCalculator:
> http://www.vtk.org/doc/nightly/html/classvtkArrayCalculator.html
>
> A Slicer module that operates on point attributes in a model node:
>
> https://github.com/SlicerIGT/SlicerIGT/blob/master/Experimental/TexturedMesh/TexturedMesh.py
>
> Andras
> ------------------------------
> From: Saeed Mahdizadeh Bakhshmand <saeedbakhshmand at gmail.com>
> Sent: ‎2015-‎10-‎12 14:43
> To: SPL Slicer Devel <slicer-devel at bwh.harvard.edu>
> Subject: [slicer-devel] Array Calculator to combine two vtk arrays
>
> Hello,
>
> Would some body please walk me through how to code concatenating two
> vtkfloatarrays using vtkArrayCalculator (or any other possible way)?
>
> Thanks,
> SMB
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20151013/e4dba907/attachment.html>


More information about the vtk-developers mailing list