Each reflect each boundary value outwards This mimics what the skimage.filters.gaussian_filter(... mode="nearest") does.
(x, axis, depth)
| 232 | |
| 233 | |
| 234 | def nearest(x, axis, depth): |
| 235 | """Each reflect each boundary value outwards |
| 236 | |
| 237 | This mimics what the skimage.filters.gaussian_filter(... mode="nearest") |
| 238 | does. |
| 239 | """ |
| 240 | left = ( |
| 241 | (slice(None, None, None),) * axis |
| 242 | + (slice(0, 1),) |
| 243 | + (slice(None, None, None),) * (x.ndim - axis - 1) |
| 244 | ) |
| 245 | right = ( |
| 246 | (slice(None, None, None),) * axis |
| 247 | + (slice(-1, -2, -1),) |
| 248 | + (slice(None, None, None),) * (x.ndim - axis - 1) |
| 249 | ) |
| 250 | |
| 251 | l = repeat(x[left], depth, axis=axis) |
| 252 | r = repeat(x[right], depth, axis=axis) |
| 253 | |
| 254 | l, r = _remove_overlap_boundaries(l, r, axis, depth) |
| 255 | |
| 256 | return concatenate([l, x, r], axis=axis) |
| 257 | |
| 258 | |
| 259 | def constant(x, axis, depth, value): |
no test coverage detected
searching dependent graphs…