Sampled Arrays
A SampledArray is a light wrapper on a parent::AbstractArray that holds the sampling rate in every dimension.
TransferFunctions.SampledArray — TypeSampledArray{T,ST,N,AA<:AbstractArray} <: AbstractArray{T,N}An N-dimensional sampled array with data of type T sample single spacing of type ST.
The restriction of ST being a single type means that SampledArray is not able to represent arrays that have different dimensions in each direction.
See also SampledMatrix, SampledVector, SpatialArray
TransferFunctions.SampledMatrix — TypeSampledMatrix{T,ST,AM} <: AbstractMatrix{T}Two-dimensional array with elements of type T with a given sample spacing of type ST. Alias for SampledArray{T,ST,2,AM}.
TransferFunctions.SampledVector — TypeSampledVector{T,ST,AV} <: AbstractVector{T}One-dimensional array with elements of type T with a given sample spacing of type ST. Alias for SampledArray{T,ST,1,AV}.
Most relevant for microscopy images is the SpatialArray which is a SampledArray with Length being the dimension of the sampling.
TransferFunctions.SpatialArray — TypeSpatialArray{T,N,AA} <: AbstractArray{T,N}An N-dimensional array representing values sampled uniformly in space. Alias for SampledArray{T,<:Length,N,AA}.
See also SpatialMatrix, SpatialVector, SampledArray
TransferFunctions.SpatialMatrix — TypeSpatialMatrix{T,AM} <: AbstractMatrix{T}Two-dimensional array with elements of type T with a given sampling distance in both directions. Alias for SpatialArray{T,2,AM}.
TransferFunctions.SpatialVector — TypeSpatialVector{T,AV} <: AbstractVector{T}One-dimensional array with elements of type T with a given sampling distance. Alias for SpatialArray{T,1,AV}.
You can construct a SampledArray by providing the parent and the sampling
A_sampled = SpatialArray(A, 61u"nm")
A_nonequally_sampled = SpatialArray(A, (61u"nm", 54u"nm"))
Methods on SampledArrays
To get the sampling vertices, you can use TransferFunctions.sample_vertices
TransferFunctions.sample_vertices — Methodsample_vertices(a::SampledArray, [pos])Returns the vertices of the samples of a as SVector{2} equivalent to [x, y].
julia> sa = SampledArray(reshape(1:16, (4,4)), 61u"nm");
julia> TF.sample_vertices(sa)
4×4 Matrix{StaticArraysCore.SVector{2, Quantity{Int64, 𝐋, Unitful.FreeUnits{(nm,), 𝐋, nothing}}}}:
[61 nm, 61 nm] [61 nm, 122 nm] [61 nm, 183 nm] [61 nm, 244 nm]
[122 nm, 61 nm] [122 nm, 122 nm] [122 nm, 183 nm] [122 nm, 244 nm]
[183 nm, 61 nm] [183 nm, 122 nm] [183 nm, 183 nm] [183 nm, 244 nm]
[244 nm, 61 nm] [244 nm, 122 nm] [244 nm, 183 nm] [244 nm, 244 nm]
julia> TF.sample_vertices(sa, TF.mid)
4×4 Matrix{StaticArraysCore.SVector{2, Quantity{Float64, 𝐋, Unitful.FreeUnits{(nm,), 𝐋, nothing}}}}:
[91.5 nm, 91.5 nm] [91.5 nm, 152.5 nm] [91.5 nm, 213.5 nm] [91.5 nm, 274.5 nm]
[152.5 nm, 91.5 nm] [152.5 nm, 152.5 nm] [152.5 nm, 213.5 nm] [152.5 nm, 274.5 nm]
[213.5 nm, 91.5 nm] [213.5 nm, 152.5 nm] [213.5 nm, 213.5 nm] [213.5 nm, 274.5 nm]
[274.5 nm, 91.5 nm] [274.5 nm, 152.5 nm] [274.5 nm, 213.5 nm] [274.5 nm, 274.5 nm]
julia> TF.sample_vertices(sa, TF.right)
4×4 Matrix{StaticArraysCore.SVector{2, Quantity{Int64, 𝐋, Unitful.FreeUnits{(nm,), 𝐋, nothing}}}}:
[122 nm, 122 nm] [122 nm, 183 nm] [122 nm, 244 nm] [122 nm, 305 nm]
[183 nm, 122 nm] [183 nm, 183 nm] [183 nm, 244 nm] [183 nm, 305 nm]
[244 nm, 122 nm] [244 nm, 183 nm] [244 nm, 244 nm] [244 nm, 305 nm]
[305 nm, 122 nm] [305 nm, 183 nm] [305 nm, 244 nm] [305 nm, 305 nm]