Commit 48a7630298d3f734e83776175152fd7a938e5ede
1 parent
2fa9bf61
Exists in
vtk6
saving project
Showing
1 changed file
with
12 additions
and
15 deletions
Show diff stats
invesalius/data/polydata_utils.py
| ... | ... | @@ -36,7 +36,7 @@ def ApplyDecimationFilter(polydata, reduction_factor): |
| 36 | 36 | # Important: vtkQuadricDecimation presented better results than |
| 37 | 37 | # vtkDecimatePro |
| 38 | 38 | decimation = vtk.vtkQuadricDecimation() |
| 39 | - decimation.SetInput(polydata) | |
| 39 | + decimation.SetInputData(polydata) | |
| 40 | 40 | decimation.SetTargetReduction(reduction_factor) |
| 41 | 41 | decimation.GetOutput().ReleaseDataFlagOn() |
| 42 | 42 | decimation.AddObserver("ProgressEvent", lambda obj, evt: |
| ... | ... | @@ -48,7 +48,7 @@ def ApplySmoothFilter(polydata, iterations, relaxation_factor): |
| 48 | 48 | Smooth given vtkPolyData surface, based on iteration and relaxation_factor. |
| 49 | 49 | """ |
| 50 | 50 | smoother = vtk.vtkSmoothPolyDataFilter() |
| 51 | - smoother.SetInput(polydata) | |
| 51 | + smoother.SetInputData(polydata) | |
| 52 | 52 | smoother.SetNumberOfIterations(iterations) |
| 53 | 53 | smoother.SetFeatureAngle(80) |
| 54 | 54 | smoother.SetRelaxationFactor(relaxation_factor) |
| ... | ... | @@ -69,7 +69,7 @@ def FillSurfaceHole(polydata): |
| 69 | 69 | # Filter used to detect and fill holes. Only fill |
| 70 | 70 | print "Filling polydata" |
| 71 | 71 | filled_polydata = vtk.vtkFillHolesFilter() |
| 72 | - filled_polydata.SetInput(polydata) | |
| 72 | + filled_polydata.SetInputData(polydata) | |
| 73 | 73 | filled_polydata.SetHoleSize(500) |
| 74 | 74 | return filled_polydata.GetOutput() |
| 75 | 75 | |
| ... | ... | @@ -79,7 +79,7 @@ def CalculateSurfaceVolume(polydata): |
| 79 | 79 | """ |
| 80 | 80 | # Filter used to calculate volume and area from a polydata |
| 81 | 81 | measured_polydata = vtk.vtkMassProperties() |
| 82 | - measured_polydata.SetInput(polydata) | |
| 82 | + measured_polydata.SetInputData(polydata) | |
| 83 | 83 | return measured_polydata.GetVolume() |
| 84 | 84 | |
| 85 | 85 | def CalculateSurfaceArea(polydata): |
| ... | ... | @@ -88,7 +88,7 @@ def CalculateSurfaceArea(polydata): |
| 88 | 88 | """ |
| 89 | 89 | # Filter used to calculate volume and area from a polydata |
| 90 | 90 | measured_polydata = vtk.vtkMassProperties() |
| 91 | - measured_polydata.SetInput(polydata) | |
| 91 | + measured_polydata.SetInputData(polydata) | |
| 92 | 92 | return measured_polydata.GetSurfaceArea() |
| 93 | 93 | |
| 94 | 94 | def Merge(polydata_list): |
| ... | ... | @@ -96,11 +96,11 @@ def Merge(polydata_list): |
| 96 | 96 | |
| 97 | 97 | for polydata in polydata_list: |
| 98 | 98 | triangle = vtk.vtkTriangleFilter() |
| 99 | - triangle.SetInput(polydata) | |
| 100 | - append.AddInput(triangle.GetOutput()) | |
| 99 | + triangle.SetInputData(polydata) | |
| 100 | + append.AddInputData(triangle.GetOutput()) | |
| 101 | 101 | |
| 102 | 102 | clean = vtk.vtkCleanPolyData() |
| 103 | - clean.SetInput(append.GetOutput()) | |
| 103 | + clean.SetInputData(append.GetOutput()) | |
| 104 | 104 | |
| 105 | 105 | return append.GetOutput() |
| 106 | 106 | |
| ... | ... | @@ -112,7 +112,7 @@ def Export(polydata, filename, bin=False): |
| 112 | 112 | writer.SetDataModeToBinary() |
| 113 | 113 | else: |
| 114 | 114 | writer.SetDataModeToAscii() |
| 115 | - writer.SetInput(polydata) | |
| 115 | + writer.SetInputData(polydata) | |
| 116 | 116 | writer.Write() |
| 117 | 117 | |
| 118 | 118 | def Import(filename): |
| ... | ... | @@ -130,7 +130,7 @@ def JoinSeedsParts(polydata, point_id_list): |
| 130 | 130 | from vtkPolyData. |
| 131 | 131 | """ |
| 132 | 132 | conn = vtk.vtkPolyDataConnectivityFilter() |
| 133 | - conn.SetInput(polydata) | |
| 133 | + conn.SetInputData(polydata) | |
| 134 | 134 | conn.SetExtractionModeToPointSeededRegions() |
| 135 | 135 | UpdateProgress = vu.ShowProgress(1 + len(point_id_list)) |
| 136 | 136 | pos = 1 |
| ... | ... | @@ -145,7 +145,6 @@ def JoinSeedsParts(polydata, point_id_list): |
| 145 | 145 | |
| 146 | 146 | result = vtk.vtkPolyData() |
| 147 | 147 | result.DeepCopy(conn.GetOutput()) |
| 148 | - result.Update() | |
| 149 | 148 | return result |
| 150 | 149 | |
| 151 | 150 | def SelectLargestPart(polydata): |
| ... | ... | @@ -153,7 +152,7 @@ def SelectLargestPart(polydata): |
| 153 | 152 | """ |
| 154 | 153 | UpdateProgress = vu.ShowProgress(1) |
| 155 | 154 | conn = vtk.vtkPolyDataConnectivityFilter() |
| 156 | - conn.SetInput(polydata) | |
| 155 | + conn.SetInputData(polydata) | |
| 157 | 156 | conn.SetExtractionModeToLargestRegion() |
| 158 | 157 | conn.AddObserver("ProgressEvent", lambda obj, evt: |
| 159 | 158 | UpdateProgress(conn, "Getting largest part...")) |
| ... | ... | @@ -161,14 +160,13 @@ def SelectLargestPart(polydata): |
| 161 | 160 | |
| 162 | 161 | result = vtk.vtkPolyData() |
| 163 | 162 | result.DeepCopy(conn.GetOutput()) |
| 164 | - result.Update() | |
| 165 | 163 | return result |
| 166 | 164 | |
| 167 | 165 | def SplitDisconectedParts(polydata): |
| 168 | 166 | """ |
| 169 | 167 | """ |
| 170 | 168 | conn = vtk.vtkPolyDataConnectivityFilter() |
| 171 | - conn.SetInput(polydata) | |
| 169 | + conn.SetInputData(polydata) | |
| 172 | 170 | conn.SetExtractionModeToAllRegions() |
| 173 | 171 | conn.Update() |
| 174 | 172 | |
| ... | ... | @@ -191,7 +189,6 @@ def SplitDisconectedParts(polydata): |
| 191 | 189 | |
| 192 | 190 | p = vtk.vtkPolyData() |
| 193 | 191 | p.DeepCopy(conn.GetOutput()) |
| 194 | - p.Update() | |
| 195 | 192 | |
| 196 | 193 | polydata_collection.append(p) |
| 197 | 194 | if progress: | ... | ... |