Skip to content

zero div error NaN => 0#23

Merged
pjmark merged 1 commit intodev2from
div_nzer
Oct 13, 2020
Merged

zero div error NaN => 0#23
pjmark merged 1 commit intodev2from
div_nzer

Conversation

@casperdcl
Copy link
Member

@casperdcl casperdcl commented Oct 11, 2020

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

@casperdcl casperdcl requested a review from pjmark October 11, 2020 15:27
@casperdcl casperdcl self-assigned this Oct 11, 2020
Copy link
Member

@pjmark pjmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for that!

@pjmark pjmark merged commit 9a7b545 into dev2 Oct 13, 2020
@casperdcl casperdcl deleted the div_nzer branch October 13, 2020 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants