[vtkusers] vtkConnectivityFilter
    Andre Phillion 
    andre.phillion at epfl.ch
       
    Sun Mar 30 08:25:52 EDT 2008
    
    
  
Hello Everyone,
 
I am trying to use  vtkConnectivityFilter on a *.vtu file to extract data
based on a cell scalar value.
The scalar value ranges from 0 to 1, but I would only like those cells which
have a value greater than 0.98.
 
I have tried the attached code, but it doesnt seem to do any segmentation.
All it seems to do is create an output file that is identical to the input.
Help :-)
 
 
#!/usr/bin/env python
 
import vtk
 
reader = vtk.vtkXMLUnstructuredGridReader()
reader.SetFileName("./10gr-d100um-95fs-30.000000sec-CONN.vtu")
 
connect = vtk.vtkConnectivityFilter()
connect.SetInputConnection(reader.GetOutputPort())
connect.SetExtractionModeToAllRegions()
connect.ScalarConnectivityOn()
connect.SetScalarRange(0.98,1.0)
 
writer=vtk.vtkXMLUnstructuredGridWriter()
writer.SetDataModeToAscii()
writer.SetInputConnection(connect.GetOutputPort())
writer.SetFileName("./test.vtu")
writer.Write()
 
On a related note, if one has multiple scalar datasets, how does one tell
the vtkConnectivityFilter which scalar dataset will be used for the filter?
 
I have also enclosed a sample of the vtu file 
 
Thanks,
 
André
 
Dr. André Phillion
Laboratoire de Simulation des Matériaux
Ecole Polytechnique Fédérale de Lausanne
MXG-318, Station 12, CH-1015, Switzerland 
Tel / Fax: +41(21)693 3942 / 5890
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080330/c3448ca4/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 10gr-d100um-95fs-30.000000sec-CONN.vtu
Type: application/octet-stream
Size: 14780 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080330/c3448ca4/attachment-0002.obj>
    
    
More information about the vtkusers
mailing list