• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kunzaatko / TransferFunctions.jl / 17264570321

27 Aug 2025 10:47AM UTC coverage: 81.766%. Remained the same
17264570321

push

github

kunzaatko
test: Add test for the indices method on the PSF

565 of 691 relevant lines covered (81.77%)

33464341.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/transfer-function-interface.jl
1
using InterfaceFunctions
2

3
"""
4
    TransferFunction
5
Super type for all transfer functions
6

7
A transfer function in microscopy is an object specifying the response in the image plane to the light coming from the
8
object plane.
9
There are several characteristics of a transfer functions which can influence the character of the response. Most
10
commonly we are concerned with its spatial variance/invariance, i.e. whether the response is dependent of the objects
11
position in the object plane, and linearity (which is almost always satisfied).
12

13
See also [`LinearShiftInvariantTransferFunction`](@ref), [`ImpulseResponseMapping`](@ref)
14
"""
15
abstract type TransferFunction{N} end
16

17
"""
18
    transfer(t::TransferFunction, A::SpatialMatrix)
19
The forward pass of the transfer function operator `t` on the image `A`.
20

21
See also [`restore`](@ref)
22
"""
23
@interface transfer(t::TransferFunction, ::SpatialMatrix{<:Real})
24

25
"""
26
    restore(t::TransferFunction, A::SpatialMatrix)
27
The reverse pass of the transfer function operator `t` on the image `A`.
28

29
It is always inherently an estimation because `A` is always noisy and `t` is often not well conditioned (especially in
30
the non-linear case).
31

32
See also [`transfer`](@ref)
33
"""
34
@interface restore(t::TransferFunction, ::SpatialMatrix{<:Real})
35

36
# NOTE: Taken from Distributions.jl <kunzaatko> 
37
for func in (:(==), :isequal, :isapprox)
38
    @eval function Base.$func(tf1::A, tf2::B; kwargs...) where {A<:TransferFunction,B<:TransferFunction}
16✔
39
        nameof(A) === nameof(B) || return false
8✔
40
        fields = fieldnames(A)
8✔
41
        fields === fieldnames(B) || return false
8✔
42

43
        for f in fields
8✔
44
            isdefined(tf1, f) && isdefined(tf2, f) || return false
32✔
45
            # perform equivalence check to support types that have no defined equality, such
46
            # as `missing`
47
            getfield(tf1, f) === getfield(tf2, f) || $func(getfield(tf1, f), getfield(tf2, f); kwargs...) || return false
32✔
48
        end
40✔
49

50
        return true
8✔
51
    end
52
end
53

54
# NOTE: Taken from Distributions.jl <kunzaatko> 
55
function Base.hash(tf::TransferFunction, h::UInt)
8✔
56
    hashed = hash(TransferFunction, h)
8✔
57
    hashed = hash(nameof(typeof(tf)), hashed)
8✔
58

59
    for f in fieldnames(typeof(tf))
8✔
60
        hashed = hash(getfield(tf, f), hashed)
32✔
61
    end
40✔
62

63
    return hashed
8✔
64
end
65

66
export transfer, restore
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc