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 | 156 | conn.Update() |
| 157 | 157 | |
| 158 | 158 | nregions = conn.GetNumberOfExtractedRegions() |
| 159 | - | |
| 159 | + | |
| 160 | + conn.SetExtractionModeToSpecifiedRegions() | |
| 161 | + conn.ScalarConnectivityOn() | |
| 162 | + conn.SetScalarRange(226, 3021) | |
| 163 | + conn.Update() | |
| 164 | + | |
| 160 | 165 | polydata_collection = [] |
| 161 | 166 | |
| 162 | 167 | |
| ... | ... | @@ -164,7 +169,7 @@ def SplitDisconectedParts(polydata): |
| 164 | 169 | conn.InitializeSpecifiedRegionList() |
| 165 | 170 | conn.AddSpecifiedRegion(region) |
| 166 | 171 | conn.Update() |
| 167 | - | |
| 172 | + | |
| 168 | 173 | p = vtk.vtkPolyData() |
| 169 | 174 | p.DeepCopy(conn.GetOutput()) |
| 170 | 175 | p.Update() |
| ... | ... | @@ -172,4 +177,3 @@ def SplitDisconectedParts(polydata): |
| 172 | 177 | polydata_collection.append(p) |
| 173 | 178 | |
| 174 | 179 | return polydata_collection |
| 175 | - | ... | ... |