Get a view of the current region of interest during iterative padding. When padding multiple dimensions iteratively corner values are unnecessarily overwritten multiple times. This function reduces the working area for the first dimensions so that corners are excluded. Paramet
(array, original_area_slice, axis)
| 57 | |
| 58 | |
| 59 | def _view_roi(array, original_area_slice, axis): |
| 60 | """ |
| 61 | Get a view of the current region of interest during iterative padding. |
| 62 | |
| 63 | When padding multiple dimensions iteratively corner values are |
| 64 | unnecessarily overwritten multiple times. This function reduces the |
| 65 | working area for the first dimensions so that corners are excluded. |
| 66 | |
| 67 | Parameters |
| 68 | ---------- |
| 69 | array : ndarray |
| 70 | The array with the region of interest. |
| 71 | original_area_slice : tuple of slices |
| 72 | Denotes the area with original values of the unpadded array. |
| 73 | axis : int |
| 74 | The currently padded dimension assuming that `axis` is padded before |
| 75 | `axis` + 1. |
| 76 | |
| 77 | Returns |
| 78 | ------- |
| 79 | roi : ndarray |
| 80 | The region of interest of the original `array`. |
| 81 | """ |
| 82 | axis += 1 |
| 83 | sl = (slice(None),) * axis + original_area_slice[axis:] |
| 84 | return array[sl] |
| 85 | |
| 86 | |
| 87 | def _pad_simple(array, pad_width, fill_value=None): |