Re: [mv2] Filter UserDefined:ImageMathematics on Windows

B. P. Thrane wrote:
> When using the filter UserDefined:ImageMathematics on the WindowsXP 
> platform, MayaVi2 hangs (trunk version under the latest Python(x,y)). On 

Well, UserDefined is a bit dangerous so caveat emptor. :)

[...]
> Maybe setting a different default operator in the filter will be a 
> work-around, but it may hang anyway if you select an operator that 
> requires two inputs? Anyway, how to get two inputs into this filter in 
> MayaVi2? This is typically easier in a network based user interface. In 
> the MayaVi2 tree editor, it doesn't seem to be possible, a script seem 
> to be the only solution.

It is harder on the tree interface but doable.  The trick is to use a 
"drop editor" and allow a user to drag and drop the second input to 
this.  This is what you can do with the texture support -- drag and drop 
an image reader (or image data) node on the texture source object dialog 
(which should be cyan colored).

One nice filter would be a multi-input user defined filter that exposes 
just such a UI.

I really wish we had a usable network editor UI in ETS that we could use 
for this sort of thing.  It would really be convenient and I'm sure I'd 
be interested in taking a stab at using it.

cheers,
prabhu
(Continue reading)

B. P. Thrane | 3 Dec 10:28
Favicon

Re: [mv2] Filter UserDefined:ImageMathematics on Windows

Prabhu Ramachandran wrote:
> B. P. Thrane wrote:
>   
>> When using the filter UserDefined:ImageMathematics on the WindowsXP 
>> platform, MayaVi2 hangs (trunk version under the latest Python(x,y)). On 
>>     
>
> Well, UserDefined is a bit dangerous so caveat emptor. :)
>
> [...]
>   
OK, then I need to do the math on the object in the import filter, which 
means I need to make a ImageData source with several scalar arrays. But 
I get problems with building up a StructuredPoints/ImageData source 
object with several arrays, similar to the first problem I sent you 
Prabhu. Now here is an example that should illustrate the problem:

from numpy import array
from enthought.tvtk.api import tvtk
from enthought.mayavi.sources.vtk_data_source import VTKDataSource
o = [0,0,0,0,0,0,0,0,0]
i = [1,1,1,1,1,1,1,1,1]
p = tvtk.ImageData(dimensions=[3,3,3],spacing=[1,1,1])
j1 = p.point_data.add_array(o)
p.point_data.get_array(j1).name='zeros'
j2 = p.point_data.add_array(i)
p.point_data.get_array(j2).name='ones'
p.update()
src = VTKDataSource(data=p)
mayavi.add_source(src, scene=None)
(Continue reading)

B. P. Thrane | 3 Dec 14:27
Favicon

Re: [mv2] Filter UserDefined:ImageMathematics on Windows

B. P. Thrane wrote:
>>  
> OK, then I need to do the math on the object in the import filter, 
> which means I need to make a ImageData source with several scalar 
> arrays. But I get problems with building up a 
> StructuredPoints/ImageData source object with several arrays, similar 
> to the first problem I sent you Prabhu. Now here is an example that 
> should illustrate the problem:

Sorry about the bad example below, the arrays are not long enough, need 
27 samples, not 9, and the scrambling in the attached image can also be 
due to incomplete array initialisation.

I need to prepare a better example.

>
> from numpy import array
> from enthought.tvtk.api import tvtk
> from enthought.mayavi.sources.vtk_data_source import VTKDataSource
> o = [0,0,0,0,0,0,0,0,0]
> i = [1,1,1,1,1,1,1,1,1] 
B. P. Thrane | 3 Dec 15:17
Favicon

Re: [mv2] Filter UserDefined:ImageMathematics on Windows

B. P. Thrane wrote:
> B. P. Thrane wrote:
>   
>>>  
>>>       
>> OK, then I need to do the math on the object in the import filter, 
>> which means I need to make a ImageData source with several scalar 
>> arrays. But I get problems with building up a 
>> StructuredPoints/ImageData source object with several arrays, similar 
>> to the first problem I sent you Prabhu. Now here is an example that 
>> should illustrate the problem:
>>     
>
> Sorry about the bad example below, the arrays are not long enough, need 
> 27 samples, not 9, and the scrambling in the attached image can also be 
> due to incomplete array initialisation.
>
> I need to prepare a better example.
>
>   

Here is a new example that produces the attached image when adding 
ImagePlaneWidget, Glyph and ScalarCutPlane. The very season friendly 
christmas tree colors of the ImagePlaneWidget tells a different story 
from the ScalarCutPlane and Glyphs, which seem to be correct. When 
flipping between the 3 arrays in the source, the glyphs and 
ScalarCutPlane are updated, but the output from ImagePlaneWidget is 
randomized.

from numpy import array, zeros
(Continue reading)


Gmane