View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0009068VTK(No Category)public2009-05-26 14:392016-08-12 09:55
Reporterppeetteerr 
Assigned ToKitware Robot 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0009068: vtkPolyDataConnectivityFilter() doesn't filter data when passed to out using vtk_to_numpy
DescriptionI'm not sure whether this is a vtkPolyDataConnectivityFilter() or a vtk_to_numpy issue, I assume the latter. vtkPolyDataConnectivityFilter() succesfully filters the data when rendering the data or writing the data to an stl. However when I use vtk_to_numpy the surronding regions are passed as well. The odd thing is that some of the regions are filtered. I can tell this by running size. In the example below SetExtractionModeToLargestRegion() eliminates some of the data (size(ar) shrinks from 618 to 597)

Using a standardized dataset the code is below

import vtk
import vtk.util.numpy_support as VN
from pylab import *

reader = vtk.vtkRectilinearGridReader()
reader.SetFileName('.\RectGrid2.vtk')

skinExtractor = vtk.vtkContourFilter()
skinExtractor.SetInputConnection(reader.GetOutputPort())
skinExtractor.SetValue(0, 5.2)

skinConnect=vtk.vtkPolyDataConnectivityFilter()
skinConnect.SetInputConnection(skinExtractor.GetOutputPort())
skinConnect.SetExtractionModeToLargestRegion()

skinNormals = vtk.vtkPolyDataNormals()
skinNormals.SetInputConnection(skinConnect.GetOutputPort())
skinNormals.SetFeatureAngle(60.0)

skinMapper = vtk.vtkPolyDataMapper()
skinMapper.SetInputConnection(skinNormals.GetOutputPort())
skinMapper.ScalarVisibilityOn()
skinMapper.SetColorModeToMapScalars()
skinMapper.SelectColorArray('scalars')

skinActor = vtk.vtkActor()
skinActor.SetMapper(skinMapper)

skinu = skinNormals.GetOutput()
# Force the pipeline to execute
skinu.Update()

ar = VN.vtk_to_numpy(skinu.GetPoints().GetData())
#print ar
temp=[]

for item in ar:
    if item[2]>0.899999:
        temp+=[item]


temp=array(temp)
x1=temp[:,0]
y1=temp[:,1]

scatter(x1,y1)
show()

ren = vtk.vtkRenderer()
ren.AddActor(skinActor)
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

ren.ResetCamera()
renWin.Render()
iren.Initialize()
iren.Start()

=========================================

TagsNo tags attached.
Project
Type
Attached Files

 Relationships

  Notes
(0037079)
Kitware Robot (administrator)
2016-08-12 09:55

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2009-05-26 14:39 ppeetteerr New Issue
2011-06-16 13:11 Zack Galbreath Category => (No Category)
2016-08-12 09:55 Kitware Robot Note Added: 0037079
2016-08-12 09:55 Kitware Robot Status expired => closed
2016-08-12 09:55 Kitware Robot Resolution open => moved
2016-08-12 09:55 Kitware Robot Assigned To => Kitware Robot


Copyright © 2000 - 2018 MantisBT Team