Skip to content

Commit 573e189

Browse files
Merge branch 'roflmaostc:master' into regularization
2 parents cd6b7dc + 57ae209 commit 573e189

43 files changed

Lines changed: 4308 additions & 2308 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
branches:
88
- master
99
tags: '*'
10+
concurrency:
11+
# Skip intermediate builds: always.
12+
# Cancel intermediate builds: only if it is a pull request build.
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
1015
jobs:
1116
test:
1217
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
@@ -15,40 +20,36 @@ jobs:
1520
fail-fast: false
1621
matrix:
1722
version:
18-
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
19-
os: [ubuntu-latest, windows-latest, macOS-latest]
23+
- '1'
24+
os:
25+
- [ubuntu-latest]
2026
arch:
2127
- x64
2228
steps:
23-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v3
2430
- uses: julia-actions/setup-julia@v1
2531
with:
2632
version: ${{ matrix.version }}
2733
arch: ${{ matrix.arch }}
28-
- uses: actions/cache@v1
29-
env:
30-
cache-name: cache-artifacts
31-
with:
32-
path: ~/.julia/artifacts
33-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
34-
restore-keys: |
35-
${{ runner.os }}-test-${{ env.cache-name }}-
36-
${{ runner.os }}-test-
37-
${{ runner.os }}-
34+
- uses: julia-actions/cache@v1
3835
- uses: julia-actions/julia-buildpkg@v1
3936
- uses: julia-actions/julia-runtest@v1
4037
- uses: julia-actions/julia-processcoverage@v1
41-
- uses: codecov/codecov-action@v1
38+
- uses: codecov/codecov-action@v4
39+
env:
40+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4241
with:
4342
file: lcov.info
43+
44+
4445
docs:
4546
name: Documentation
4647
runs-on: ubuntu-latest
4748
steps:
4849
- uses: actions/checkout@v2
4950
- uses: julia-actions/setup-julia@v1
5051
with:
51-
version: "1"
52+
version: "1.9"
5253
- uses: julia-actions/julia-docdeploy@releases/v1
5354
env:
5455
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CITATION.bib

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@article{Wechsler2023,
2+
doi = {10.21105/jcon.00099},
3+
url = {https://doi.org/10.21105/jcon.00099},
4+
year = {2023},
5+
publisher = {The Open Journal},
6+
volume = {1},
7+
number = {1},
8+
pages = {99},
9+
author = {Felix Wechsler and Rainer Heintzmann},
10+
title = {DeconvOptim.jl - Signal Deconvolution with Julia},
11+
journal = {Proceedings of the JuliaCon Conferences}
12+
}

CITATION.cff

Lines changed: 0 additions & 21 deletions
This file was deleted.

Project.toml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DeconvOptim"
22
uuid = "03e7cd2f-1a03-4ea9-b59b-760a446df67f"
33
authors = ["Felix Wechsler <fxw+github@mailbox.org>"]
4-
version = "0.6.0"
4+
version = "0.7.4"
55

66
[deps]
77
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
@@ -12,6 +12,7 @@ LineSearches = "d3d80556-e9d4-5f37-9878-2ab0fcc64255"
1212
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1313
Noise = "81d43f40-5267-43b7-ae1c-8b967f377efa"
1414
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
15+
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1516
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1617
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1718
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
@@ -20,17 +21,19 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
2021

2122
[compat]
2223
ChainRulesCore = "1"
23-
FFTW = "1.2, 1.3, 1.4"
24-
FillArrays = "0.12"
25-
Interpolations = "0.12.10, 0.13"
26-
LineSearches = "7.1"
24+
FFTW = "1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7"
25+
FillArrays = "0.12, 0.13, 1"
26+
Interpolations = "0.12.10, 0.13, 0.14, 0.15"
27+
LineSearches = "7, 7.1"
2728
Noise = "0.3"
28-
Optim = "1.2, 1.3, 1.4, 1.5, 1.6"
29+
Optim = "1"
30+
PrecompileTools = "1"
2931
Requires = "1.1.0"
30-
StatsBase = "0.33"
32+
Statistics = "1"
33+
StatsBase = "0.33, 0.34"
3134
Tullio = "0.3"
32-
Zygote = "0.6"
33-
julia = "1.5, 1.6, 1.7"
35+
Zygote = "0.7"
36+
julia = "1, 1.6, 1.7, 1.8, 1.9, 1.10"
3437

3538
[extras]
3639
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"

README.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
</a>
99
</div>
1010
<br>
11-
A package for microscopy image based deconvolution via Optim.jl. This package works with N dimensional Point Spread Functions and images.
11+
A package for microscopy image based deconvolution via Optim.jl. This package works with N dimensional <a href="https://github.com/RainerHeintzmann/PointSpreadFunctions.jl">Point Spread Functions</a> and images.
1212
The package was created with microscopy in mind but since the code base is quite general it is possible to deconvolve different kernels as well.
13-
14-
We would be happy to deconvolve *real* data! File an issue if we can help deconvolving an image/stack. We would be also excited to adapt DeconvOptim.jl to your special needs!
1513
<br>
14+
15+
Deconvolution of a dataset with size 512x256x128 took [2.2 seconds](https://proceedings.juliacon.org/papers/10.21105/jcon.00099) on a RTX 3060 GPU!
1616

17-
| **Documentation** | **Build Status** | **Code Coverage** |
18-
|:---------------------------------------:|:-----------------------------------------:|:-------------------------------:|
19-
| [![][docs-stable-img]][docs-stable-url] [![][docs-dev-img]][docs-dev-url] | [![][CI-img]][CI-url] | [![][codecov-img]][codecov-url] |
2017

18+
| **Documentation** | **Build Status** | **Code Coverage** | **Publication** |
19+
|:---------------------------------------:|:-----------------------------------------:|:-------------------------------:|:-----------------------:|
20+
| [![][docs-stable-img]][docs-stable-url] [![][docs-dev-img]][docs-dev-url] | [![][CI-img]][CI-url] | [![][codecov-img]][codecov-url] |[![DOI](https://proceedings.juliacon.org/papers/10.21105/jcon.00099/status.svg)](https://doi.org/10.21105/jcon.00099)|
2121

2222

2323
## Installation
@@ -27,8 +27,8 @@ julia> ] add DeconvOptim
2727
```
2828

2929
## Documentation
30-
The documentation of the latest release is [here](docs-stable-url).
31-
The documentation of current master is [here](docs-dev-url).
30+
The documentation of the latest release is [here](https://roflmaostc.github.io/DeconvOptim.jl/stable).
31+
The documentation of current master is [here](https://roflmaostc.github.io/DeconvOptim.jl/dev/).
3232
For a quick introduction you can also watch the presentation at the JuliaCon 2021.
3333

3434
<a href="https://www.youtube.com/watch?v=FodpnOhccis"><img src="docs/src/assets/julia_con.jpg" width="300"></a>
@@ -81,12 +81,36 @@ And in the new cell then use:
8181
res, o = deconvolution(img_n, psf, regularizer=reg)
8282
```
8383

84+
## Development
85+
Feel free to file an issue regarding problems, suggestions or improvement ideas for this package!
86+
We would be happy to deconvolve *real* data! File an issue if we can help deconvolving an image/stack. We would be also excited to adapt DeconvOptim.jl to your special needs!
87+
88+
## Citation
89+
If you use this paper, please cite it. Thes [PDF is linked here](https://proceedings.juliacon.org/papers/10.21105/jcon.00099).
90+
```bibtex
91+
@article{Wechsler2023,
92+
doi = {10.21105/jcon.00099},
93+
url = {https://doi.org/10.21105/jcon.00099},
94+
year = {2023},
95+
publisher = {The Open Journal},
96+
volume = {1},
97+
number = {1},
98+
pages = {99},
99+
author = {Felix Wechsler and Rainer Heintzmann},
100+
title = {DeconvOptim.jl - Signal Deconvolution with Julia},
101+
journal = {Proceedings of the JuliaCon Conferences}
102+
}
103+
```
84104

85105
## Contributions
86106
I would like to thank [Rainer Heintzmann](https://nanoimaging.de/) for the great support and discussions during development.
87107
Furthermore without [Tullio.jl](https://github.com/mcabbott/Tullio.jl) and [@mcabbott](https://github.com/mcabbott/) this package wouldn't be as fast as it is. His package and ideas are the basis for the implementations of the regularizers.
88108

109+
## Related Packages
89110

111+
* [ThreeDeconv](https://github.com/computational-imaging/ThreeDeconv.jl): works great, CPU performance is much slower, GPU performance is slower
112+
* [Deconvolution.jl](https://github.com/JuliaDSP/Deconvolution.jl): rather simple package with Wiener and Lucy Richardson deconvolution.
113+
* [PointSpreadFunctions.jl](https://github.com/RainerHeintzmann/PointSpreadFunctions.jl): generates point spread functions for microscopy applications
90114

91115
[docs-dev-img]: https://img.shields.io/badge/docs-dev-orange.svg
92116
[docs-dev-url]: https://roflmaostc.github.io/DeconvOptim.jl/dev/

docs/Project.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ DeconvOptim = "03e7cd2f-1a03-4ea9-b59b-760a446df67f"
33
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
44
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
55
Noise = "81d43f40-5267-43b7-ae1c-8b967f377efa"
6-
7-
[compat]
8-
Documenter = "0.27"

docs/make.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ using Documenter, DocumenterCitations, DeconvOptim
44
cite_bib = CitationBibliography(joinpath(@__DIR__, "../paper/ref.bib"))
55

66
DocMeta.setdocmeta!(DeconvOptim, :DocTestSetup, :(using DeconvOptim); recursive=true)
7-
makedocs(cite_bib, modules=[DeconvOptim],
7+
makedocs(modules=[DeconvOptim],
8+
plugins=[cite_bib],
89
sitename="DeconvOptim.jl",
910
doctest = false,
11+
warnonly=true,
1012
pages = Any[
1113
"DeconvOptim.jl" => "index.md",
1214
"Workflow" => Any[

docs/src/background/loss_functions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ One common loss function (especially in deep learning) is simply the $L^2$ norm
77

88

99
So far we provide three adapted loss functions with our package. However, it is relatively easy to incorporate
10-
custom defined loss functions or import them from packages like [Flux.ml](https://fluxml.ai/Flux.jl/stable/models/losses/).
11-
The interface from Flux.ml is the same as for our loss functions.
10+
custom defined loss functions or import them from packages like [Flux.jl](https://fluxml.ai/Flux.jl/stable/models/losses/).
11+
The interface from Flux.jl is the same as for our loss functions.
1212

1313

1414
## Poisson Loss
@@ -44,7 +44,7 @@ The numerical evaluation of the Poisson loss can lead to issues. Since $\mu(r)=0
4444

4545
## Scaled Gaussian Loss
4646
It is well known that the Poisson density function behaves similar as a Gaussian density function for $\mu\gg 1$. This approximation is almost for all use cases in microscopy valid since regions of interest in an image usually consists of multiple photons and not to a single measured photon.
47-
Mathematically the Poisson probability can be approximately (using Stirling's formula in the derivation) expressed as:
47+
Mathematically the Poisson probability can be approximately (using [Stirling's formula](https://en.wikipedia.org/wiki/Stirling's_approximation) in the derivation) expressed as:
4848

4949
$$p(Y(r)|\mu(r)) \approx \prod_r \frac{\exp \left(-\frac{(x-\mu(r) )^2}{2 \mu(r) }\right)}{\sqrt{2 \pi \mu(r) }}$$
5050

docs/src/background/physical_background.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ $Y(r) = (S * \text{PSF})(r) + b$
2424

2525
In frequency space (Fourier transforming the above equation) the equation with $b=0$ is:
2626

27-
$\tilde Y(k) = (\tilde S * \tilde{\text{PSF}})(k)$
27+
$\tilde Y(k) = (\tilde S \cdot \tilde{\text{PSF}})(k),$
2828

29-
where $k$ is the spatial frequency. From that equation it is clear why the green and blue line in the plot look very similar. The reason is, that the orange line is constant and we basically multiply the OTF with the orange line.
29+
where $k$ is the spatial frequency and $\cdot$ represents term-wise multiplication (this is due to the [convolution theorem of the Fourier transform](https://en.wikipedia.org/wiki/Convolution_theorem)). From that equation it is clear why the green and blue line in the plot look very similar. The reason is, that the orange line is constant and we basically multiply the OTF with the orange line.
3030

3131

3232
## Noise Model
@@ -38,8 +38,8 @@ $Y(r) = (S * \text{PSF})(r) + N(r) = \mu(r) + N(r)$
3838
where $N$ being a noise term.
3939
In fluorescence microscopy the dominant noise is usually *Poisson shot noise* (see [Mertz:2019](@cite)).
4040
The origin of that noise is the quantum nature of photons. Since the measurement process spans over a time T only a discrete number of photons is detected (in real experiment the amount of photons per pixel is usually in the order of $10^1 - 10^3$). Note that this noise is not introduced by the sensor and is just a effect due to quantum nature of light.
41-
We can interprete every sensor pixel as a discrete random variable $X$. The expected value of that pixel would be $\mu(r)$ (true specimen convolved with the $\text{PSF})$. Due to noise, the systems measures randomly a signal for $X$ according to the Poisson distribution:
41+
We can interpret every sensor pixel as a discrete random variable $X$. The expected value of that pixel would be $\mu(r)$ (true specimen convolved with the $\text{PSF})$. Due to noise, the systems measures randomly a signal for $X$ according to the Poisson distribution:
4242

4343
$f(y, \mu) = \frac{\mu^y \exp(-\mu)}{\Gamma(y + 1)}$
4444

45-
where $f$ is the probability density distribution, $y$ the measured value of the sensor, $\mu$ the expected value and $\Gamma$ the generalized factorial function.
45+
where $f$ is the probability density distribution, $y$ the measured value of the sensor, $\mu$ the expected value and $\Gamma$ the generalized factorial function ([Gamma function](https://en.wikipedia.org/wiki/Gamma_function)).

docs/src/workflow/basic_workflow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ In this section we show the workflow for deconvolution of 2D and 3D images using
44
From these examples one can also understand the different effects of the regularizers.
55

66
The picture below shows the general principle of DeconvOptim.jl.
7-
Since we interprete deconvolution as an optimization we initialize the reconstruction variables *rec*.
7+
Since we interpret deconvolution as an optimization we initialize the reconstruction variables *rec*.
88
*rec* is a array of pixels which are the variables we are optimizing for.
99
Then we can apply some mapping eg. to reconstruct only pixels having non-negative intensity values.
1010
Afterwards we compose the *total loss* functions. It consists of a regularizing part (weighted with $\lambda$) and a *loss* part.
@@ -19,4 +19,4 @@ In most cases changing the regularizer or the number of iterations is enough.
1919
![](../assets/tex/pipeline.svg)
2020

2121
For all options, see the function references.
22-
Via the help of Julia (typing `]` in the REPL) we can also access extensive help.
22+
Via the help of Julia (typing `?` in the REPL) we can also access extensive help.

0 commit comments

Comments
 (0)