From a9c7cd4bdd436f47053d2337784cdc7d1c8b783d Mon Sep 17 00:00:00 2001 From: paulojamorim Date: Wed, 18 Nov 2009 16:32:34 +0000 Subject: [PATCH] ADD: Function the select part from polydata --- invesalius/data/polydata_utils.py | 13 +++++++++++++ invesalius/data/viewer_volume.py | 11 +++++++++++ 2 files changed, 24 insertions(+), 0 deletions(-) diff --git a/invesalius/data/polydata_utils.py b/invesalius/data/polydata_utils.py index 2966a23..e9969eb 100644 --- a/invesalius/data/polydata_utils.py +++ b/invesalius/data/polydata_utils.py @@ -132,3 +132,16 @@ def Import(filename): reader.SetFileName(filename) reader.Update() return reader.GetOutput() + +def SelectPolyDataPart(polydata, point): + """ + The function require vtkPolyData and point id + from vtkPolyData. + """ + conn = vtk.vtkPolyDataConnectivityFilter() + conn.SetInput(polydata) + conn.SetExtractionModeToPointSeededRegions() + conn.AddSeed(point) + conn.Update() + + return conn.GetOutput() diff --git a/invesalius/data/viewer_volume.py b/invesalius/data/viewer_volume.py index 80357fd..37e6fa9 100755 --- a/invesalius/data/viewer_volume.py +++ b/invesalius/data/viewer_volume.py @@ -670,3 +670,14 @@ class SlicePlane: self.plane_z.SetPlaneOrientationToZAxes() self.plane_z.SetSliceIndex(number) + + def PointId(self, evt, obj): + #TODO: add in the code + # picker = vtk.vtkPointPicker() + # interactor.SetPicker(picker) + # interactor.AddObserver("left...", self.PointId) + + x,y = evt.GetLastEventPosition() + self.picker.Pick(x, y, 0, self.ren1) + point_id = self.picker.GetPointId() + \ No newline at end of file -- libgit2 0.21.2