def testLoadProjection(self): xtekReader = XTEKReader(self.filename) pixels = xtekReader.loadProjection() self.assertEqual(pixels.shape, (63, 500, 500), "projections shape doesn't match")
def testLoad(self): xtekReader = XTEKReader(self.filename) self.assertEqual(xtekReader.geometry.pixel_num_h, 500, "Detector pixel X size is not correct") self.assertEqual(xtekReader.geometry.pixel_num_v, 500, "Detector pixel Y size is not correct") self.assertEqual(xtekReader.geometry.dist_source_center, -80.6392412185669, "Distance from source to center is not correct") self.assertEqual(xtekReader.geometry.dist_center_detector, (1007.006 - 80.6392412185669), "Distance from center to detector is not correct")
def testReadAngles(self): xtekReader = XTEKReader(self.filename) angles = xtekReader.readAngles() self.assertEqual(angles.shape, (63,), "Angles doesn't match") self.assertAlmostEqual(angles[46], -085.717, 3, "46th Angles doesn't match")
# https://zenodo.org/record/16474 # The filename with full path to the .xtekct file should be given as string # input to XTEKReader to load in the data. # Do all imports from ccpi.io.reader import XTEKReader import numpy as np import matplotlib.pyplot as plt from ccpi.framework import ImageGeometry, AcquisitionData, ImageData from ccpi.astra.ops import AstraProjector3DSimple 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