Center Conventions
Some types to adress the center.
Types
NDTools.Center — TypeNDTools.CenterMiddle — TypeCenterMiddleType to indicate that the center should be at the mathematical center of the array (if interpreted as a N dimensional volume). This corresponds in an array with size (5,4,3) to the indices (3,2.5,2).
NDTools.CenterFirst — TypeCenterFirstType to indicate that the center should be at the first entry of the array. This corresponds to the indices (1,1,1,...).
NDTools.CenterLast — TypeCenterEndType to indicate that the center should be at the last entry of the array. This corresponds in an array with size (5,4,3) to the indices (5,4,3).
NDTools.CenterFT — TypeCenterFTType to indicate that the center should be at the center defined in the FFT sense. This corresponds in an array with size (5,4,3) to the indices (3,3,2).
Functions
NDTools.center — Functioncenter(sz::NTuple{N, T}, ::Type{<:Center})Return the corresponding center of an array with size sz. Depending on the Center type the center is chosen. See CenterFirst, CenterLast, CenterMiddle, CenterFT.
julia> center((1,2,3,4), CenterFirst)
(1, 1, 1, 1)
julia> center((1,2,3,4), CenterLast)
(1, 2, 3, 4)
julia> center((1,2,3,4), CenterMiddle)
(1.0, 1.5, 2.0, 2.5)
julia> center((1,2,3,4), CenterFT)
(1, 2, 2, 3)center(sz::NTuple{N, T}, j<:Number)Return an tuple with the same length as sz and with entries j.
Examples
julia> center((2,2), 1)
(1, 1)
julia> center((2,2, 5), 3)
(3, 3, 3)center(sz::NTuple{N, T}, ctr::NTuple{N, T})Return ctr.
Examples
julia> center((1,2), (1,1))
(1, 1)
julia> center((1,3), (1,1))
(1, 1)