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

kunzaatko / TransferFunctions.jl / 17266311054

27 Aug 2025 12:11PM UTC coverage: 81.295% (-0.5%) from 81.766%
17266311054

push

github

kunzaatko
refactor!: Swap the argument order of array and transfer function in
`conv`/`deconv`/`transfer`/`restore` functions

0 of 10 new or added lines in 4 files covered. (0.0%)

565 of 695 relevant lines covered (81.29%)

33228571.47 hits per line

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

88.89
/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
# TODO: When it is possible to mark the non-first argument as the interfacing type, it should be done with interfaces
18
# again <27-08-25> 
19
"""
20
    transfer(A::SpatialMatrix, t::TransferFunction)
21
The forward pass of the transfer function operator `t` on the image `A`.
22

23
See also [`restore`](@ref)
24
"""
NEW
25
function transfer(::SpatialMatrix{<:Real}, ::TransferFunction) end
×
26

27
# TODO: When it is possible to mark the non-first argument as the interfacing type, it should be done with interfaces
28
# again <27-08-25> 
29
"""
30
    restore(A::SpatialMatrix, t::TransferFunction)
31
The reverse pass of the transfer function operator `t` on the image `A`.
32

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

36
See also [`transfer`](@ref)
37
"""
NEW
38
function restore(::SpatialMatrix{<:Real}, t::TransferFunction) end
×
39

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

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

54
        return true
8✔
55
    end
56
end
57

58
# NOTE: Taken from Distributions.jl <kunzaatko> 
59
function Base.hash(tf::TransferFunction, h::UInt)
8✔
60
    hashed = hash(TransferFunction, h)
8✔
61
    hashed = hash(nameof(typeof(tf)), hashed)
8✔
62

63
    for f in fieldnames(typeof(tf))
8✔
64
        hashed = hash(getfield(tf, f), hashed)
32✔
65
    end
40✔
66

67
    return hashed
8✔
68
end
69

70
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