Skip to content

Add gaussian and poisson noise options to projection applications#860

Merged
SimonRit merged 1 commit into
RTKConsortium:mainfrom
axel-grc:Noise
May 20, 2026
Merged

Add gaussian and poisson noise options to projection applications#860
SimonRit merged 1 commit into
RTKConsortium:mainfrom
axel-grc:Noise

Conversation

@axel-grc
Copy link
Copy Markdown
Collaborator

No description provided.

@axel-grc axel-grc force-pushed the Noise branch 2 times, most recently from b2d59a8 to ef55545 Compare November 24, 2025 08:56
@SimonRit SimonRit mentioned this pull request Nov 27, 2025
@axel-grc axel-grc force-pushed the Noise branch 4 times, most recently from 1cbeb80 to f0b3a98 Compare November 28, 2025 10:14
Copy link
Copy Markdown
Collaborator

@lesaintjerome lesaintjerome left a comment

Choose a reason for hiding this comment

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

I did a few tests. It seems to run fine.
The noise feature in rtkdrawgeometricphantom and rtkprojectshepplogan has not been removed. Should it be?

Comment thread applications/rtknoise_section.ggo Outdated
Comment on lines +1 to +5
section "Gaussian noise"
option "gaussian" - "Gaussian noise parameters: <mean> Noise level and <std> Noise standard deviation" double multiple no

section "Poisson noise"
option "poisson" - "Poisson noise parameters: <I0> Number of impinging photons per pixel and <muref> reference linear attenuation coefficient" double multiple no
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems to make the mu_ref parameter mandatory. Why not. Though we could mention something like "e.g. set 0.01879, which is the attenuation coefficient of water at 75 keV".

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same could be said about the mean parameter for gaussian noise. Default=0. would make sense, to me.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The problem is that we can't use different default values for lists with gengetopt, so the same default value will be used for mean and std for example.

We can maybe add theses default values to the implementation part ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Or have slightly more complex Gaussian and Poisson ggo sections, with 2 parameters each?

@SimonRit SimonRit self-assigned this Dec 18, 2025
@axel-grc axel-grc changed the title WIP: Add gaussian and poisson noise options to projection applications Add gaussian and poisson noise options to projection applications Dec 19, 2025
@SimonRit SimonRit added this to the RTK 3.0 milestone Jan 7, 2026
@SimonRit SimonRit force-pushed the Noise branch 3 times, most recently from ad34e3c to 48182a1 Compare May 19, 2026 10:41
Copy link
Copy Markdown
Collaborator

@SimonRit SimonRit left a comment

Choose a reason for hiding this comment

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

I have modified this PR to make it to my taste. Main changes are:

  • muref now has a default
  • mean of the gaussian has been removed
  • gaussian is applied both with Poisson (before the log) and without (without any exp / log)

@SimonRit SimonRit requested a review from lesaintjerome May 19, 2026 10:54
@SimonRit
Copy link
Copy Markdown
Collaborator

@axel-grc and @lesaintjerome, do you mind re-reviewing? And testing the Python version @axel-grc if you don't mind.

Comment on lines +18 to +23
rtknoise_group.add_argument(
"--gaussian",
help="Additive Gaussian noise standard deviation (pre-log if --poisson given, without exp/log otherwise)",
type=float,
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In my small tests, what I had in mind was: take Poisson noise, then add 10% gaussian noise. So I needed to estimate the pre-log values and set the std accordingly).
We could instead pass a "noise level" (e.g. 10%) and the std would be computed as the pre_log_mean * noise_level.
But it may conflict with other use cases where the user knows exactly the level of noise he wants to simulate.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I find it a bit too specific. Why pre_log_mean * noise_level? Gaussian noise combined with Poisson noise is mainly here to simulate electronic noise no? So it should be independent of the number of photons emitted? I'm in favor of leaving it as is.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sure. You're right ! Forget this comment.

Comment thread applications/rtknoise_group.py Outdated
rtknoise_group = parser.add_argument_group("Poisson and Gaussian noise")
rtknoise_group.add_argument(
"--poisson",
help="Comma-separated pre-log Poisson noise parameters: I0 pre-log normalization and (optional) pre-exp multiplicative factor (default 0.01879)",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we say what does 0.01879 correspond to?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Addressed with the latest force push.

@lesaintjerome
Copy link
Copy Markdown
Collaborator

Did some quick tests. It seems to work fine.

Co-authored-by: Simon Rit <simon.rit@creatis.insa-lyon.fr>
@axel-grc
Copy link
Copy Markdown
Collaborator Author

Looks good to me, the only downside is that with poisson noise arguments, the first comma separated value has a default, but not the second, so we need to enter the two values, even if we want the default for the first.
I don't know if there is a solution for that, and with the second argument being optional, that is not really an issue

@SimonRit SimonRit merged commit 27e8b9a into RTKConsortium:main May 20, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants