diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2018-03-08 11:12:04 +0000 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2018-03-08 11:12:04 +0000 |
commit | 87b2b8a08034eccd676cd49430220cf511f1f8b1 (patch) | |
tree | 1295e6acdaea4453aaaf0e2a3dd722f2ffb642c7 /Wrappers/Python | |
parent | 8b3c127facf22d99280257ab81428ce3d72cbd01 (diff) | |
download | framework-87b2b8a08034eccd676cd49430220cf511f1f8b1.tar.gz framework-87b2b8a08034eccd676cd49430220cf511f1f8b1.tar.bz2 framework-87b2b8a08034eccd676cd49430220cf511f1f8b1.tar.xz framework-87b2b8a08034eccd676cd49430220cf511f1f8b1.zip |
Multichannel processor works with SinogramData and VolumeData
Internally the processor allocates the memory for sinograms and volume data,
passing SinogramGeometry and VolumeGeometry to SinogramData and VolumeData.
Diffstat (limited to 'Wrappers/Python')
-rw-r--r-- | Wrappers/Python/ccpi/astra/astra_processors.py | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/Wrappers/Python/ccpi/astra/astra_processors.py b/Wrappers/Python/ccpi/astra/astra_processors.py index 650e11b..8cc0df4 100644 --- a/Wrappers/Python/ccpi/astra/astra_processors.py +++ b/Wrappers/Python/ccpi/astra/astra_processors.py @@ -190,16 +190,18 @@ class AstraForwardProjectorMC(DataSetProcessor): def process(self): IM = self.getInput() - DATA = numpy.zeros((self.sinogram_geometry.angles.size, - self.sinogram_geometry.pixel_num_h, - 1, - self.sinogram_geometry.channels), - 'float32') - for k in range(self.sinogram_geometry.channels): - sinogram_id, DATA[:,:,0,k] = astra.create_sino(IM.as_array()[:,:,0,k], + #create the output Sinogram + DATA = SinogramData(geometry=self.sinogram_geometry) + #DATA = numpy.zeros((self.sinogram_geometry.angles.size, + # self.sinogram_geometry.pixel_num_h, + # 1, + # self.sinogram_geometry.channels), + # 'float32') + for k in range(DATA.geometry.channels): + sinogram_id, DATA.as_array()[k] = astra.create_sino(IM.as_array()[k], self.proj_id) astra.data2d.delete(sinogram_id) - return SinogramData(DATA,geometry=self.sinogram_geometry) + return DATA class AstraBackProjectorMC(DataSetProcessor): '''AstraBackProjector @@ -261,13 +263,15 @@ class AstraBackProjectorMC(DataSetProcessor): def process(self): DATA = self.getInput() - IM = numpy.zeros((self.volume_geometry.voxel_num_x, - self.volume_geometry.voxel_num_y, - 1, - self.volume_geometry.channels), - 'float32') - for k in range(self.volume_geometry.channels): - rec_id, IM[:,:,0,k] = astra.create_backprojection(DATA.as_array()[:,:,0,k], + #IM = numpy.zeros((self.volume_geometry.voxel_num_x, + # self.volume_geometry.voxel_num_y, + # 1, + # self.volume_geometry.channels), + # 'float32') + IM = VolumeData(geometry=self.volume_geometry) + + for k in range(IM.geometry.channels): + rec_id, IM.as_array()[k] = astra.create_backprojection(DATA.as_array()[k], self.proj_id) astra.data2d.delete(rec_id) - return VolumeData(IM,geometry=self.volume_geometry)
\ No newline at end of file + return IM
\ No newline at end of file |