imagej / imagej/imagej-ops

filter/addPoissonNoise hangs up with large pixel values

Open
#641 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
94
Forks
44
PR merge metrics
No merged PRs in 30d

Description

Hello,

I have been working on a project for the NIH that uses [pyimagej](https://github.com/imagej/pyimagej) to run ImageJ ops from python. Yesterday I was working on developing a plugin which calls the [filter-addpoissonnoise op](https://github.com/imagej/imagej-ops/blob/master/src/main/java/net/imagej/ops/filter/addPoissonNoise/AddPoissonNoiseRealType.java). During testing I determined that the op would hang up seemingly doing nothing when the input images had large pixel values. I believe this problem can be summarized as a precision/underflow problem when very large lambda values (expected number of successes in a given interval) are introduced to the Knuth algorithm. This has been documented before in wiki's [Generating Poisson-distributed random variables section](https://en.wikipedia.org/wiki/Poisson_distribution). As lambda becomes large exp(-lambda) approaches 0 and becomes so small it is evaluated as exactly 0. This value is checked in a while loop against another value which is never less than 0: `while p >= L: do stuff` where `L` = 0 and `p` is never less than 0. Therefore the loop runs forever.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/main/java/net/imagej/ops/filter/addPoissonNoise/AddPoissonNoiseRealType.java, especially the loop implementing the Knuth algorithm. Reproduce the hang with an image containing large pixel values and determine how the underflowed exp(-lambda) affects termination. Done means the op terminates and produces valid Poisson noise for large lambda values.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.