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

David Doria daviddoria+vtk at gmail.com
Thu Dec 17 09:12:56 EST 2009


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



More information about the vtkusers mailing list