Helper Functions
Helper.jl
contains some helpfer functions that are used throughout the Mapper.
Mapper2.Helper.add_to_dict
— Function.add_to_dict(d::Dict{K}, k::K, v = 1; b = 1) where K
Increment d[k]
by v
. If d[k]
does not exist, initialize d[k] = b
.
Mapper2.Helper.dim_min
— Function.dim_min(indices)
returns tuple of the minimum componentwise values from a collection of CartesianIndices.
Mapper2.Helper.dim_max
— Function.dim_max(indices)
returns tuple of the minimum componentwise values from a collection of CartesianIndices.
Mapper2.Helper.emptymeta
— Function.Return an empty Dict{String,Any}()
for metadata
fields.
Mapper2.Helper.intern
— Function.intern(x)
Given a mutable collection x
, make all equivalent values in x
point to a single instance in memory. If x
is made up of many of the same arrays, this can greatly decrease the amount of memory required to store x
.
Mapper2.Helper.push_to_dict
— Function.push_to_dict(d, k, v)
Push value v
to the vector found in dictionary d
at d[k]
. If d[k]
does not exist, create a new vector by d[k] = [v]
.
Mapper2.Helper.rev_dict
— Function.rev_dict(d)
Reverse the keys and values of dictionary d
. Behavior if multiple values are equivalent is not defined.
Mapper2.Helper.rev_dict_safe
— Function.rev_dict_safe(d::Dict{K,V}) where {K,V}
Reverse the keys and values of dictionary d
. Returns a dictionary of type Dict{V, Vector{K}}
to handle the case where the same value in d
points to multiple keys.