TomographicImaging / CIL

A versatile python framework for tomographic imaging
https://tomographicimaging.github.io/CIL/
Apache License 2.0
96 stars 41 forks source link

Issue running recon.FBP with 2D data #1332

Open lauramurgatroyd opened 2 years ago

lauramurgatroyd commented 2 years ago

Tried to run the sandstone notebook by importing FBP from the recon module instead of from astra, and running FBP failed with no useful error message.

@gfardell and I stepped through and found it was an issue with the filtering in the 2D case. It was specifically using: https://github.com/TomographicImaging/CIL/blob/b70febf37b215dd6672ddc38b05effdecfb6a086/src/Core/FBP_filtering.cpp#L81

gfardell commented 2 years ago

The issue is the data is still uint16 when it's passed to the recon class, and the recon class doesn't check for that and just assumes it's float32.

  1. Add a check on datatype to the recon class, or try to convert the data with: np.asarray(dtype=np.float32, order='C') This returns the original array if it already satisfies the request, or reorder/cast if able to, or raise and error if it can't do it.

  2. Change the sandstone demo and convert the data to float32 before this point.

  3. AcquisitionData and ImageData should check the array and geometry dtype are consistent.