[vtkusers] problems using vtkConnectivityFilter

brizzi at deis.unibo.it brizzi at deis.unibo.it
Wed Jul 26 16:46:45 EDT 2006


I need to label the result of a contour filtering. I tried to use
vtkConnectivityFilter, but when I visualize the result I can see an object red
and the others 37 blu. I would like to visualize any object in a different
color. Any suggestion?

Thank you in advance


vtkStructuredPointsReader reader
#  reader SetFileName
  reader SetFileName "geocurv_cropped_030306_Series007_t09_ch01_1000.vtk"

set xMin 0
set yMin 0
set zMin 0
set xMax 109
set yMax 109
set zMax 28

set sx 0.584793
set sy 0.584793
set sz 1.04892

set ox 0
set oy 0
set oz 0

vtkContourFilter CF
  CF SetInput  [reader GetOutput]
  CF SetValue 0 60

#vtkPolyDataMapper PDM
#   PDM SetInput [CF GetOutput]
   #PDM ScalarVisibilityOff

#vtkActor A
 #  A SetMapper PDM

# Create the RenderWindow and Renderer
vtkRenderer ren1
vtkRenderWindow renWin
  renWin AddRenderer ren1
vtkRenderWindowInteractor RWI
RWI SetRenderWindow renWin
RWI Initialize
RWI AddObserver UserEvent {wm deiconify .vtkInteract}

vtkConnectivityFilter CF1
  CF1 SetInput [CF GetOutput]
  CF1 SetExtractionModeToAllRegions
  CF1 ColorRegionsOn

vtkExtractUnstructuredGrid EUG
  EUG SetInput [CF1 GetOutput]
  #CF1 SetScalarRange 0 255
#CF1 GetClosestPoint
vtkGeometryFilter GF
  GF SetInput [EUG GetOutput]

vtkPolyDataMapper PDM1
   PDM1 SetInput [GF GetOutput]
   PDM1 ScalarVisibilityOn
vtkActor A1
   A1 SetMapper PDM1

# Add the outline actor to the renderer, set the background color and size
#ren1 AddActor outlineActor
#ren1 AddActor A
ren1 AddActor A1
renWin SetSize 600 600
ren1 SetBackground  0.1 0.1 0.2
renWin Render
console show
set regions [CF1 GetNumberOfExtractedRegions]

This message was sent using IMP, the Internet Messaging Program.

More information about the vtkusers mailing list