Methods list
ImageGeoms.ImageGeoms
ImageGeoms.ImageGeom
ImageGeoms.ImageGeom
ImageGeoms.ImageGeom
ImageGeoms.ImageGeom
ImageGeoms.Mask
Base.show
ImageGeoms.downsample
ImageGeoms.downsample
ImageGeoms.downsample!
ImageGeoms.ellipse
ImageGeoms.embed
ImageGeoms.embed
ImageGeoms.embed!
ImageGeoms.expand_nz
ImageGeoms.fovs
ImageGeoms.getindex!
ImageGeoms.mask_or
ImageGeoms.mask_outline
ImageGeoms.maskit
ImageGeoms.oversample
ImageGeoms.upsample
ImageGeoms.upsample!
Methods usage
ImageGeoms.ImageGeoms
— ModuleImageGeoms
Module for describing image geometries.
ImageGeoms.ImageGeom
— TypeImageGeom{D,S,M}
Image geometry struct with essential grid parameters.
dims::Dims{D}
image dimensionsdeltas::S
whereS <: NTuple{D}
pixel sizes, where each Δ is usuallyReal
orUnitful.Length
offsets::NTuple{D,Float32}
unitlessmask::M
whereM <: AbstractArray{Bool,D}
logical mask, oftenFillArrays.Trues(dims)
.
ImageGeoms.ImageGeom
— Methodig = ImageGeom(masktype::Mask ; kwargs...)
Constructor with specified mask, e.g., ImageGeom(MaskCircle() ; dims=(6,8))
.
ImageGeoms.ImageGeom
— Methodig = ImageGeom(dims::Dims, deltas, offsets, [, mask])
Constructor for ImageGeom
of dimensions dims
.
- The
deltas
elements (tuple of grid spacings) should each beReal
or aUnitful.Length
; default(1,…,1)
. - The
offsets
(tuple of grid offsets) must be unitless; default(0,…,0)
. - The
dims
,deltas
andoffsets
tuples must be same length. - Default
mask
isFillArrays.Trues(dims)
which is akin totrues(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}
ImageGeoms.ImageGeom
— Methodig = 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.
ImageGeoms.Mask
— TypeMask
Abstract type for describing the support of an image (i.e., which pixels will be reconstructed in solving an inverse problem).
Base.show
— Methodshow(io::IO, ::MIME"text/plain", ig::ImageGeom)
ImageGeoms.downsample!
— Methoddownsample!(y, x, down::NTuple{Int})
Non-allocating version of y = downsample(x, down)
. Requires size(y) = ceil(size(x) / down)
.
ImageGeoms.downsample
— Methody = 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
.
ImageGeoms.downsample
— Methodig_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
.
ImageGeoms.ellipse
— Methodellipse(ig::ImageGeom{2} ; ...)
Ellipse that just inscribes the rectangle, but keeping a 1 pixel border due to some regularizer limitations.
ImageGeoms.embed!
— Methodembed!(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).
ImageGeoms.embed
— Methodarray = 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]
ImageGeoms.embed
— Methodarray = embed(v, mask ; filler=0)
Embed vector v
of length count(mask)
into elements of an array where mask
is true
; see embed!
.
ImageGeoms.expand_nz
— Methodig_new = expand_nz(ig::ImageGeom{3}, nz_pad::Int)
Pad both ends along z.
ImageGeoms.fovs
— Methodfovs(ig::ImageGeom) = ig.dims .* ig.deltas
Return tuple of the field of view (FOV) values for all D axes.
ImageGeoms.getindex!
— Methodgetindex!(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
ImageGeoms.mask_or
— Methodmask_or(mask)
compress 3D mask to 2D by logical or
along z
direction
ImageGeoms.mask_outline
— Methodmask_outline(mask)
Return outer boundary of 2D mask
(or mask_or
for 3D).
ImageGeoms.maskit
— Methodmaskit(x::AbstractArray{<:Number}, mask)
opposite of embed
ImageGeoms.oversample
— Methodig_over = oversample(ig::ImageGeom, over::Int or NTuple)
Over-sample an image geometry by the factor over
.
ImageGeoms.upsample!
— Methodupsample!(y, x, up::NTuple{Int})
Non-allocating version of y = upsample(x, up)
. Requires size(y) = ceil(size(x) * up)
.
ImageGeoms.upsample
— Methody = upsample(x, up::NTuple{Int})
Up-sample a Bool
array x
by "repeating" in all dimensions. Output size will be size(x) * up
.