Commit 22751b3f0c39aa8442f55cb6fb91efefc38d942b
1 parent
36bdc3c7
Exists in
master
and in
68 other branches
ENH: Improvements in progress to generate surface
Showing
1 changed file
with
7 additions
and
1 deletions
Show diff stats
invesalius/data/surface.py
| @@ -188,7 +188,7 @@ class SurfaceManager(): | @@ -188,7 +188,7 @@ class SurfaceManager(): | ||
| 188 | if imagedata_resolution: | 188 | if imagedata_resolution: |
| 189 | imagedata = iu.ResampleImage3D(imagedata, imagedata_resolution) | 189 | imagedata = iu.ResampleImage3D(imagedata, imagedata_resolution) |
| 190 | 190 | ||
| 191 | - pipeline_size = 2 | 191 | + pipeline_size = 5 |
| 192 | if decimate_reduction: | 192 | if decimate_reduction: |
| 193 | pipeline_size += 1 | 193 | pipeline_size += 1 |
| 194 | if (smooth_iterations and smooth_relaxation_factor): | 194 | if (smooth_iterations and smooth_relaxation_factor): |
| @@ -230,18 +230,24 @@ class SurfaceManager(): | @@ -230,18 +230,24 @@ class SurfaceManager(): | ||
| 230 | 230 | ||
| 231 | # Orient normals from inside to outside | 231 | # Orient normals from inside to outside |
| 232 | normals = vtk.vtkPolyDataNormals() | 232 | normals = vtk.vtkPolyDataNormals() |
| 233 | + normals.AddObserver("ProgressEvent", lambda obj,evt: | ||
| 234 | + UpdateProgress(obj, _("Generating 3D surface..."))) | ||
| 233 | normals.SetInput(polydata) | 235 | normals.SetInput(polydata) |
| 234 | normals.SetFeatureAngle(80) | 236 | normals.SetFeatureAngle(80) |
| 235 | normals.AutoOrientNormalsOn() | 237 | normals.AutoOrientNormalsOn() |
| 236 | normals.GetOutput().ReleaseDataFlagOn() | 238 | normals.GetOutput().ReleaseDataFlagOn() |
| 237 | 239 | ||
| 238 | stripper = vtk.vtkStripper() | 240 | stripper = vtk.vtkStripper() |
| 241 | + stripper.AddObserver("ProgressEvent", lambda obj,evt: | ||
| 242 | + UpdateProgress(obj, _("Generating 3D surface..."))) | ||
| 239 | stripper.SetInput(normals.GetOutput()) | 243 | stripper.SetInput(normals.GetOutput()) |
| 240 | stripper.PassThroughCellIdsOn() | 244 | stripper.PassThroughCellIdsOn() |
| 241 | stripper.PassThroughPointIdsOn() | 245 | stripper.PassThroughPointIdsOn() |
| 242 | 246 | ||
| 243 | # Map polygonal data (vtkPolyData) to graphics primitives. | 247 | # Map polygonal data (vtkPolyData) to graphics primitives. |
| 244 | mapper = vtk.vtkPolyDataMapper() | 248 | mapper = vtk.vtkPolyDataMapper() |
| 249 | + mapper.AddObserver("ProgressEvent", lambda obj,evt: | ||
| 250 | + UpdateProgress(obj, _("Generating 3D surface..."))) | ||
| 245 | mapper.SetInput(stripper.GetOutput()) | 251 | mapper.SetInput(stripper.GetOutput()) |
| 246 | mapper.ScalarVisibilityOff() | 252 | mapper.ScalarVisibilityOff() |
| 247 | 253 |