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

Method __init__

monai/transforms/spatial/dictionary.py:175–222  ·  view source on GitHub ↗

Args: keys: keys of the corresponding items to be transformed. mode: {``"bilinear"``, ``"nearest"``} or spline interpolation order 0-5 (integers). Interpolation mode to calculate output values. Defaults to ``"bilinear"``. See also: htt

(
        self,
        keys: KeysCollection,
        mode: SequenceStr = GridSampleMode.BILINEAR,
        padding_mode: SequenceStr = GridSamplePadMode.BORDER,
        align_corners: Sequence[bool] | bool = False,
        dtype: Sequence[DtypeLike] | DtypeLike = np.float64,
        dst_keys: KeysCollection | None = "dst_affine",
        allow_missing_keys: bool = False,
        lazy: bool = False,
    )

Source from the content-addressed store, hash-verified

173 backend = SpatialResample.backend
174
175 def __init__(
176 self,
177 keys: KeysCollection,
178 mode: SequenceStr = GridSampleMode.BILINEAR,
179 padding_mode: SequenceStr = GridSamplePadMode.BORDER,
180 align_corners: Sequence[bool] | bool = False,
181 dtype: Sequence[DtypeLike] | DtypeLike = np.float64,
182 dst_keys: KeysCollection | None = "dst_affine",
183 allow_missing_keys: bool = False,
184 lazy: bool = False,
185 ) -> None:
186 """
187 Args:
188 keys: keys of the corresponding items to be transformed.
189 mode: {``"bilinear"``, ``"nearest"``} or spline interpolation order 0-5 (integers).
190 Interpolation mode to calculate output values. Defaults to ``"bilinear"``.
191 See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
192 When it's an integer, the numpy (cpu tensor)/cupy (cuda tensor) backends will be used
193 and the value represents the order of the spline interpolation.
194 See also: https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.map_coordinates.html
195 It also can be a sequence, each element corresponds to a key in ``keys``.
196 padding_mode: {``"zeros"``, ``"border"``, ``"reflection"``}
197 Padding mode for outside grid values. Defaults to ``"border"``.
198 See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
199 When `mode` is an integer, using numpy/cupy backends, this argument accepts
200 {'reflect', 'grid-mirror', 'constant', 'grid-constant', 'nearest', 'mirror', 'grid-wrap', 'wrap'}.
201 See also: https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.map_coordinates.html
202 It also can be a sequence, each element corresponds to a key in ``keys``.
203 align_corners: Geometrically, we consider the pixels of the input as squares rather than points.
204 See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
205 It also can be a sequence of bool, each element corresponds to a key in ``keys``.
206 dtype: data type for resampling computation. Defaults to ``float64`` for best precision.
207 If None, use the data type of input data. To be compatible with other modules,
208 the output data type is always ``float32``.
209 It also can be a sequence of dtypes, each element corresponds to a key in ``keys``.
210 dst_keys: the key of the corresponding ``dst_affine`` in the metadata dictionary.
211 allow_missing_keys: don't raise exception if key is missing.
212 lazy: a flag to indicate whether this transform should execute lazily or not.
213 Defaults to False.
214 """
215 MapTransform.__init__(self, keys, allow_missing_keys)
216 LazyTransform.__init__(self, lazy=lazy)
217 self.sp_transform = SpatialResample(lazy=lazy)
218 self.mode = ensure_tuple_rep(mode, len(self.keys))
219 self.padding_mode = ensure_tuple_rep(padding_mode, len(self.keys))
220 self.align_corners = ensure_tuple_rep(align_corners, len(self.keys))
221 self.dtype = ensure_tuple_rep(dtype, len(self.keys))
222 self.dst_keys = ensure_tuple_rep(dst_keys, len(self.keys))
223
224 @LazyTransform.lazy.setter # type: ignore
225 def lazy(self, val: bool) -> None:

Callers

nothing calls this directly

Calls 3

SpatialResampleClass · 0.90
ensure_tuple_repFunction · 0.90
__init__Method · 0.45

Tested by

no test coverage detected