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

Method __init__

monai/transforms/spatial/array.py:139–171  ·  view source on GitHub ↗

Args: mode: {``"bilinear"``, ``"nearest"``} or spline interpolation order 0-5 (integers). Interpolation mode to calculate output values. Defaults to ``"bilinear"``. See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sampl

(
        self,
        mode: str | int = GridSampleMode.BILINEAR,
        padding_mode: str = GridSamplePadMode.BORDER,
        align_corners: bool = False,
        dtype: DtypeLike = np.float64,
        lazy: bool = False,
    )

Source from the content-addressed store, hash-verified

137 backend = [TransformBackends.TORCH, TransformBackends.NUMPY, TransformBackends.CUPY]
138
139 def __init__(
140 self,
141 mode: str | int = GridSampleMode.BILINEAR,
142 padding_mode: str = GridSamplePadMode.BORDER,
143 align_corners: bool = False,
144 dtype: DtypeLike = np.float64,
145 lazy: bool = False,
146 ):
147 """
148 Args:
149 mode: {``"bilinear"``, ``"nearest"``} or spline interpolation order 0-5 (integers).
150 Interpolation mode to calculate output values. Defaults to ``"bilinear"``.
151 See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
152 When it's an integer, the numpy (cpu tensor)/cupy (cuda tensor) backends will be used
153 and the value represents the order of the spline interpolation.
154 See also: https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.map_coordinates.html
155 padding_mode: {``"zeros"``, ``"border"``, ``"reflection"``}
156 Padding mode for outside grid values. Defaults to ``"border"``.
157 See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
158 When `mode` is an integer, using numpy/cupy backends, this argument accepts
159 {'reflect', 'grid-mirror', 'constant', 'grid-constant', 'nearest', 'mirror', 'grid-wrap', 'wrap'}.
160 See also: https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.map_coordinates.html
161 dtype: data type for resampling computation. Defaults to ``float64`` for best precision.
162 If ``None``, use the data type of input data. To be compatible with other modules,
163 the output data type is always ``float32``.
164 lazy: a flag to indicate whether this transform should execute lazily or not.
165 Defaults to False
166 """
167 LazyTransform.__init__(self, lazy=lazy)
168 self.mode = mode
169 self.padding_mode = padding_mode
170 self.align_corners = align_corners
171 self.dtype = dtype
172
173 def __call__(
174 self,

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected