CERN/TIGRE

Python Demo d15 not working

Closed this issue · 1 comments

Expected Behavior

Expected to successfully run the demo problem.

Actual Behavior

Error is thrown in tigre/algorithms/single_pass_algorithms.py

File ".../tigre/algorithms/single_pass_algorithms.py", line 200, in fbp
return Atb(proj_filt, geo, angles, gpuids=gpuids)* geo.DSO[0] / geo.DSD[0]
IndexError: invalid index to scalar variable.

Error seems to be with geo.DSO and geo.DSD which are both float32 and not int and therefore the code expects them as arrays and tries to get their first values.

Code to reproduce the problem (If applicable)

Code from the demo

geo = tigre.geometry(
    mode="parallel", nVoxel=np.array([512, 512, 512])
)  # Parallel beam geometry does not require anything other than the image size.

#%% Load data and generate projections
# define angles
angles = np.linspace(0, 2 * np.pi, 100)
# Load thorax phantom data
head = sample_loader.load_head_phantom(geo.nVoxel)
# generate projections
projections = tigre.Ax(head, geo, angles)
# add noise
noise_projections = CTnoise.add(projections, Poisson=1e5, Gaussian=np.array([0, 10]))

# recon
imgFBP = algs.fbp(projections, geo, angles)
imgOSSART = algs.ossart(projections, geo, angles, 40)

# plot
tigre.plotImg(np.concatenate([head, imgFBP, imgOSSART], axis=1), dim="z", step=3)

Specifications

  • Python version: 3.10.15
  • OS: Kubuntu 24.04
  • CUDA version: 12.6

Thanks for the report @JonasHoelscher ! fixing now :)