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

Improve median filter #150

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert changes to introductory tutorial
cgohlke committed Nov 29, 2024
commit 279480665243ed67b7fe03f1e8c465e482bcc382
18 changes: 8 additions & 10 deletions tutorials/phasorpy_introduction.py
Original file line number Diff line number Diff line change
@@ -230,22 +230,20 @@
# Filter phasor coordinates
# -------------------------
#
# Pixels with low intensities are commonly excluded from analysis and
# visualization of phasor coordinates:
# Applying median filter to the calibrated phasor coordinates,
# often multiple times, improves contrast and reduces noise:

from phasorpy.phasor import phasor_threshold
from phasorpy.phasor import phasor_filter

mean, real, imag = phasor_threshold(mean, real, imag, mean_min=1)
real, imag = phasor_filter(real, imag, method='median', size=3, repeat=2)

# %%
# Applying median filter to the calibrated phasor coordinates,
# often multiple times, improves contrast and reduces noise when
# visualizing phasor coordinates (however, the filtered coordinates
# can no longer be used to reconstruct the original signal):
# Pixels with low intensities are commonly excluded from analysis and
# visualization of phasor coordinates:

from phasorpy.phasor import phasor_filter
from phasorpy.phasor import phasor_threshold

real, imag = phasor_filter(real, imag, method='median', size=3, repeat=2)
mean, real, imag = phasor_threshold(mean, real, imag, mean_min=1)

# %%
# Show the calibrated, filtered phasor coordinates: