You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds documentation for `kern_padding`, `outer_axes`, and `padtoaxes`
functions, which are helper functions for sampling extended arrays for
filtering purposes.
Also fixes the missing cross-refs and fixes the `rand` doctest.
Copy file name to clipboardExpand all lines: docs/src/pages/arrays/border-arrays.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,8 +80,31 @@ end
80
80
f
81
81
```
82
82
83
-
If the border type does not support the extent of the padding that is given in the constructor, the [`TransferFunctions.InvalidBorderExtent`](@ref) is thrown.
83
+
If the border type does not support the extent of the padding that is given in the constructor, the
84
+
[`TransferFunctions.InvalidBorderExtent`](@ref) is thrown.
84
85
85
86
```@docs
86
87
TransferFunctions.InvalidBorderExtent
87
88
```
89
+
90
+
# Functions
91
+
Border arrays are useful for extending the domain of an array for [filtering](@ref filtering-manual).
92
+
93
+
This motivates some helper functions for sampling an extended array at given indices.
94
+
95
+
To determine the padding necessary for a given kernel in filtering, you can use `kern_padding`
96
+
97
+
```@docs
98
+
TransferFunctions.kern_padding
99
+
```
100
+
101
+
For determining the indices that are necessary in the parent to facilitate a filtering, you can use `outer_axes`
102
+
```@docs
103
+
TransferFunctions.outer_axes
104
+
```
105
+
106
+
For extending the domain of an array to some given indices with a border strategy, you can use `padtoaxes`. This may
107
+
also be useful if you do not want to have all the indices of the parent in the output of a filtering.
11×16 border_array(view(OffsetArray(::Matrix{Float64}, -30:69, -20:79), Base.IdentityUnitRange(-30:-25), Base.IdentityUnitRange(-20:-15)), fill(0.0)) with eltype Float64 with indices -35:-25×-30:-15:
11×16 border_array(view(OffsetArray(reshape(::UnitRange{Int64}, 100, 100), -30:69, -20:79), Base.IdentityUnitRange(-30:-25), Base.IdentityUnitRange(-20:-15)), fill(0)) with eltype Int64 with indices -35:-25×-30:-15:
303
+
0 0 0 0 0 0 0 0 0 0 000 000
304
+
0 0 0 0 0 0 0 0 0 0 000 000
305
+
0 0 0 0 0 0 0 0 0 0 000 000
306
+
0 0 0 0 0 0 0 0 0 0 000 000
307
+
0 0 0 0 0 0 0 0 0 0 000 000
308
+
0 0 0 0 0 0 0 0 0 0 1 101 201 301 401 501
309
+
0 0 0 0 0 0 0 0 0 0 2 102 202 302 402 502
310
+
0 0 0 0 0 0 0 0 0 0 3 103 203 303 403 503
311
+
0 0 0 0 0 0 0 0 0 0 4 104 204 304 404 504
312
+
0 0 0 0 0 0 0 0 0 0 5 105 205 305 405 505
313
+
0 0 0 0 0 0 0 0 0 0 6 106 206 306 406 506
314
314
```
315
+
316
+
!!! warning "`:circular` border"
317
+
By default, this constructs a border array from the view into the parent array. If you use some border strategy that
318
+
uses indices and/or values of the other edge, you may want to have the border array constructed from the full array
319
+
instead and take the view into it. This can be done by setting the `outerpadding` keyword argument to `true`.
4×4 border_array(view(reshape(::UnitRange{Int64}, 11, 11), Base.IdentityUnitRange(1:2), Base.IdentityUnitRange(1:2)), :Circular) with eltype Int64 with indices -1:2×-1:2:
4×4 view(border_array(reshape(::UnitRange{Int64}, 11, 11), :Circular), Base.IdentityUnitRange(-1:2), Base.IdentityUnitRange(-1:2)) with eltype Int64 with indices -1:2×-1:2:
332
+
109 120 10 21
333
+
110 121 11 22
334
+
100 111 1 12
335
+
101 112 2 13
336
+
```
337
+
338
+
!!! tip "Border extent"
339
+
`outerpadding` may also lead to a greater extent of the border supplied since for example the `:circular` border is
340
+
only defined when the wrapped index is in the range of the parent view which is smaller that the parent array.
0 commit comments