def process(self): volume = self.get_input() volume_axes = volume.get_data_axes_order(new_order=self.default_image_axes_order) if not volume_axes == [0,1,2]: volume.array = numpy.transpose(volume.array, volume_axes) pixel_per_voxel = 1 # should be estimated from image_geometry and # acquisition_geometry if self.acquisition_geometry.geom_type == 'parallel': pixels = pbalg.pb_forward_project(volume.as_array(), self.acquisition_geometry.angles, pixel_per_voxel) out = AcquisitionData(geometry=self.acquisition_geometry, label_dimensions=self.default_acquisition_axes_order) out.fill(pixels) out_axes = out.get_data_axes_order(new_order=self.output_axes_order) if not out_axes == [0,1,2]: out.array = numpy.transpose(out.array, out_axes) return out else: raise ValueError('Cannot process cone beam')
from ccpi.optimisation.algs import CGLS import numpy # Set up reader object and read the data datareader = XTEKReader("REPLACE_THIS_BY_PATH_TO_DATASET/SophiaBeads_256_averaged.xtekct") data = datareader.get_acquisition_data() # Crop data and fix dimension labels data = AcquisitionData(data.array[:,:,901:1101], geometry=data.geometry, dimension_labels=['angle','horizontal','vertical']) data.geometry.pixel_num_v = 200 # Scale and negative-log transform data.array = -np.log(data.as_array()/60000.0) # Apply centering correction by zero padding, amount found manually cor_pad = 30 data_pad = np.zeros((data.shape[0],data.shape[1]+cor_pad,data.shape[2])) data_pad[:,cor_pad:,:] = data.array data.geometry.pixel_num_h = data.geometry.pixel_num_h + cor_pad data.array = data_pad # Choose the number of voxels to reconstruct onto as number of detector pixels N = data.geometry.pixel_num_h # Geometric magnification mag = (np.abs(data.geometry.dist_center_detector) + \ np.abs(data.geometry.dist_source_center)) / \ np.abs(data.geometry.dist_source_center)