Helper Functions

Helper Functions

Helper.jl contains some helpfer functions that are used throughout the Mapper.

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.

source

dim_min(indices) returns tuple of the minimum componentwise values from a collection of CartesianIndices.

source

dim_max(indices) returns tuple of the minimum componentwise values from a collection of CartesianIndices.

source

Return an empty Dict{String,Any}() for metadata fields.

source
Mapper2.Helper.internFunction.
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.

source
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].

source
rev_dict(d)

Reverse the keys and values of dictionary d. Behavior if multiple values are equivalent is not defined.

source
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.

source