MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / grid_push

Function grid_push

monai/networks/layers/spatial_transforms.py:160–237  ·  view source on GitHub ↗

Splat an image with respect to a deformation field (pull adjoint). `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 'qu

(
    input: torch.Tensor, grid: torch.Tensor, shape=None, interpolation="linear", bound="zero", extrapolate: bool = True
)

Source from the content-addressed store, hash-verified

158
159
160def grid_push(
161 input: torch.Tensor, grid: torch.Tensor, shape=None, interpolation="linear", bound="zero", extrapolate: bool = True
162):
163 """
164 Splat an image with respect to a deformation field (pull adjoint).
165
166 `interpolation` can be an int, a string or an InterpolationType.
167 Possible values are::
168
169 - 0 or 'nearest' or InterpolationType.nearest
170 - 1 or 'linear' or InterpolationType.linear
171 - 2 or 'quadratic' or InterpolationType.quadratic
172 - 3 or 'cubic' or InterpolationType.cubic
173 - 4 or 'fourth' or InterpolationType.fourth
174 - 5 or 'fifth' or InterpolationType.fifth
175 - 6 or 'sixth' or InterpolationType.sixth
176 - 7 or 'seventh' or InterpolationType.seventh
177
178 A list of values can be provided, in the order `[W, H, D]`,
179 to specify dimension-specific interpolation orders.
180
181 `bound` can be an int, a string or a BoundType.
182 Possible values are::
183
184 - 0 or 'replicate' or 'nearest' or BoundType.replicate
185 - 1 or 'dct1' or 'mirror' or BoundType.dct1
186 - 2 or 'dct2' or 'reflect' or BoundType.dct2
187 - 3 or 'dst1' or 'antimirror' or BoundType.dst1
188 - 4 or 'dst2' or 'antireflect' or BoundType.dst2
189 - 5 or 'dft' or 'wrap' or BoundType.dft
190 - 7 or 'zero' or BoundType.zero
191
192 A list of values can be provided, in the order `[W, H, D]`,
193 to specify dimension-specific boundary conditions.
194 `sliding` is a specific condition than only applies to flow fields
195 (with as many channels as dimensions). It cannot be dimension-specific.
196 Note that:
197
198 - `dft` corresponds to circular padding
199 - `dct2` corresponds to Neumann boundary conditions (symmetric)
200 - `dst2` corresponds to Dirichlet boundary conditions (antisymmetric)
201
202 See Also:
203
204 - https://en.wikipedia.org/wiki/Discrete_cosine_transform
205 - https://en.wikipedia.org/wiki/Discrete_sine_transform
206 - ``help(monai._C.BoundType)``
207 - ``help(monai._C.InterpolationType)``
208
209 Args:
210 input: Input image `(B, C, Wi, Hi, Di)`.
211 grid: Deformation field `(B, Wi, Hi, Di, 1|2|3)`.
212 shape: Shape of the source image.
213 interpolation (int or list[int] , optional): Interpolation order.
214 Defaults to `'linear'`.
215 bound (BoundType, or list[BoundType], optional): Boundary conditions.
216 Defaults to `'zero'`.
217 extrapolate: Extrapolate out-of-bound data.

Callers

nothing calls this directly

Calls 3

ensure_tupleFunction · 0.90
convert_to_dst_typeFunction · 0.90
applyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…