Commit 033c91ddae0c56e7585384b3f7474728f36de374
1 parent
c056c6c5
Exists in
master
and in
68 other branches
ENH: Improved method to extract all regions
Showing
1 changed file
with
7 additions
and
3 deletions
Show diff stats
invesalius/data/polydata_utils.py
| @@ -156,7 +156,12 @@ def SplitDisconectedParts(polydata): | @@ -156,7 +156,12 @@ def SplitDisconectedParts(polydata): | ||
| 156 | conn.Update() | 156 | conn.Update() |
| 157 | 157 | ||
| 158 | nregions = conn.GetNumberOfExtractedRegions() | 158 | nregions = conn.GetNumberOfExtractedRegions() |
| 159 | - | 159 | + |
| 160 | + conn.SetExtractionModeToSpecifiedRegions() | ||
| 161 | + conn.ScalarConnectivityOn() | ||
| 162 | + conn.SetScalarRange(226, 3021) | ||
| 163 | + conn.Update() | ||
| 164 | + | ||
| 160 | polydata_collection = [] | 165 | polydata_collection = [] |
| 161 | 166 | ||
| 162 | 167 | ||
| @@ -164,7 +169,7 @@ def SplitDisconectedParts(polydata): | @@ -164,7 +169,7 @@ def SplitDisconectedParts(polydata): | ||
| 164 | conn.InitializeSpecifiedRegionList() | 169 | conn.InitializeSpecifiedRegionList() |
| 165 | conn.AddSpecifiedRegion(region) | 170 | conn.AddSpecifiedRegion(region) |
| 166 | conn.Update() | 171 | conn.Update() |
| 167 | - | 172 | + |
| 168 | p = vtk.vtkPolyData() | 173 | p = vtk.vtkPolyData() |
| 169 | p.DeepCopy(conn.GetOutput()) | 174 | p.DeepCopy(conn.GetOutput()) |
| 170 | p.Update() | 175 | p.Update() |
| @@ -172,4 +177,3 @@ def SplitDisconectedParts(polydata): | @@ -172,4 +177,3 @@ def SplitDisconectedParts(polydata): | ||
| 172 | polydata_collection.append(p) | 177 | polydata_collection.append(p) |
| 173 | 178 | ||
| 174 | return polydata_collection | 179 | return polydata_collection |
| 175 | - |