1 """Compiled structure for linear baseline between nodes.
2
3 Copyright 2008-2012 Research Foundation State University of New York
4 This file is part of QUB Express.
5
6 QUB Express is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 QUB Express is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License,
17 named LICENSE.txt, in the QUB Express program directory. If not, see
18 <http://www.gnu.org/licenses/>.
19
20 """
21
22 from qubx.fast.fast_utils import *
23
24
28 PBaselineNode = POINTER(BaselineNodeRec)
29 PPBaselineNode = POINTER(PBaselineNode)
30
34 PBaselineSeg = POINTER(BaselineSegRec)
35
36 qubfast.QUB_BaselineSeg_Create.argtypes = (c_int, c_int)
37 qubfast.QUB_BaselineSeg_Create.restype = PBaselineSeg
38 qubfast.QUB_BaselineSeg_Free.argtypes = (PBaselineSeg,)
39 qubfast.QUB_BaselineSeg_Free.restype = None
40 qubfast.QUB_BaselineSeg_GetNodeCount.argtypes = (PBaselineSeg,)
41 qubfast.QUB_BaselineSeg_GetNodeCount.restype = c_int
42 qubfast.QUB_BaselineSeg_GetFirstNode.argtypes = (PBaselineSeg,)
43 qubfast.QUB_BaselineSeg_GetFirstNode.restype = PBaselineNode
44 qubfast.QUB_BaselineSeg_GetLastNode.argtypes = (PBaselineSeg,)
45 qubfast.QUB_BaselineSeg_GetLastNode.restype = PBaselineNode
46 qubfast.QUB_BaselineSeg_GetNodeBefore.argtypes = (PBaselineSeg, PBaselineNode)
47 qubfast.QUB_BaselineSeg_GetNodeBefore.restype = PBaselineNode
48 qubfast.QUB_BaselineSeg_GetNodeAfter.argtypes = (PBaselineSeg, PBaselineNode)
49 qubfast.QUB_BaselineSeg_GetNodeAfter.restype = PBaselineNode
50 qubfast.QUB_BaselineSeg_InterpolateValueAt.argtypes = (PBaselineSeg, c_int)
51 qubfast.QUB_BaselineSeg_InterpolateValueAt.restype = c_float
52 qubfast.QUB_BaselineSeg_GetRangeAt.argtypes = (PBaselineSeg, c_int, PPBaselineNode, PPBaselineNode)
53 qubfast.QUB_BaselineSeg_GetRangeAt.restype = c_int
54 qubfast.QUB_BaselineSeg_GetRangeBefore.argtypes = (PBaselineSeg, PPBaselineNode, PPBaselineNode)
55 qubfast.QUB_BaselineSeg_GetRangeBefore.restype = c_int
56 qubfast.QUB_BaselineSeg_GetRangeAfter.argtypes = (PBaselineSeg, PPBaselineNode, PPBaselineNode)
57 qubfast.QUB_BaselineSeg_GetRangeAfter.restype = c_int
58 qubfast.QUB_BaselineSeg_AddNode.argtypes = (PBaselineSeg, c_int, c_float)
59 qubfast.QUB_BaselineSeg_AddNode.restype = PBaselineNode
60 qubfast.QUB_BaselineSeg_AddNodes.argtypes = (PBaselineSeg, c_int, c_int_p, c_float_p)
61 qubfast.QUB_BaselineSeg_AddNodes.restype = PBaselineNode
62 qubfast.QUB_BaselineSeg_ClearNodes.argtypes = (PBaselineSeg, c_int, c_int, c_int)
63 qubfast.QUB_BaselineSeg_ClearNodes.restype = None
64
65
74 return qubfast.QUB_BaselineSeg_GetNodeCount(self.obj)
76 pnode = qubfast.QUB_BaselineSeg_GetFirstNode(self.obj)
77 if pnode:
78 return BaselineNode(self.obj, pnode)
79 else:
80 return None
82 pnode = qubfast.QUB_BaselineSeg_GetLastNode(self.obj)
83 if pnode:
84 return BaselineNode(self.obj, pnode)
85 else:
86 return None
89
106 - def clear_nodes(self, first, last, repairFirstLast=True):
108
116 pnode = qubfast.QUB_BaselineSeg_GetNodeBefore(self.obj, self.pnode)
117 if pnode:
118 return BaselineNode(self.obj, pnode)
119 else:
120 return None
122 pnode = qubfast.QUB_BaselineSeg_GetNodeAfter(self.obj, self.pnode)
123 if pnode:
124 return BaselineNode(self.obj, pnode)
125 else:
126 return None
127
130 self.node_a = node_a
131 self.node_b = node_b
148