Commit a9c7cd4bdd436f47053d2337784cdc7d1c8b783d
1 parent
e96ce240
Exists in
master
and in
68 other branches
ADD: Function the select part from polydata
Showing
2 changed files
with
24 additions
and
0 deletions
Show diff stats
invesalius/data/polydata_utils.py
| @@ -132,3 +132,16 @@ def Import(filename): | @@ -132,3 +132,16 @@ def Import(filename): | ||
| 132 | reader.SetFileName(filename) | 132 | reader.SetFileName(filename) |
| 133 | reader.Update() | 133 | reader.Update() |
| 134 | return reader.GetOutput() | 134 | return reader.GetOutput() |
| 135 | + | ||
| 136 | +def SelectPolyDataPart(polydata, point): | ||
| 137 | + """ | ||
| 138 | + The function require vtkPolyData and point id | ||
| 139 | + from vtkPolyData. | ||
| 140 | + """ | ||
| 141 | + conn = vtk.vtkPolyDataConnectivityFilter() | ||
| 142 | + conn.SetInput(polydata) | ||
| 143 | + conn.SetExtractionModeToPointSeededRegions() | ||
| 144 | + conn.AddSeed(point) | ||
| 145 | + conn.Update() | ||
| 146 | + | ||
| 147 | + return conn.GetOutput() |
invesalius/data/viewer_volume.py
| @@ -670,3 +670,14 @@ class SlicePlane: | @@ -670,3 +670,14 @@ class SlicePlane: | ||
| 670 | self.plane_z.SetPlaneOrientationToZAxes() | 670 | self.plane_z.SetPlaneOrientationToZAxes() |
| 671 | self.plane_z.SetSliceIndex(number) | 671 | self.plane_z.SetSliceIndex(number) |
| 672 | 672 | ||
| 673 | + | ||
| 674 | + def PointId(self, evt, obj): | ||
| 675 | + #TODO: add in the code | ||
| 676 | + # picker = vtk.vtkPointPicker() | ||
| 677 | + # interactor.SetPicker(picker) | ||
| 678 | + # interactor.AddObserver("left...", self.PointId) | ||
| 679 | + | ||
| 680 | + x,y = evt.GetLastEventPosition() | ||
| 681 | + self.picker.Pick(x, y, 0, self.ren1) | ||
| 682 | + point_id = self.picker.GetPointId() | ||
| 683 | + | ||
| 673 | \ No newline at end of file | 684 | \ No newline at end of file |