File: vmtkbifurcationvectors.py

package info (click to toggle)
vmtk 1.0.1-3
  • links: PTS, VCS
  • area: non-free
  • in suites: jessie, jessie-kfreebsd
  • size: 8,632 kB
  • ctags: 8,076
  • sloc: cpp: 79,872; ansic: 31,817; python: 18,860; perl: 381; makefile: 118; sh: 15; tcl: 1
file content (121 lines) | stat: -rw-r--r-- 6,787 bytes parent folder | download | duplicates (2)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/usr/bin/env python

## Program:   VMTK
## Module:    $RCSfile: vmtkbifurcationvectors.py,v $
## Language:  Python
## Date:      $Date: 2006/10/17 15:16:16 $
## Version:   $Revision: 1.1 $

##   Copyright (c) Luca Antiga, David Steinman. All rights reserved.
##   See LICENCE 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.


import vtk
import vtkvmtk
import sys

import pypes

vmtkbifurcationvectors = 'vmtkBifurcationVectors'

class vmtkBifurcationVectors(pypes.pypeScript):

    def __init__(self):

        pypes.pypeScript.__init__(self)
        
        self.Centerlines = None
        self.ReferenceSystems = None
        self.BifurcationVectors = None

        self.RadiusArrayName = ''
        self.GroupIdsArrayName = ''
        self.CenterlineIdsArrayName = ''
        self.TractIdsArrayName = ''
        self.BlankingArrayName = ''
        self.ReferenceSystemsNormalArrayName = ''
        self.ReferenceSystemsUpNormalArrayName = ''

        self.BifurcationVectorsArrayName = 'BifurcationVectors'
        self.InPlaneBifurcationVectorsArrayName = 'InPlaneBifurcationVectors'
        self.OutOfPlaneBifurcationVectorsArrayName = 'OutOfPlaneBifurcationVectors'
        self.InPlaneBifurcationVectorAnglesArrayName = 'InPlaneBifurcationVectorAngles'
        self.OutOfPlaneBifurcationVectorAnglesArrayName = 'OutOfPlaneBifurcationVectorAngles'

        self.BifurcationVectorsOrientationArrayName = 'BifurcationVectorsOrientation'
        self.BifurcationGroupIdsArrayName = 'BifurcationGroupIds'
        self.NormalizeBifurcationVectors = 0

        self.SetScriptName('vmtkbifurcationvectors')
        self.SetScriptDoc('.')
        self.SetInputMembers([
            ['Centerlines','i','vtkPolyData',1,'','the input split centerlines','vmtksurfacereader'],
            ['ReferenceSystems','referencesystems','vtkPolyData',1,'','reference systems relative to the split centerlines','vmtksurfacereader'],
      	    ['RadiusArrayName','radiusarray','str',1,'','name of the array where centerline radius values are stored'],
      	    ['GroupIdsArrayName','groupidsarray','str',1,'','name of the array where centerline group ids are stored'],
      	    ['CenterlineIdsArrayName','centerlineidsarray','str',1,'','name of the array where centerline ids are stored'],
      	    ['TractIdsArrayName','tractidsarray','str',1,'','name of the array where centerline tract ids are stored'],
      	    ['BlankingArrayName','blankingarray','str',1,'','name of the array where blanking information about branches is stored'],
      	    ['ReferenceSystemsNormalArrayName','normalarray','str',1,'','name of the array where reference system normal vectors are stored'],
      	    ['ReferenceSystemsUpNormalArrayName','upnormalarray','str',1,'','name of the array where reference system upnormal vectors are stored'],
      	    ['BifurcationVectorsArrayName','vectorsarray','str',1,''],
      	    ['InPlaneBifurcationVectorsArrayName','inplanevectorsarray','str',1,''],
      	    ['OutOfPlaneBifurcationVectorsArrayName','outofplanevectorsarray','str',1,''],
      	    ['InPlaneBifurcationVectorAnglesArrayName','inplaneanglesarray','str',1,''],
      	    ['OutOfPlaneBifurcationVectorAnglesArrayName','outofplaneanglesarray','str',1,''],
      	    ['BifurcationVectorsOrientationArrayName','orientationarray','str',1,''],
      	    ['BifurcationGroupIdsArrayName','bifurcationgroupidsarray','str',1,''],
            ['NormalizeBifurcationVectors','normalizevectors','bool',1,'']
            ])
        self.SetOutputMembers([
            ['BifurcationVectors','o','vtkPolyData',1,'','the output data','vmtksurfacewriter'],
      	    ['BifurcationVectorsArrayName','vectorsarray','str',1,''],
      	    ['InPlaneBifurcationVectorsArrayName','inplanevectorsarray','str',1,''],
      	    ['OutOfPlaneBifurcationVectorsArrayName','outofplanevectorsarray','str',1,''],
      	    ['InPlaneBifurcationVectorAnglesArrayName','inplaneanglesarray','str',1,''],
      	    ['OutOfPlaneBifurcationVectorAnglesArrayName','outofplaneanglesarray','str',1,''],
      	    ['BifurcationVectorsOrientationArrayName','orientationarray','str',1,''],
      	    ['BifurcationGroupIdsArrayName','bifurcationgroupidsarray','str',1,'']
            ])

    def Execute(self):

        if self.Centerlines == None:
            self.PrintError('Error: No input centerlines.')

        if self.ReferenceSystems == None:
            self.PrintError('Error: No input reference systems.')

        centerlineBifurcationVectors = vtkvmtk.vtkvmtkCenterlineBifurcationVectors()
        centerlineBifurcationVectors.SetInput(self.Centerlines)
        centerlineBifurcationVectors.SetReferenceSystems(self.ReferenceSystems)
        centerlineBifurcationVectors.SetRadiusArrayName(self.RadiusArrayName)
        centerlineBifurcationVectors.SetGroupIdsArrayName(self.GroupIdsArrayName)
        centerlineBifurcationVectors.SetCenterlineIdsArrayName(self.CenterlineIdsArrayName)
        centerlineBifurcationVectors.SetTractIdsArrayName(self.TractIdsArrayName)
        centerlineBifurcationVectors.SetBlankingArrayName(self.BlankingArrayName)
        centerlineBifurcationVectors.SetReferenceSystemGroupIdsArrayName(self.GroupIdsArrayName)
        centerlineBifurcationVectors.SetReferenceSystemNormalArrayName(self.ReferenceSystemsNormalArrayName)
        centerlineBifurcationVectors.SetReferenceSystemUpNormalArrayName(self.ReferenceSystemsUpNormalArrayName)
        centerlineBifurcationVectors.SetBifurcationVectorsArrayName(self.BifurcationVectorsArrayName)
        centerlineBifurcationVectors.SetInPlaneBifurcationVectorsArrayName(self.InPlaneBifurcationVectorsArrayName)
        centerlineBifurcationVectors.SetOutOfPlaneBifurcationVectorsArrayName(self.OutOfPlaneBifurcationVectorsArrayName)
        centerlineBifurcationVectors.SetInPlaneBifurcationVectorAnglesArrayName(self.InPlaneBifurcationVectorAnglesArrayName)
        centerlineBifurcationVectors.SetOutOfPlaneBifurcationVectorAnglesArrayName(self.OutOfPlaneBifurcationVectorAnglesArrayName)
        centerlineBifurcationVectors.SetBifurcationVectorsOrientationArrayName(self.BifurcationVectorsOrientationArrayName)
        centerlineBifurcationVectors.SetBifurcationGroupIdsArrayName(self.BifurcationGroupIdsArrayName)
        centerlineBifurcationVectors.SetNormalizeBifurcationVectors(self.NormalizeBifurcationVectors)
        centerlineBifurcationVectors.Update()

        self.BifurcationVectors = centerlineBifurcationVectors.GetOutput()


if __name__=='__main__':

    main = pypes.pypeMain()
    main.Arguments = sys.argv
    main.Execute()