[vtkusers] Not getting to use the vtkThreshold with a vtkRectilinearGrid

Adriano Gonçalves adriano at esss.com.br
Fri Dec 18 11:54:49 EST 2009


Hi David, I've gotten to solve the problem using the method 
*SetInputArrayToProcess* thus:

*thresh.SetInputArrayToProcess(0, 0, 0, 1, 'test')*

(this "1" at the 4th parameter is the same of the 
vtkDataObject::FIELD_ASSOCIATION_CELLS  constant)

Thank you so much for your help!

Adriano

Em 17/12/2009 15:30, Adriano Gonçalves escreveu:
> Oops... I've thought this list also came with the list e-mail in the 
> "reply-to header", sorry.
> Now I tried to put a *thresh.SetInputArrayToProcess(1, 0, 0, 0, 
> 'test')* after the *thresh.ThresholdByLower(0.5)*. Nothing happens 
> different yet.
>
> Thanks,
>
> Adriano
>
> Em 17/12/2009 12:12, David Doria escreveu:
>> 2009/12/17 Adriano Gonçalves<adriano at esss.com.br>:
>>    
>>> Hi, David, thanks for your answer.
>>> I'm setting the data array as follows (these codes bellow are adapted from
>>> different methods and classes):
>>>
>>>          dimensions = (4, 4, 2) # Dimensions of the grid
>>>          sizes = (10, 10, 2)
>>>
>>>          prop_array = numpy.random.rand(dimensions[0] * dimensions[1] *
>>> dimensions[2])  # Numpy array of random floats, from 0 to 1
>>>
>>>
>>>          property_name = 'test'
>>>          numpy_array = prop_array
>>>
>>>          vtk_array = vtk.vtkDoubleArray()
>>>          vtk_array.SetName( property_name )
>>>          vtk_array.SetVoidArray( numpy_array, len(numpy_array), 1 )
>>>          self.data_set.GetCellData().AddArray( vtk_array ) # self.data_set is
>>> the vtkRectilinearGrid that this method returns to the previous code that
>>> I've sent.
>>>
>>> I'm also trying to understand and follow these examples, but I haven't
>>> gotten a success yet...
>>>
>>> Thanks!
>>>
>>>
>>>      
>> Let's keep the discussion on the mailing list so everyone can benefit/help.
>>
>> There you have added the array to the data set, but no where have you
>> told the threshold filter to use that array to do the thresholding. At
>> quick glance I wasn't sure what the syntax was for this function:
>>   threshold->SetInputArrayToProcess(....);
>>
>> But I'm pretty sure that's what you need to do.
>>
>> Thanks,
>>
>> David
>> _______________________________________________
>> Powered bywww.kitware.com
>>
>> Visit other Kitware open-source projects athttp://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>    
>
> -- 
>
>
> Adriano de Oliveira Gonçalves
> Desenvolvedor
> ESSS - DEV Rio de Janeiro
> adriano at esss.com.br
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>    

-- 


Adriano de Oliveira Gonçalves
Desenvolvedor
ESSS - DEV Rio de Janeiro
adriano at esss.com.br

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091218/6d7d4f11/attachment.htm>


More information about the vtkusers mailing list