LLNL / LEAP

comprehensive library of 3D transmission Computed Tomography (CT) algorithms with Python and C++ APIs, a PyQt GUI, and fully integrated with PyTorch
https://leapct.readthedocs.io
MIT License
105 stars 10 forks source link

Incorrect number of voxels in helical geometry when angular range is bigger than 360 degrees #75

Closed LabTelc closed 1 month ago

LabTelc commented 3 months ago

The algorithm that calculates default volume cannot correctly calculate number of vertical voxels when the geometry has angular range more than 360 degrees.

When I use only a subset of the projections:

leapct.set_conebeam(1440, 1536, 1944, 0.075, 0.075, 768, 972, angles, 224, 360, helicalPitch=-25/ np.deg2rad(360))
leapct.set_default_volume()

the algorithm correctly calculates number of voxels:

======== CT Cone-Beam Geometry ========
number of angles: 1440
number of detector elements (rows, cols): 1944 x 1536
angular range: 359.900024 degrees
detector pixel size: 0.075000 mm x 0.075000 mm
center detector pixel: 972.000000, 768.000000
sod = 224.990997 mm
sdd = 360.053009 mm
helicalPitch = -3.978873 (mm/radian)
normalized helicalPitch = -0.274400
======== CT Volume ========
number of voxels (x, y, z): 1536 x 1536 x 2210
voxel size: 0.046866 mm x 0.046866 mm x 0.046866 mm
volume offset: 0.000000 mm, 0.000000 mm, -0.023433 mm
FOV: [-35.993263, 35.993263] x [-35.993263, 35.993263] x [-51.810615, 51.763748]

But when I use the whole dataset:

leapct.set_conebeam(4320, 1536, 1944, 0.075, 0.075, 768, 972, angles, 224, 360, helicalPitch=-25/ np.deg2rad(360))
leapct.set_default_volume()
======== CT Cone-Beam Geometry ========
number of angles: 4320
number of detector elements (rows, cols): 1944 x 1536
angular range: 1079.899902 degrees
detector pixel size: 0.075000 mm x 0.075000 mm
center detector pixel: 972.000000, 768.000000
sod = 224.990997 mm
sdd = 360.053009 mm
helicalPitch = -3.978873 (mm/radian)
normalized helicalPitch = -0.274400
======== CT Volume ========
number of voxels (x, y, z): 1536 x 1536 x 1944
voxel size: 0.046866 mm x 0.046866 mm x 0.046866 mm
volume offset: 0.000000 mm, 0.000000 mm, -0.023433 mm
FOV: [-35.993263, 35.993263] x [-35.993263, 35.993263] x [-45.577407, 45.530540]

the number of voxels defaults to the number of rows even though the correct number can be determined from geometry. I also tried it with only two rotations with the same incorrect result.

kylechampley commented 2 months ago

I guess it really comes down to what one considers to be the default volume height. Should one set the height to be the whole region that sees at least one projection pass through it or the region that sees at least 180 degrees, or something else?

Do you have a suggestion? You can always set your own volume parameters with the set_volume(...) function or you can use the set_default_volume() function, but then change the number of slices with the command: set_numZ()

I noticed that your geometry statements don't match the code samples you provided. For example: leapct.set_conebeam(4320, 1536, 1944, ...)

should give you 1536 rows and 1944 columns, but your print statements say the reverse.

kylechampley commented 1 month ago

This issue was just fixed in v1.20.