I'm trying to reconstruct CT images stack, the number of images is 3500, the dimensions of each image is 2560*2160. I'm getting this error: ValueError: The dimensions of the data do not match those specified in the geometry: (3500, 2160, 2560) != (2160, 2560) Thanks for help!
import numpy as np
import astra
import tifffile
Load the TIFF file containing the CT data
data = tifffile.imread(r"E:\Norm.tif")
Define the reconstruction geometry
vol_geom = astra.create_vol_geom(data.shape[1], data.shape[2], data.shape[0])
Define the projection geometry
angles = np.linspace(0, 2*np.pi, data.shape[0], False)
proj_geom = astra.create_proj_geom('parallel', 1.0, data.shape[2], angles)
Create a projector object
proj_id = astra.create_projector('linear', proj_geom, vol_geom)
Create a sinogram from the CT data
sinogram_id, sinogram = astra.create_sino(data, proj_id)
Create a reconstruction object
recon_id = astra.data3d.create('-vol', vol_geom)
Set the parameters for the reconstruction algorithm
cfg = astra.astra_dict('SIRT3D_CUDA')
cfg['ProjectionDataId'] = sinogram_id
cfg['ReconstructionDataId'] = recon_id
cfg['option'] = {'MinConstraint': 0, 'MaxConstraint': 0.02}
Run the reconstruction algorithm
alg_id = astra.algorithm.create(cfg)
astra.algorithm.run(alg_id)
Get the reconstructed volume
recon = astra.data3d.get(recon_id)
Save the reconstructed volume as a TIFF file
tifffile.imwrite('reconstructed_volume.tif', recon)