@@ -16,15 +16,15 @@ mask = MaskMulti(rand(1:3, 100, 100))
1616showitems(mask)
1717```
1818"""
19- struct MaskMulti{N, T<: Integer , U, B } <: AbstractArrayItem{N, T}
19+ struct MaskMulti{N, T<: Integer , U} <: AbstractArrayItem{N, T}
2020 data:: AbstractArray{T, N}
2121 classes:: AbstractVector{U}
22- bounds:: AbstractArray{<:SVector{N, B}, N}
22+ bounds:: Bounds{ N}
2323end
2424
2525
2626function MaskMulti (a:: AbstractArray , classes = unique (a))
27- bounds = makebounds (size (a))
27+ bounds = Bounds (size (a))
2828 minimum (a) >= 1 || error (" Class values must start at 1" )
2929 return MaskMulti (a, classes, bounds)
3030end
@@ -39,26 +39,30 @@ Base.show(io::IO, mask::MaskMulti{N, T}) where {N, T} =
3939getbounds (mask:: MaskMulti ) = mask. bounds
4040
4141
42- function project (P, mask:: MaskMulti , indices )
42+ function project (P, mask:: MaskMulti , bounds :: Bounds )
4343 a = itemdata (mask)
4444 etp = mask_extrapolation (a)
45+ res = warp (etp, inv (P), bounds. rs)
4546 return MaskMulti (
46- warp (etp, inv (P), indices) ,
47+ res ,
4748 mask. classes,
48- P .(mask . bounds)
49+ bounds
4950 )
5051end
5152
5253
53- function project! (bufmask:: MaskMulti , P, mask:: MaskMulti , indices)
54- a = OffsetArray (parent (itemdata (bufmask)), indices)
55- bounds_ = P .(getbounds (mask))
56- res = warp! (
54+ function project! (bufmask:: MaskMulti , P, mask:: MaskMulti , bounds)
55+ a = OffsetArray (parent (itemdata (bufmask)), bounds. rs)
56+ warp! (
5757 a,
5858 mask_extrapolation (itemdata (mask)),
5959 inv (P),
6060 )
61- return MaskMulti (a, mask. classes, P .(getbounds (mask)))
61+ return MaskMulti (
62+ a,
63+ mask. classes,
64+ bounds
65+ )
6266end
6367
6468
@@ -91,12 +95,12 @@ mask = MaskBinary(rand(Bool, 100, 100))
9195showitems(mask)
9296```
9397"""
94- struct MaskBinary{N, B } <: AbstractArrayItem{N, Bool}
98+ struct MaskBinary{N} <: AbstractArrayItem{N, Bool}
9599 data:: AbstractArray{Bool, N}
96- bounds:: AbstractArray{<:SVector{N, B}, N}
100+ bounds:: Bounds{ N}
97101end
98102
99- function MaskBinary (a:: AbstractArray{Bool, N} , bounds = makebounds (size (a))) where N
103+ function MaskBinary (a:: AbstractArray{Bool, N} , bounds = Bounds (size (a))) where N
100104 return MaskBinary (a, bounds)
101105end
102106
@@ -105,24 +109,26 @@ Base.show(io::IO, mask::MaskBinary{N}) where {N} =
105109
106110getbounds (mask:: MaskBinary ) = mask. bounds
107111
108- function project (P, mask:: MaskBinary , indices )
112+ function project (P, mask:: MaskBinary , bounds :: Bounds )
109113 etp = mask_extrapolation (itemdata (mask))
110114 return MaskBinary (
111- warp (etp, inv (P), indices ),
112- P .( getbounds (mask)) ,
115+ warp (etp, inv (P), bounds . rs ),
116+ bounds ,
113117 )
114118end
115119
116120
117- function project! (bufmask:: MaskBinary , P, mask:: MaskBinary , indices)
118- bounds_ = P .(getbounds (mask))
119- a = OffsetArray (parent (itemdata (bufmask)), indices)
121+ function project! (bufmask:: MaskBinary , P, mask:: MaskBinary , bounds)
122+ a = OffsetArray (parent (itemdata (bufmask)), bounds. rs)
120123 res = warp! (
121124 a,
122125 mask_extrapolation (itemdata (mask)),
123126 inv (P),
124127 )
125- return MaskBinary (res, P .(getbounds (mask)))
128+ return MaskBinary (
129+ a,
130+ bounds
131+ )
126132end
127133
128134function showitem! (img, mask:: MaskBinary )
0 commit comments