Unified IlluminationPattern
Interface
SIMIlluminationPatterns.IlluminationPattern
— TypeSuper type for N
-dimensional illumation patterns. Any particular illumination pattern is a subtype of this. See the documentation for IlluminationPattern
interface to see how to implement your own illumination pattern subtype.
See also: Harmonic2D
Implementation
When implementing a new subtype A <: IlluminationPattern{N}
you need to implement the following methods:
(pattern::A)(r::Vararg{Length, N})::Real
representing the intensity ofpattern
at the positionr
and these optional methods:
TODO
The inner constructor of the subtype A
should check that N::Integer
unless your subtype has a specified dimension.
struct A1{N} <: IlluminationPattern{N}
function A{N}() where {N}
@assert N isa Integer
new{N}()
end
end
struct A2 <: IlluminationPattern{2}
function A2()
# No need for any assertions
new()
end
end
SIMIlluminationPatterns.SampledIlluminationPattern
— TypeSampledIlluminationPattern{T<:Real,N,IP<:IlluminationPattern{N}}
SampledIlluminationPattern([T=Float64], ip::IlluminationPattern, Δxy)
N
-dimensional sampled illumination pattern. You can fix the pixels sizes (Δxy
) and sample the pattern on your sensor and optical system setup.
Examples
julia> h = Harmonic(1.0, π / 4, 2 / 61u"nm", 0.0)
Harmonic2D(m=1.0, θ=0.785, ν=0.0328 nm^-1, ϕ=0.0)
julia> sampled_ip = SampledIlluminationPattern(h, (30u"nm", 30u"nm"))
Harmonic2D(m=1.0, θ=0.785, ν=0.0328 nm^-1, ϕ=0.0)(Δxy = 30 nm) with eltype Float64
julia> sampled_ip(3, 4.5)
1.1048934112868387
julia> sampled_ip(CartesianIndex(1,1))
0.6126893879715403
julia> img = rand(10,10);
julia> sampled_ip((5, 5))
5×5 Matrix{Float64}:
1.5 0.832154 0.612689 1.42788 1.10004
0.832154 0.612689 1.42788 1.10004 0.504955
0.612689 1.42788 1.10004 0.504955 1.23233
1.42788 1.10004 0.504955 1.23233 1.33906
1.10004 0.504955 1.23233 1.33906 0.54003
julia> sampled_ip((10, 10)) == sampled_ip(img)
true
julia> sampled_ip(CartesianIndices(img)) != sampled_ip(img) # BEWARE! This is not equivalent
true
julia> sampled_ip(CartesianIndices((0:9, 0:9))) == sampled_ip(img) # This is equivalent
true