File: PyIncludes.pxd

package info (click to toggle)
astra-toolbox 2.3.0-4
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 4,972 kB
  • sloc: cpp: 24,378; python: 5,048; sh: 3,514; ansic: 1,181; makefile: 518
file content (270 lines) | stat: -rw-r--r-- 10,052 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# -----------------------------------------------------------------------
# Copyright: 2010-2022, imec Vision Lab, University of Antwerp
#            2013-2022, CWI, Amsterdam
#
# Contact: astra@astra-toolbox.com
# Website: http://www.astra-toolbox.com/
#
# This file is part of the ASTRA Toolbox.
#
#
# The ASTRA Toolbox is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The ASTRA Toolbox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
#
# -----------------------------------------------------------------------

from libcpp cimport bool
from libcpp.string cimport string
from libcpp.memory cimport unique_ptr
from .PyXMLDocument cimport XMLNode

include "config.pxi"

cdef extern from "astra/Globals.h" namespace "astra":
    ctypedef float float32
    ctypedef double float64
    ctypedef unsigned short int uint16
    ctypedef signed short int sint16
    ctypedef unsigned char uchar8
    ctypedef signed char schar8
    ctypedef int int32
    ctypedef short int int16

cdef extern from "astra/Config.h" namespace "astra":
    cdef cppclass Config:
        pass

cdef extern from "astra/XMLConfig.h" namespace "astra":
    cdef cppclass XMLConfig(Config):
        XMLConfig(const string& rootname)
        XMLNode self

cdef extern from "astra/VolumeGeometry2D.h" namespace "astra":
    cdef cppclass CVolumeGeometry2D:
        bool initialize(Config)
        int getGridColCount()
        int getGridRowCount()
        int getGridTotCount()
        float32 getWindowLengthX()
        float32 getWindowLengthY()
        float32 getWindowArea()
        float32 getPixelLengthX()
        float32 getPixelLengthY()
        float32 getPixelArea()
        float32 getWindowMinX()
        float32 getWindowMinY()
        float32 getWindowMaxX()
        float32 getWindowMaxY()
        Config* getConfiguration()
        bool isEqual(const CVolumeGeometry2D&)

cdef extern from "astra/Float32Data2D.h" namespace "astra":
    cdef cppclass CCustomMemory[T]:
        pass
    cdef cppclass CFloat32CustomMemory:
        pass

cdef extern from "astra/Float32VolumeData2D.h" namespace "astra":
    cdef cppclass CFloat32VolumeData2D:
        CFloat32VolumeData2D(const CVolumeGeometry2D&)
        CFloat32VolumeData2D(const CVolumeGeometry2D&, CFloat32CustomMemory*)
        CVolumeGeometry2D& getGeometry()
        int getWidth()
        int getHeight()
        void changeGeometry(const CVolumeGeometry2D&)
        Config* getConfiguration()



cdef extern from "astra/ProjectionGeometry2D.h" namespace "astra":
    cdef cppclass CProjectionGeometry2D:
        CProjectionGeometry2D()
        bool initialize(Config)
        int getDetectorCount()
        int getProjectionAngleCount()
        bool isOfType(string)
        float32 getProjectionAngle(int)
        float32 getDetectorWidth()
        Config* getConfiguration()
        bool isEqual(const CProjectionGeometry2D&)

cdef extern from "astra/ProjectionGeometry2DFactory.h" namespace "astra":
    cdef unique_ptr[CProjectionGeometry2D] constructProjectionGeometry2D(const string&type)

cdef extern from "astra/Float32Data2D.h" namespace "astra::CFloat32Data2D":
    cdef enum TWOEDataType "astra::CFloat32Data2D::EDataType":
        TWOPROJECTION "astra::CFloat32Data2D::PROJECTION"
        TWOVOLUME "astra::CFloat32Data2D::VOLUME"

cdef extern from "astra/Data3D.h" namespace "astra::CData3D":
    cdef enum THREEEDataType "astra::CData3D::EDataType":
        THREEPROJECTION "astra::CData3D::PROJECTION"
        THREEVOLUME "astra::CData3D::VOLUME"


cdef extern from "astra/Float32Data2D.h" namespace "astra":
    cdef cppclass CFloat32Data2D:
        bool isInitialized()
        size_t getSize()
        float32 *getData()
        float32 **getData2D()
        int getWidth()
        int getHeight()
        TWOEDataType getType()

cdef extern from "astra/Float32ProjectionData2D.h" namespace "astra":
    cdef cppclass CFloat32ProjectionData2D:
        CFloat32ProjectionData2D(const CProjectionGeometry2D&)
        CFloat32ProjectionData2D(const CProjectionGeometry2D&, CFloat32CustomMemory*)
        CProjectionGeometry2D& getGeometry()
        void changeGeometry(const CProjectionGeometry2D&)
        int getDetectorCount()
        int getAngleCount()

cdef extern from "astra/Algorithm.h" namespace "astra":
    cdef cppclass CAlgorithm:
        bool initialize(Config)
        bool run(int) nogil
        bool isInitialized()

cdef extern from "astra/ReconstructionAlgorithm2D.h" namespace "astra":
    cdef cppclass CReconstructionAlgorithm2D:
        bool getResidualNorm(float32&)

cdef extern from "astra/ReconstructionAlgorithm3D.h" namespace "astra":
    cdef cppclass CReconstructionAlgorithm3D:
        bool getResidualNorm(float32&)

cdef extern from "astra/Projector2D.h" namespace "astra":
    cdef cppclass CProjector2D:
        bool isInitialized()
        bool initialize(Config)
        const CProjectionGeometry2D& getProjectionGeometry()
        const CVolumeGeometry2D& getVolumeGeometry()
        CSparseMatrix* getMatrix()

cdef extern from "astra/Projector3D.h" namespace "astra":
    cdef cppclass CProjector3D:
        bool isInitialized()
        bool initialize(Config)
        const CProjectionGeometry3D& getProjectionGeometry()
        const CVolumeGeometry3D& getVolumeGeometry()

IF HAVE_CUDA==True:
    cdef extern from "astra/CudaProjector3D.h" namespace "astra":
        cdef cppclass CCudaProjector3D

    cdef extern from "astra/CudaProjector2D.h" namespace "astra":
        cdef cppclass CCudaProjector2D

    cdef extern from "astra/Data3D.h" namespace "astraCUDA3d":
        cdef cppclass MemHandle3D:
            pass

    cdef extern from "astra/Data3D.h" namespace "astraCUDA3d":
        cdef MemHandle3D wrapHandle(float *D_ptr, unsigned int x, unsigned int y, unsigned int z, unsigned int pitch)


cdef extern from "astra/SparseMatrix.h" namespace "astra":
    cdef cppclass CSparseMatrix:
        CSparseMatrix(unsigned int,unsigned int,unsigned long)
        unsigned int m_iWidth
        unsigned int m_iHeight
        unsigned long m_lSize
        bool isInitialized()
        float32* m_pfValues
        unsigned int* m_piColIndices
        unsigned long* m_plRowStarts

cdef extern from "astra/Data3D.h" namespace "astra":
    cdef cppclass CData3D:
        bool isInitialized()
        size_t getSize()
        int getWidth()
        int getHeight()
        int getDepth()
        bool isFloat32Memory()
        float32* getFloat32Memory()
        CDataStorage *getStorage()
        THREEEDataType getType()


#cdef extern from "astra/Data3D.h" namespace "astra":
#    cdef cppclass CFloat32Data3DMemory(CFloat32Data3D):
#        CFloat32Data3DMemory()
#        void updateStatistics()
#        float32 *getData()
#        THREEEDataType getType()


cdef extern from "astra/VolumeGeometry3D.h" namespace "astra":
    cdef cppclass CVolumeGeometry3D:
        CVolumeGeometry3D()
        bool initialize(Config)
        Config * getConfiguration()
        int getGridColCount()
        int getGridRowCount()
        int getGridSliceCount()

cdef extern from "astra/ProjectionGeometry3D.h" namespace "astra":
    cdef cppclass CProjectionGeometry3D:
        CProjectionGeometry3D()
        bool initialize(Config)
        Config * getConfiguration()
        int getProjectionCount()
        int getDetectorColCount()
        int getDetectorRowCount()
        void getProjectedBBox(double, double, double, double, double, double, double&, double&, double&, double&)
        void projectPoint(double, double, double, int, double&, double&)

cdef extern from "astra/ProjectionGeometry3DFactory.h" namespace "astra":
    cdef unique_ptr[CProjectionGeometry3D] constructProjectionGeometry3D(const string&type)

cdef extern from "astra/Data3D.h" namespace "astra":
    cdef cppclass CDataStorage:
        pass
    cdef cppclass CDataMemory[T](CDataStorage):
        CDataMemory(size_t)
        CDataMemory(CCustomMemory[T]*)
        pass

cdef extern from "astra/Data3D.h" namespace "astra":
    cdef cppclass CFloat32VolumeData3D(CData3D):
        CFloat32VolumeData3D(unique_ptr[CVolumeGeometry3D]&&, CDataStorage*)
        CFloat32VolumeData3D(const CVolumeGeometry3D &, CDataStorage*)
        const CVolumeGeometry3D& getGeometry()
        void changeGeometry(const CVolumeGeometry3D&)
        void changeGeometry(unique_ptr[CVolumeGeometry3D] &&)
        int getRowCount()
        int getColCount()
        int getSliceCount()
    cdef CFloat32VolumeData3D* createCFloat32VolumeData3DMemory(unique_ptr[CVolumeGeometry3D]&&)
    cdef CFloat32VolumeData3D* createCFloat32VolumeData3DMemory(const CVolumeGeometry3D &)

cdef extern from "astra/Data3D.h" namespace "astra":
    cdef cppclass CFloat32ProjectionData3D(CData3D):
        CFloat32ProjectionData3D(unique_ptr[CProjectionGeometry3D]&&, CDataStorage*)
        CFloat32ProjectionData3D(const CProjectionGeometry3D &, CDataStorage*)
        const CProjectionGeometry3D& getGeometry()
        void changeGeometry(const CProjectionGeometry3D&)
        void changeGeometry(unique_ptr[CProjectionGeometry3D] &&)
        int getDetectorRowCount()
        int getDetectorColCount()
        int getAngleCount()
    cdef CFloat32ProjectionData3D* createCFloat32ProjectionData3DMemory(unique_ptr[CProjectionGeometry3D]&&)
    cdef CFloat32ProjectionData3D* createCFloat32ProjectionData3DMemory(const CProjectionGeometry3D &)

IF HAVE_CUDA==True:
    cdef extern from "astra/Data3D.h" namespace "astra":
        cdef cppclass CDataGPU(CDataStorage):
            CDataGPU(MemHandle3D)