CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
550 stars 182 forks source link

Changing parallel beam geometry detector size in Tigre? #397

Closed alphajunkrat closed 1 year ago

alphajunkrat commented 2 years ago

Hi!

I'm trying to use Tigre to recreate the reconstructions I've done with Astra-toolbox.

In parallel beam geometry demo in Tigre toolbox, the description for it is that it does not need anything other than the image size.

However, in Astra-toolbox the pixel sizes are changeable, and I did choose a customed pixel size when using Astra-toolbox, so I'd like to ask if there's any way to tune to pixel size in the Tigre geometry so I can get the same sinogram results as when I'm using Astra-toolbox?

Thank you very much!

AnderBiguri commented 2 years ago

hi @alphajunkrat,

Absolutely, feel free to use the geo.nVoxel, geo.dVoxel and geo.sVoxel parameters, as in cone beam, to change the shape of the image. Similarly with the detector. TIGRE will use the parameters as you request.

alphajunkrat commented 2 years ago

Thanks @AnderBiguri !

I tried to tune the nDectector, and sVoxel, etc. and wanted to create projections in parallel beam mode. However, I encountered an attribute error as following:

AttributeError: following manditory fields missing from geometry:['DSO', 'DSD']

When using Astra-toolbox, DSO and DSD are not used for parallel3d beam geometry, so in this case is there any advice on how to set DSO and DSD for parallel beam mode in Tigre and is there a way to bypass them?

My code for creating geometry and projections are as below:

geo = tigre.geometry()

geo.mode = "parallel" geo.nVoxel = np.array([10, 600, 600]) # number of voxels (vx) geo.sVoxel = np.array([0.61, 0.61, 0.61]) # total size of the image (mm) geo.dVoxel = geo.sVoxel / geo.nVoxel # size of each voxel (mm)

geo.nDetector = np.array([10, 350]) # number of pixels (px) geo.dDetector = np.array([0.00261, 0.00261]) # size of each pixel (mm) geo.sDetector = geo.nDetector * geo.dDetector # total size of the detector (mm)

angles = np.linspace(0, 2 * np.pi, 360, endpoint=False) projections = tigre.Ax(image_data, geo, angles)

Any suggestions would be appreciated!

Thank you!

AnderBiguri commented 2 years ago

Yeah, this is something I should change.

Just give geo.DSO the same size as sDetector and geo.DSD double that. Its irrelevant, they are parallel beam, but there is a piece of code that checks the validity of the geometry that requires their existence

alphajunkrat commented 1 year ago

Got it! Thank you!