Functions to filter HR(S)TEM images
Project description
HR(S)TEM filter
Introduction
hrtem_filter provides a set of python functions to denoise HR(S)TEM images. A Wiener filter and an average background subtraction filter were designed based on R. Kilaas J. Microscopy, 1998, 190, 45-51. Some steps are adopted from D. R. G. Mitchell's script for GMS. A nonlinear filter was adopted by the "non-linear filter plugin from GMS", originally developed by Dr. Hongchu Du. Refer to the original paper: Hongchu Du, A nonlinear filtering algorithm for denoising HR(S)TEM micrographs, Ultramicroscopy 2015, 151, 62-67
Installation
Use pip:
pip install hrtem_filter
Usage
The package contains three main filter functions:
wiener_filter(img, delta=5, lowpass=True, lowpass_cutoff=0.3, lowpass_order=2)
abs_filter(img, delta=5, lowpass=True, lowpass_cutoff=0.3, lowpass_order=2)
These are for Wiener filter or average background subtraction filter. It takes img, an image array as an input, and returns the filtered image array and a difference image array. Parameters are the following:
delta: a threashold for background averaging. Smaller number results in more iterations in refining the averaged background and hense longer time.
lowpass: also apply a lowpass filter after filtering to remove the residual high frequency noise.
lowpass_cutoff: a cutoff ratio in frequency domain for the lowpass. 1 means no filtering and vice versa.
lowpass_order: order for the Butterworth filter; smaller int retults more tapered cutoff
nlfilter(img, N=50, delta=10, lowpass_cutoff=0.3, lowpass = True, lowpass_order=2)
This function carries out the nonlinear filter, a combination of Gaussian lowpass and Wiener filters. It takes img, an image array as an input, and returns the filtered image array and a difference image array. Parameters are the following:
N: number of iterations for the lowpass + wiener filtering. More iterations give better noise reduction and takes more time.
lowpass: if True, also applys a Butterworth lowpass filter after the Wiener filtering in every iteration. This prevents from adding back high frequency noise.
All other parameters are the same as in the wiener_filter.
In addition, hrtem_filter also provides two lowpass filters: Butterworth filter and Gaussian filter.
bw_lowpass(img, order, cutoff_ratio)
gaussian_lowpass(img, cutoff_ratio)
Contact
Send your questions and suggestions to Dr. Tao Ma at matao1984@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hrtem_filter-0.0.1.post2.tar.gz.
File metadata
- Download URL: hrtem_filter-0.0.1.post2.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d52eb77d7dcf9bd0da2d6e50e0f911cdeabf4166bc1d7978eb6c6bfd23dda163
|
|
| MD5 |
bb81286f121642ac71e46d2c22a5fc74
|
|
| BLAKE2b-256 |
ae406362c69602ba37b4f2df73707b33b34682355aafe8d5be553e9f1d58d66f
|
File details
Details for the file hrtem_filter-0.0.1.post2-py3-none-any.whl.
File metadata
- Download URL: hrtem_filter-0.0.1.post2-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47c7818df2f08225fc8a7944e672dde9e00a122c8e9e15c40afacb978c8d9e1c
|
|
| MD5 |
ed4c0ed25c780cc2b9f2e2f8376d424d
|
|
| BLAKE2b-256 |
fa21ee92f71c3287cf238bb1583345d7b5153da48814bf7376c3c8a894473e25
|