[vtkusers] SetScalarComponentFromFloat() and Python
Glen Lehmann
glehmann at imaging.robarts.ca
Mon Mar 14 13:27:17 EST 2005
Hi Lionel,
In python you need to use vtkImageImport to covert a python list of
values into vtkImageData.
To access individual scalars you can either export the entire image
using vtkImageExport, or use vtkImageData.GetScalarComponentAsFloat (or
GetScalarComponentAsDouble for VTK >= 4.4).
HTH,
Glen
On Mar 14, 2005, at 8:33 PM, Lionel Dupuy wrote:
> Dear vtk users
>
> I am using VTK with python to investigate some basic visualisation
> tools, and I can't get the SetScalarComponentFromFloat() method to
> work. Here is a sample of code that does not work.
>
> ...
> id = vtk.vtkImageData()
> id.SetDimensions(100,100,1)
> id.SetScalarTypeToUnsignedShort()
> id.SetNumberOfScalarComponents(1)
> id.SetScalarComponentFromFloat (1, 1, 1, 0,1.0)
> ...
>
>
> Have I missed something? Does the method exist with the python
> wrapper? Is there any other way to access individual scalars with
> python?
> Any advice will be appreciate, as I am new in VTK. Thanks all!
>
> Lionel
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2155 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050314/20691be4/attachment.bin>
More information about the vtkusers
mailing list