[vtkusers] deleting a face from polydata
Goodwin Lawlor
goodwin.lawlor at ucd.ie
Thu Apr 8 17:14:47 EDT 2004
Hi John,
The code you have below wouldn't work because the output of
vtkExtractPolyDataGeometry would have different cell ids to the output
of vtkRemoveCellsFilter.
However, I think you could use vtkSelectVisiblePoints and its
SelectionWindow to brush a surface and get the correct cell ids. I
haven't tried this though. Have a look at the labelledMesh example. It
might be possible to add a SetSource method to save you using RemoveCell
in a loop.
Hth,
Goodwin
-----Original Message-----
From: John Hunter [mailto:jdhunter at nitace.bsd.uchicago.edu]
Sent: 08 April 2004 15:44
To: goodwin.lawlor at ucd.ie
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] deleting a face from polydata
>>>>> "Goodwin" == Goodwin Lawlor <goodwin.lawlor at ucd.ie> writes:
Goodwin> Hi John, vtkPolyData::DeleteCell just marks a cells as a
Goodwin> VTK_EMPTY_CELL type... It doesn't actually delete it
Goodwin> from the dataset.
Goodwin> I have a class and tcl example that does what you
Goodwin> want. You can get the source code here:
Goodwin>
http://www.bioengineering-research.com/vtk/vtkRemoveCellsFilter.htm
Next problem:
For real data, as opposed to the toy sphere examples, the individual
triangle cells that make up my surface are so small and numerous that
I'll be clicking for 2 years before I can get rid of all the ones I
need. I would like to create a spherical brush to get all the cells
within a region of specified radius from the selected point, and then
remove these cells using your code.
I am using a vtkExtractPolyDataGeometry filter with a vtkSphere implicit
function. My question is: can I get the cell ids from the output of
this filter to pass to your code?
My picker looks like this, with some pseudo-code at the end
def pick_cell(renwinInteractor, event):
x, y = renwinInteractor.GetEventPosition()
picker = vtk.vtkCellPicker()
picker.PickFromListOn()
picker.AddPickList(actor)
picker.SetTolerance(0.01)
picker.Pick(x, y, 0, renderer)
points = picker.GetPickedPositions()
numPoints = points.GetNumberOfPoints()
if numPoints<1: return
pnt = points.GetPoint(0)
#mark(*pnt)
implicit = vtk.vtkSphere()
implicit.SetCenter(pnt)
implicit.SetRadius(2)
extract = vtk.vtkExtractPolyDataGeometry()
extract.SetImplicitFunction(implicit)
extract.ExtractInsideOn()
extract.SetInput(sphere.GetOutput())
extract.ExtractBoundaryCellsOn()
extract.Update()
polyData = extract.GetOutput()
# here is the pseudo code
for cellIds in polyData.GetCellIds():
remove.RemoveCell(cellId)
Is this possible? Is there a better way to remove the cells inside the
implicit sphere that doesn't require vtkRemoveCellsFilter?
Thanks,
John Hunter
More information about the vtkusers
mailing list