NiftyPET / NIPET

High-throughput PET image reconstruction with high quantitative accuracy and precision
Apache License 2.0
29 stars 7 forks source link

zero div error NaN => 0 #23

Closed casperdcl closed 3 years ago

casperdcl commented 3 years ago

This PR makes it possible to do low count reconstructions (otherwise, the whole image becomes np.nan).

The key is to avoid np.nans due to zero division in cuda kernels. Such cases are replaced with zero.

Makes this reconstruction possible (psino.sum() == 3e6):

image

Similar approach to https://github.com/PET-MR/apirl/blob/04272cada75bd59584fd7c47d00cd4b6c3b00191/matlab/andrew_reader_lab_software_interface/%40classGpet/classGpet.m#L530-L536

An alternative approach would be to add a (small) constant to the denominator before dividing