From 87b2b8a08034eccd676cd49430220cf511f1f8b1 Mon Sep 17 00:00:00 2001 From: Edoardo Pasca Date: Thu, 8 Mar 2018 11:12:04 +0000 Subject: 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. --- Wrappers/Python/ccpi/astra/astra_processors.py | 36 ++++++++++++++------------ 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'Wrappers/Python') 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 -- cgit v1.2.3