[mayavi/VTK] bool array issue...

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[mayavi/VTK] bool array issue...

fred-2
Hi all,

It looks like that VTK does not handler bool array, trying to run the
following CME...

Traceback (most recent call last):
   File
"/usr/local/lib/python2.6/dist-packages/Traits-3.5.1.dev_r26218-py2.6-linux-x86_64.egg/enthought/traits/trait_notifiers.py",
line 367, in call_2
     self.handler( object, new )
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26249-py2.6-linux-x86_64.egg/enthought/mayavi/sources/array_source.py",
line 183, in _scalar_data_changed
     img_data.point_data.scalars = numpy.ravel(data)
   File "tvtk_classes/data_set_attributes.py", line 305, in _set_scalars
     my_arg = deref_array([arg], [['vtkDataArray']])
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26249-py2.6-linux-x86_64.egg/enthought/tvtk/array_handler.py",
line 752, in deref_array
     ret.append(convert_array(a, s))
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26249-py2.6-linux-x86_64.egg/enthought/tvtk/array_handler.py",
line 638, in convert_array
     return array2vtk(arr)
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26249-py2.6-linux-x86_64.egg/enthought/tvtk/array_handler.py",
line 271, in array2vtk
     vtk_typecode = get_vtk_array_type(z.dtype)
   File
"/usr/local/lib/python2.6/dist-packages/Mayavi-3.4.1.dev_r26249-py2.6-linux-x86_64.egg/enthought/tvtk/array_handler.py",
line 168, in get_vtk_array_type
     raise TypeError, "Couldn't translate array's type to VTK"
TypeError: Couldn't translate array's type to VTK
Segmentation fault


Any workaround?
(other casting array to integer, for instance).


TIA.

Cheers,

--
Fred

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

cme.py (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [mayavi/VTK] bool array issue...

Gael Varoquaux
On Wed, Mar 23, 2011 at 12:28:03PM +0100, Fred wrote:
> It looks like that VTK does not handler bool array, trying to run
> the following CME...

Indeed.

> Any workaround? (other casting array to integer, for instance).

Cast to int :) Or take a view as int, if you want to avoid memory copies.

G
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [mayavi/VTK] bool array issue...

fred-2
Le 23/03/2011 13:01, Gael Varoquaux a écrit :
> On Wed, Mar 23, 2011 at 12:28:03PM +0100, Fred wrote:
>> It looks like that VTK does not handler bool array, trying to run
>> the following CME...
>
> Indeed.
>
>> Any workaround? (other casting array to integer, for instance).
>
> Cast to int :) Or take a view as int, if you want to avoid memory copies.
Ok, I'll take uint8.

Thx.

--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev