Methods list

Methods usage

ImageGeoms.ImageGeom — Type
ImageGeom{D,S,M}

Image geometry struct with essential grid parameters.

  • dims::Dims{D} image dimensions
  • deltas::S where S <: NTuple{D} pixel sizes, where each Δ is usually Real or Unitful.Length
  • offsets::NTuple{D,Float32} unitless
  • mask::M where M <: AbstractArray{Bool,D} logical mask, often FillArrays.Trues(dims).
source
ImageGeoms.ImageGeom — Method
ig = ImageGeom(masktype::Mask ; kwargs...)

Constructor with specified mask, e.g., ImageGeom(MaskCircle() ; dims=(6,8)).

source
ImageGeoms.ImageGeom — Method
ig = ImageGeom(dims::Dims, deltas, offsets, [, mask])

Constructor for ImageGeom of dimensions dims.

  • The deltas elements (tuple of grid spacings) should each be Real or a Unitful.Length; default (1,…,1).
  • The offsets (tuple of grid offsets) must be unitless; default (0,…,0).
  • The dims, deltas and offsets tuples must be same length.
  • Default mask is FillArrays.Trues(dims) which is akin to trues(dims).

Using offsets = :dsp means offsets = 0.5 .* iseven.(dims).

Example

julia> ImageGeom((5,7), (2.,3.))
ImageGeom{2, NTuple{2,Float64}, FillArrays.Trues{2, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}}
 dims::NTuple{2,Int64} (5, 7)
 deltas::NTuple{2,Float64} (2.0, 3.0)
 offsets::NTuple{2,Float32} (0.0f0, 0.0f0)
 mask: 5×7 Ones{Bool} {35 of 35}
source
ImageGeoms.ImageGeom — Method
ig = ImageGeom( ; dims=(nx,ny), deltas=(1,1), offsets=(0,0), mask=Trues )

Constructor using named keywords. One can use fovs as an alternate keyword, in which case deltas = fovs ./ dims. The keyword fov applies to all dimensions.

source
ImageGeoms.Mask — Type
Mask

Abstract type for describing the support of an image (i.e., which pixels will be reconstructed in solving an inverse problem).

source
ImageGeoms.downsample! — Method
downsample!(y, x, down::NTuple{Int})

Non-allocating version of y = downsample(x, down). Requires size(y) = ceil(size(x) / down).

source
ImageGeoms.downsample — Method
y = downsample(x, down::NTuple{Int})

Down-sample a Bool array x by "max pooling" in all dimensions. Output size will be ceil(size(x) / down). Thus, in a typical case where size(x) is integer multiple of down, the output size will be size(x) ÷ down.

source
ImageGeoms.downsample — Method
ig_down = downsample(ig, down::Tuple{Int})

Down sample an image geometry by the factor down. Image size ig.dims must be ≥ down. cf image_geom_downsample.

source
ImageGeoms.ellipse — Method
ellipse(ig::ImageGeom{2} ; ...)

Ellipse that just inscribes the rectangle, but keeping a 1 pixel border due to some regularizer limitations.

source
ImageGeoms.embed! — Method
embed!(array, v, mask ; filler=0)

Embed vector v of length count(mask) into elements of array where mask is true, setting the remaining elements to filler (default 0).

source
ImageGeoms.embed — Method
array = embed(matrix::AbstractMatrix{<:Number}, mask::AbstractArray{Bool})

Embed each column of matrix into mask then cat along next dimension

In:

  • matrix [count(mask) L]
  • mask [(N)]

Out:

  • array [(N) L]
source
ImageGeoms.embed — Method
array = embed(v, mask ; filler=0)

Embed vector v of length count(mask) into elements of an array where mask is true; see embed!.

source
ImageGeoms.fovs — Method
fovs(ig::ImageGeom) = ig.dims .* ig.deltas

Return tuple of the field of view (FOV) values for all D axes.

source
ImageGeoms.getindex! — Method
getindex!(y::AbstractVector, x::AbstractArray{T,D}, mask::AbstractArray{Bool,D})

Equivalent to the in-place y .= x[mask] but is non-allocating.

For non-Boolean indexing, just use @views y .= A[index], per https://discourse.julialang.org/t/efficient-non-allocating-in-place-getindex-for-bitarray/42268

source
ImageGeoms.oversample — Method
ig_over = oversample(ig::ImageGeom, over::Int or NTuple)

Over-sample an image geometry by the factor over.

source
ImageGeoms.upsample! — Method
upsample!(y, x, up::NTuple{Int})

Non-allocating version of y = upsample(x, up). Requires size(y) = ceil(size(x) * up).

source
ImageGeoms.upsample — Method
y = upsample(x, up::NTuple{Int})

Up-sample a Bool array x by "repeating" in all dimensions. Output size will be size(x) * up.

source