Commit 3b3ba257489181edf97470e00159b7b7c3568e61

Authored by tfmoraes
1 parent 7b2c767a

ADD: Filling holes in the surface pipeline

invesalius/data/surface.py
@@ -137,6 +137,17 @@ class SurfaceManager(): @@ -137,6 +137,17 @@ class SurfaceManager():
137 UpdateProgress(smoother, "Smoothing surface...")) 137 UpdateProgress(smoother, "Smoothing surface..."))
138 polydata = smoother.GetOutput() 138 polydata = smoother.GetOutput()
139 139
  140 + # Filter used to detect and fill holes. Only fill boundary edges holes.
  141 + #TODO: Hey! This piece of code is the same from
  142 + # polydata_utils.FillSurfaceHole, we need to review this.
  143 + filled_polydata = vtk.vtkFillHolesFilter()
  144 + filled_polydata.SetInput(polydata)
  145 + filled_polydata.SetHoleSize(500)
  146 + filled_polydata.AddObserver("ProgressEvent", lambda obj, evt:
  147 + UpdateProgress(filled_polydata,
  148 + "Filling polydata..."))
  149 + polydata = filled_polydata.GetOutput()
  150 +
140 # Orient normals from inside to outside 151 # Orient normals from inside to outside
141 normals = vtk.vtkPolyDataNormals() 152 normals = vtk.vtkPolyDataNormals()
142 normals.SetInput(polydata) 153 normals.SetInput(polydata)
@@ -231,4 +242,4 @@ class SurfaceManager(): @@ -231,4 +242,4 @@ class SurfaceManager():
231 # Update value in project's surface_dict 242 # Update value in project's surface_dict
232 proj = Project() 243 proj = Project()
233 proj.surface_dict[index].colour = colour 244 proj.surface_dict[index].colour = colour
234 - ps.Publisher().sendMessage('Render volume viewer')  
235 \ No newline at end of file 245 \ No newline at end of file
  246 + ps.Publisher().sendMessage('Render volume viewer')
invesalius/reader/dicom.py
@@ -1339,7 +1339,7 @@ class Parser(): @@ -1339,7 +1339,7 @@ class Parser():
1339 img = self.gdcm_reader.GetImage() 1339 img = self.gdcm_reader.GetImage()
1340 direc_cosines = img.GetDirectionCosines() 1340 direc_cosines = img.GetDirectionCosines()
1341 orientation = gdcm.Orientation() 1341 orientation = gdcm.Orientation()
1342 - type = orientation.GetType(direc_cosines) 1342 + type = orientation.GetType(tuple(direc_cosines))
1343 label = orientation.GetLabel(type) 1343 label = orientation.GetLabel(type)
1344 1344
1345 if (label): 1345 if (label):