Framewise
For an example of Framewise
in use, along with spatial filtering, see this example.
ADI.Framewise
— TypeFramewise(alg; limit=Inf, delta_rot=nothing)
Framewise(algs::AbstractVector; limit=Inf, delta_rot=nothing)
Wrap an algorithm such that the underlying data will be processed frame by frame. For each frame a reference library is created from the data. This reference can be filtered by rejecting frames which have not rotated a sufficient parallactic angle. delta_rot
sets the required arc length for rotation in units of the FWHM. If delta_rot
is nothing
there will be now temporal filtering. The number of frames retained can be specified with limit
, e.g. the 4 closest frames in time with the target frame.
The following keyword arguments must be provided to reconstruct
or subtract
angles
- the measured parallactic angles for each frame
If delta_rot
is provided, the following additional keyword arguments must be provided to reconstruct
or subtract
.
fwhm
- the FWHM of the instrument in pixels. Will be set to the width of aMultiAnnulusView
r
- The radius of the arc to calculate the parallactic angle threshold. Will be set automatically if usingAnnulusView
orMultiAnnulusView
.
In addition, Framewise
versions of algorithms do not implement ADI.fit
and do not currently support RDI.
Annular reduction
In the case of reducing a MultiAnnulusView
, a vector of algorithms can be used, each one corresponding to each annulus of the view. In this case, too, delta_rot
can be given as a vector or as a tuple. If it is given as a tuple, delta_rot
will increase linearly from the first value to the last value across each annulus.
Examples
julia> cube, angles = # load data
julia> alg = PCA(10) # the algorithm to use on each reference
julia> res = Framewise(alg)(cube, angles);
julia> mav = MultiAnnulusView(cube, 5; inner=5);
julia> res_ann = Framewise(alg, delta_rot=(0.1, 1))(mav, angles);
API/Reference
HCIToolbox.AnnulusView
— TypeAnnulusView(cube::AbstractArray{T,3};
inner=0, outer=first(size(parent))/2 + 0.5,
fill=0)
Cut out an annulus with inner radius inner
and outer radius outer
. Values that fall outside of this region will be replaced with fill
. This does not copy any data, it is merely a view into the data.
(::AnnulusView)(asview=false)
Return the pixels that fall within the annulus as a matrix. This matrix is equivalent to unrolling each frame and then spatially filtering the pixels outside the annulus. If asview
is true, the returned values will be a view of the parent array instead of a copy.
Examples
julia> ann = AnnulusView(ones(101, 101, 10); inner=5, outer=20);
julia> X = ann();
julia> size(X)
(1188, 10)
HCIToolbox.MultiAnnulusView
— TypeMultiAnnulusView(cube::AbstractArray{T,3} width, radii; fill=0)
Create multiple annuli at each radius in radii
with width width
. Values that fall outside of these regions will be replaced with fill
. This does not copy any data, it is merely a view into the data.
MultiAnnulusView(cube::AbstractArray{T,3}, width;
inner=0, outer=first(size(parent))/2 + 0.5,
fill=0)
Create multiple annuli between inner
and outer
with width
spacing. Values that fall outside of these regions will be replaced with fill
. This does not copy any data, it is merely a view into the data.
(::MultiAnnulusView)(idx, asview=false)
Return the idx
th annulus as a matrix. This is equivalent to unrolling the frame and filtering out pixels outside of the idx
th annulus. If asview
is true, the returned values will be a view of the parent array instead of a copy.
Examples
julia> ann = MultiAnnulusView(ones(101, 101, 10), 5; inner=5, outer=30);
julia> X = ann(1);
julia> size(X)
(248, 10)
julia> X2 = ann(2);
julia> size(X2)
(404, 10)
See also
HCIToolbox.eachannulus
— Functioneachannulus(::MultiAnnulusView, asview=false)
Create a generator for each annulus in the view. If asview
is true, the annuli will be returned as a view into the parent array instead of a copy.
Examples
julia> ann = MultiAnnulusView(ones(101, 101, 10), 5; inner=5, outer=30);
julia> [size(X) for X in eachannulus(ann)]
5-element Vector{Tuple{Int64, Int64}}:
(248, 10)
(404, 10)
(560, 10)
(716, 10)
(880, 10)
HCIToolbox.inverse
— Functioninverse(::AnnulusView, mat::AbstractMatrix)
Generate a cube similar to the view with the pixels from mat
. mat
should have the same size as the matrix output from AnnulusView
Examples
julia> ann = AnnulusView(ones(101, 101, 10); inner=5, outer=20);
julia> X = ann();
julia> out = inverse(ann, -X);
julia> out ≈ -ann
true
inverse(::MultiAnnulusView, idx, mat)
inverse(::MultiAnnulusView, mats...)
Generate a cube similar to the view using the given pixel matrices. The pixels from mat
will be put into the location of the idx
th annulus. mat
should have the same size as the output matrices generated by MultiAnnulusView
. If multiple matrices are supplied, it is assumed each one corresponds to each annulus in the view.
Examples
Expand a single annulus-
julia> ann = MultiAnnulusView(ones(101, 101, 10), 5; inner=5, outer=30);
julia> X = ann(1);
julia> out = inverse(ann, 1, -X);
julia> sum(out) == -sum(X)
true
expand many annuli-
julia> Xs = [-X for X in eachannulus(ann)];
julia> out = inverse(ann, Xs);
julia> out ≈ -ann
true
HCIToolbox.inverse!
— Functioninverse!(::AnnulusView, out, mat)
In-place version of inverse
that fills out
in-place.
inverse!(::MultiAnnulusView, out, idx, mat)
inverse!(::MultiAnnulusView, out, mats...)
In-place version of inverse
that fills out
with annuli defined by the geometry of the view.