-
Notifications
You must be signed in to change notification settings - Fork 184
Expand file tree
/
Copy pathvmtkpointsplitextractor.py
More file actions
88 lines (67 loc) · 3.2 KB
/
Copy pathvmtkpointsplitextractor.py
File metadata and controls
88 lines (67 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkpointSplitextractor.py,v $
## Language: Python
## Date: $Date: 2006/03/01 11:54:16 $
## Version: $Revision: 1.9 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE. See the above copyright notices for more information.
from __future__ import absolute_import #NEEDS TO STAY AS TOP LEVEL MODULE FOR Py2-3 COMPATIBILITY
import vtk
from vmtk import vtkvmtk
import sys
from vmtk import pypes
class vmtkPointSplitExtractor(pypes.pypeScript):
def __init__(self):
pypes.pypeScript.__init__(self)
self.Centerlines = None
self.RadiusArrayName = 'MaximumInscribedSphereRadius'
self.GroupIdsArrayName = 'GroupIds'
self.CenterlineIdsArrayName = 'CenterlineIds'
self.BlankingArrayName = 'Blanking'
self.TractIdsArrayName = 'TractIds'
self.SplitPoint = [0.0,0.0,0.0]
self.GapLength = 1.0
self.Tolerance = 1E-4
self.SetScriptName('vmtkpointsplitextractor')
self.SetScriptDoc('split a centerline at specific xyz coordinates')
self.SetInputMembers([
['Centerlines','i','vtkPolyData',1,'','','vmtksurfacereader'],
['GroupIdsArrayName','groupidsarray','str',1],
['TractIdsArrayName','tractidsarray','str',1],
['CenterlineIdsArrayName','centerlineidsarray','str',1],
['RadiusArrayName','radiusarray','str',1],
['BlankingArrayName','blankingarray','str',1],
['SplitPoint','splitpoint','float',3],
['GapLength','gaplength','float',1,'(0.0,)'],
['Tolerance','tolerance','float',1,'(0.0,)']
])
self.SetOutputMembers([
['Centerlines','o','vtkPolyData',1,'','','vmtksurfacewriter'],
['GroupIdsArrayName','groupidsarray','str',1],
['TractIdsArrayName','tractidsarray','str',1],
['CenterlineIdsArrayName','centerlineidsarray','str',1],
['BlankingArrayName','blankingarray','str',1]
])
def Execute(self):
if self.Centerlines == None:
self.PrintError('Error: No input centerlines.')
pointSplitExtractor = vtkvmtk.vtkvmtkCenterlineSplitExtractor()
pointSplitExtractor.SetInputData(self.Centerlines)
pointSplitExtractor.SetRadiusArrayName(self.RadiusArrayName)
pointSplitExtractor.SetGroupIdsArrayName(self.GroupIdsArrayName)
pointSplitExtractor.SetTractIdsArrayName(self.TractIdsArrayName)
pointSplitExtractor.SetCenterlineIdsArrayName(self.CenterlineIdsArrayName)
pointSplitExtractor.SetBlankingArrayName(self.BlankingArrayName)
pointSplitExtractor.SetSplitPoint(self.SplitPoint)
pointSplitExtractor.SetGapLength(self.GapLength)
pointSplitExtractor.SetTolerance(self.Tolerance)
pointSplitExtractor.Update()
self.Centerlines = pointSplitExtractor.GetOutput()
if __name__=='__main__':
main = pypes.pypeMain()
main.Arguments = sys.argv
main.Execute()