Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong number of peaks using topology method. #16

Closed
Tom89757 opened this issue Feb 24, 2023 · 3 comments
Closed

wrong number of peaks using topology method. #16

Tom89757 opened this issue Feb 24, 2023 · 3 comments

Comments

@Tom89757
Copy link

Thank you first for your great library. I'm trying to find number of peaks. The code is below:
image
My origin image is like this:
image
fp.plot() shows:
image
fp.plot_mesh() shows:
image
It should have 6 peaks but only find 5 (with a wrong peak). Can you please explain it for me? I'll appreciate your help.

@erdogant
Copy link
Owner

erdogant commented Feb 24, 2023

I looked into it and it appears that the default noise reduction method (fastnl) is not optimal in your case.
If you take lee_enhanced, the peaks are as what we would expect by eye.

Update to the latest version with pip install -U findpeaks because I added a small function to read images from URL imread().

from findpeaks import findpeaks
path = r'https://user-images.githubusercontent.com/44827483/221152897-133839bb-7364-492a-921b-c9077ab9930b.png'
fp = findpeaks(method='topology', denoise='lee_enhanced', window=5, whitelist='peak')
X = fp.imread(path)

fp.fit(X)
fp.plot_persistence()
fp.plot()
fp.plot_mesh()

The persistence will give you more feeling how the peaks are detected. See more information here.

image
image

@Tom89757
Copy link
Author

Thank you for your reply. It really helps me.

@erdogant
Copy link
Owner

erdogant commented Mar 7, 2023

👍🏻 closing this one as it is solved.

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

No branches or pull requests

2 participants