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

Adriano Gonçalves adriano at esss.com.br
Fri Jan 15 09:53:45 EST 2010


Hi David,
I've just seen your message, just now. I used FIELD_ASSOCIATION_CELLS 
because I'm working with the data in the cells, not in the points.

Thanks!

Adriano

Em 08/01/2010 21:21, David Doria escreveu:
> On Fri, Dec 18, 2009 at 1:21 PM, David Doria<daviddoria+vtk at gmail.com>  wrote:
>    
>> On Fri, Dec 18, 2009 at 12:51 PM, Bill Lorensen<bill.lorensen at gmail.com>  wrote:
>>      
>>>  From vtkThreshold:
>>> // vtkThreshold is a filter that EXTRACTS CELLS from any dataset type that
>>> // satisfy a threshold criterion. A cell satisfies the criterion if the
>>> // scalar value of (every or any) point satisfies the criterion. The
>>> // criterion can take three forms: 1) greater than a particular value; 2)
>>> // less than a particular value; or 3) between two values. The output of this
>>> // filter is an unstructured grid.
>>>
>>> I don't think you have defined any cells have you?
>>>
>>> On Fri, Dec 18, 2009 at 12:38 PM, David Doria<daviddoria+vtk at gmail.com>  wrote:
>>>        
>>>> 2009/12/18 Adriano Gonçalves<adriano at esss.com.br>
>>>>          
>>>>> 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
>>>>>
>>>>>            
>>>> Adriano,
>>>>
>>>> I'm glad you got it to work, but I'm not sure you used it correctly.
>>>>
>>>> In my example:
>>>> http://www.cmake.org/Wiki/VTK/Examples/Thresholding
>>>>
>>>> Since I set the array to the PointData, I used
>>>>
>>>> threshold->SetInputArrayToProcess(0, 0, 0,
>>>> vtkDataObject::FIELD_ASSOCIATION_POINTS,
>>>> vtkDataSetAttributes::SCALARS);
>>>>
>>>> These first three parameters (idx, port, connection) should all be 0
>>>> because I only have one array and input data set, right? The last two
>>>> params seem reasonable.
>>>>
>>>> Anyone know why this still wouldn't work? Is there no way to set the
>>>> array to process by it's name as is done with many other filters?
>>>>
>>>> Thanks,
>>>>
>>>> David
>>>>          
>> As bill pointed out, vtkThreshold only thresholds cells, even though
>> you have to specify that you want to threshold cells (very odd).
>>
>> You can use vtkThresholdPoints to threshold points (this works as expected):
>> http://www.cmake.org/Wiki/VTK/Examples/Thresholding_Points
>>
>> I tried to add some triangles and then threshold the values on the
>> cells, but it is still producing 0 points and cells. I added the array
>> to the cellData (polydata->GetCellData()->AddArray(index);), changed
>> one of the parameters to vtkDataObject::FIELD_ASSOCIATION_CELLS, and
>> changed vtkThresholdPoints to vtkThreshold.
>> http://www.cmake.org/Wiki/VTK/Examples/Thresholding_Cells
>>
>> I don't have time to look into this further right now - it's on my
>> to-do list unless someone gets to it first. Adriano - would you mind
>> looking into it?
>>
>> Thanks,
>>
>> David
>>
>>      
> Bryn fixed this - it works now:
> http://www.cmake.org/Wiki/VTK/Examples/Thresholding_Cells
>
> Thanks Bryn!
>
> David
> _______________________________________________
> 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
>    



More information about the vtkusers mailing list