frc
frc is a Python package for computing the Fourier Ring Correlation (FRC) of images using DIPlib
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README -
○Academic publication links
-
✓Committers with academic emails
1 of 2 committers (50.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.3%) to scientific vocabulary
Keywords
Repository
frc is a Python package for computing the Fourier Ring Correlation (FRC) of images using DIPlib
Basic Info
Statistics
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
- Releases: 2
Topics
Metadata Files
README.md
frc
frc is a Python library for calculating Fourier Ring Correlation (FRC) curves and their associated resolution.
This is particularly useful for determining the resolution of images taken with super-resolution microscopy techniques.
Its most computationally intensive functions are all implemented either in NumPy or Rust, making this library quite performant.
Fourier Ring Correlation
Introduced in 1982, Fourier Ring Correlation compares two 2D images, which are assumed to be noise-independent. In Fourier space, mage structure dominates the lower spatial frequencies (in the Fourier domain), while noise dominates at the higher frequencies.
In Fourier space, there are rings of constant spatial frequency around the origin. By calculating the correlation between the rings in the two images (varying the spatial frequency), you can compute an FRC curve (y-axis: correlation, x-axis: spatial frequency).
At some spatial frequency, the signal cannot be separated from the noise. What spatial frequency exactly depends on what threshold function is used. The standard 0.143 and 1/2-bit thresholds are both available, as well as an algorithm to compute the intersection and resulting resolution.
For additional information about Fourier Ring Correlation, see R.P.J. Nieuwenhuizen et al. (2013).
1FRC
FRC requires two noise-independent images to work. However, modern cameras are often shot noise-limited (Poisson noise). This library includes a new method due to Bernd Rieger and Sjoerd Stallinga (Department of Imaging Physics, TU Delft), called 1FRC, which uses a technique called binomial splitting to derive two images from a single one, where the pixel counts of the derived images are independently Poisson noise distributed.
This library was produced for my bachelor thesis in 2022 (which focused on 1FRC) and was supervised by Bernd Rieger. The bachelor thesis can be found here. Bernd Rieger and Sjoerd Stallinga continued research, leading to a peer reviewed paper published in 2024 in Optics Express, which can be found here. Their paper includes many details on the limitations of 1FRC and when exactly it is appropriate. I repeat the abstract below:
We address resolution assessment for (light super-resolution) microscopy imaging. In modalities where imaging is not diffraction limited, correlation between two noise independent images is the standard way to infer the resolution. Here we take away the need for two noise independent images by computationally splitting one image acquisition into two noise independent realizations. This procedure generates two Poisson noise distributed images if the input is Poissonian distributed. As most modern cameras are shot-noise limited this procedure is directly applicable. However, also in the presence of readout noise we can compute the resolution faithfully via a correction factor. We evaluate our method on simulations and experimental data of widefield microscopy, STED microscopy, rescan confocal microscopy, image scanning microscopy, conventional confocal microscopy, and transmission electron microscopy. In all situations we find that using one image instead of two results in the same computed image resolution.
Installation
You can download this library from PyPI:
shell
pip install frc
This library depends on tmtenbrink/rustfrc (a Rust extension developed specifically for this library), DIPlib, scipy and of course, numpy.
Usage
The code snippet below (which for illustration purposes assumes you have a numpy array or DIP image representing your input, its associated scale and also matplotlib to plot the result) will calculate the FRC curve and the associated resolution using the standard 1/7 threshold.
```python import frc import numpy as np import matplotlib.pyplot as plt
... # get an image and scale
img = np.array(img)
Input can be a numpy array or DIP image
img = frc.util.squareimage(img, addpadding=False) img = frc.util.apply_tukey(img)
Apply 1FRC technique
frccurve = frc.onefrc(img)
imgsize = img.shape[0] xspix = np.arange(len(frccurve)) / imgsize
scale has units [pixels ^-1] corresponding to original image
xsnmfreq = xspix * scale frcres, resy, thres = frc.frcres(xsnmfreq, frccurve, imgsize) plt.plot(xsnmfreq, thres(xsnmfreq)) plt.plot(xsnmfreq, frc_curve) plt.show() ```
Troubleshooting
If you cannot find an intersection (NoIntersectionException), be sure to plot the curve without using the frc_res method and see if there even is an intersection. For example:
```python import frc import numpy as np import matplotlib.pyplot as plt
img = ... # get an image and scale
Apply 1FRC technique
frccurve = frc.onefrc(img) imgsize = img.shape[0] xspix = np.arange(len(frccurve)) / imgsize
scale has units [pixels ^-1] corresponding to original image
xsnmfreq = xspix * scale plt.plot(xsnmfreq, frccurve) plt.show() ```
For images with a significant amount of non-Poisson noise, the 1FRC method has been shown to fail (adjustments are possible).
Owner
- Login: tmtenbrink
- Kind: user
- Company: TU Delft
- Repositories: 5
- Profile: https://github.com/tmtenbrink
Citation (CITATION.cff)
cff-version: 1.2.0
title: FRC
message: Please cite this software using these metadata.
type: software
authors:
- given-names: Tip
family-names: ten Brink
email: T.M.tenBrink@student.tudelft.nl
affiliation: TU Delft
orcid: 'https://orcid.org/0000-0002-3090-6538'
GitHub Events
Total
- Watch event: 2
Last Year
- Watch event: 2
Committers
Last synced: about 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| tmtenbrink | 6****k | 6 |
| Tip ten Brink | T****k@s****l | 4 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: over 1 year ago
All Time
- Total issues: 1
- Total pull requests: 1
- Average time to close issues: 3 months
- Average time to close pull requests: 1 minute
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 7.0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: 3 months
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 7.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- DennisDannecker (1)
Pull Request Authors
- tmtenbrink (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 107 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 2
- Total maintainers: 1
pypi.org: frc
Library for computing Fourier Ring Correlation (FRC) curves and using them to determine image resolution.
- Documentation: https://frc.readthedocs.io/
- License: mit
-
Latest release: 0.1.1
published almost 2 years ago
Rankings
Maintainers (1)
Dependencies
- atomicwrites 1.4.0 develop
- attrs 21.2.0 develop
- colorama 0.4.4 develop
- importlib-metadata 4.8.2 develop
- iniconfig 1.1.1 develop
- packaging 21.3 develop
- pluggy 1.0.0 develop
- py 1.11.0 develop
- pyparsing 3.0.6 develop
- pytest 6.2.5 develop
- toml 0.10.2 develop
- typing-extensions 4.0.0 develop
- zipp 3.6.0 develop
- diplib 3.1.0
- numpy 1.21.4
- rustfrc 1.1.2
- scipy 1.7.2
- pytest ^6.2 develop
- diplib ^3.1.0
- numpy ^1.18
- python >=3.7, <3.10
- rustfrc ^1.1.2
- scipy ^1.3
- actions/checkout v4 composite
- actions/download-artifact v4 composite
- actions/setup-python v5 composite
- actions/upload-artifact v4 composite
- pypa/gh-action-pypi-publish release/v1 composite