Sample an image with respect to a deformation field. `interpolation` can be an int, a string or an InterpolationType. Possible values are:: - 0 or 'nearest' or InterpolationType.nearest - 1 or 'linear' or InterpolationType.linear - 2 or 'quadratic' or I
(
input: torch.Tensor, grid: torch.Tensor, interpolation="linear", bound="zero", extrapolate: bool = True
)
| 58 | |
| 59 | |
| 60 | def grid_pull( |
| 61 | input: torch.Tensor, grid: torch.Tensor, interpolation="linear", bound="zero", extrapolate: bool = True |
| 62 | ) -> torch.Tensor: |
| 63 | """ |
| 64 | Sample an image with respect to a deformation field. |
| 65 | |
| 66 | `interpolation` can be an int, a string or an InterpolationType. |
| 67 | Possible values are:: |
| 68 | |
| 69 | - 0 or 'nearest' or InterpolationType.nearest |
| 70 | - 1 or 'linear' or InterpolationType.linear |
| 71 | - 2 or 'quadratic' or InterpolationType.quadratic |
| 72 | - 3 or 'cubic' or InterpolationType.cubic |
| 73 | - 4 or 'fourth' or InterpolationType.fourth |
| 74 | - 5 or 'fifth' or InterpolationType.fifth |
| 75 | - 6 or 'sixth' or InterpolationType.sixth |
| 76 | - 7 or 'seventh' or InterpolationType.seventh |
| 77 | |
| 78 | A list of values can be provided, in the order [W, H, D], |
| 79 | to specify dimension-specific interpolation orders. |
| 80 | |
| 81 | `bound` can be an int, a string or a BoundType. |
| 82 | Possible values are:: |
| 83 | |
| 84 | - 0 or 'replicate' or 'nearest' or BoundType.replicate or 'border' |
| 85 | - 1 or 'dct1' or 'mirror' or BoundType.dct1 |
| 86 | - 2 or 'dct2' or 'reflect' or BoundType.dct2 |
| 87 | - 3 or 'dst1' or 'antimirror' or BoundType.dst1 |
| 88 | - 4 or 'dst2' or 'antireflect' or BoundType.dst2 |
| 89 | - 5 or 'dft' or 'wrap' or BoundType.dft |
| 90 | - 7 or 'zero' or 'zeros' or BoundType.zero |
| 91 | |
| 92 | A list of values can be provided, in the order [W, H, D], |
| 93 | to specify dimension-specific boundary conditions. |
| 94 | `sliding` is a specific condition than only applies to flow fields |
| 95 | (with as many channels as dimensions). It cannot be dimension-specific. |
| 96 | Note that: |
| 97 | |
| 98 | - `dft` corresponds to circular padding |
| 99 | - `dct2` corresponds to Neumann boundary conditions (symmetric) |
| 100 | - `dst2` corresponds to Dirichlet boundary conditions (antisymmetric) |
| 101 | |
| 102 | See Also: |
| 103 | - https://en.wikipedia.org/wiki/Discrete_cosine_transform |
| 104 | - https://en.wikipedia.org/wiki/Discrete_sine_transform |
| 105 | - ``help(monai._C.BoundType)`` |
| 106 | - ``help(monai._C.InterpolationType)`` |
| 107 | |
| 108 | Args: |
| 109 | input: Input image. `(B, C, Wi, Hi, Di)`. |
| 110 | grid: Deformation field. `(B, Wo, Ho, Do, 1|2|3)`. |
| 111 | interpolation (int or list[int] , optional): Interpolation order. |
| 112 | Defaults to `'linear'`. |
| 113 | bound (BoundType, or list[BoundType], optional): Boundary conditions. |
| 114 | Defaults to `'zero'`. |
| 115 | extrapolate: Extrapolate out-of-bound data. |
| 116 | Defaults to `True`. |
| 117 |
searching dependent graphs…