Commit e90617f1 authored by Éric Thiébaut's avatar Éric Thiébaut
Browse files

Add pupil_shape method

parent b7fa512d
......@@ -176,6 +176,34 @@ function indexed_layout(inds::AbstractArray{<:Integer})
return cnt, xinds
end
#------------------------------------------------------------------------------
# PUPIL SHAPE
"""
pupil_shape(args...) -> msk
yields a 2D mask (a Julia matrix of boolean elements) defining the valid/active
positions in a pupil.
"""
pupil_shape(rows::AbstractString...) = pupil_shape(rows)
function pupil_shape(rows::Union{AbstractVector{<:AbstractString},
Tuple{Vararg{AbstractString}}})
nrows = length(rows)
ncols = length(rows[1])
A = Array{Bool,2}(undef, ncols, nrows)
for y in 1:nrows
row = rows[y]
length(row) == ncols || error("all rows must have the same length")
for x in 1:ncols
A[x,y] = !isspace(row[x])
end
end
return A
end
pupil_shape(A::AbstractMatrix{Bool}) = A
#------------------------------------------------------------------------------
# VECTORIZED OPERATIONS
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment