Args: pixdim: output voxel spacing. if providing a single number, will use it for the first dimension. items of the pixdim sequence map to the spatial dimensions of input image, if length of pixdim sequence is longer than image spatial dimensions,
(
self,
keys: KeysCollection,
pixdim: Sequence[float] | float,
diagonal: bool = False,
mode: SequenceStr = GridSampleMode.BILINEAR,
padding_mode: SequenceStr = GridSamplePadMode.BORDER,
align_corners: Sequence[bool] | bool = False,
dtype: Sequence[DtypeLike] | DtypeLike = np.float64,
scale_extent: bool = False,
recompute_affine: bool = False,
min_pixdim: Sequence[float] | float | None = None,
max_pixdim: Sequence[float] | float | None = None,
ensure_same_shape: bool = True,
allow_missing_keys: bool = False,
lazy: bool = False,
)
| 384 | backend = Spacing.backend |
| 385 | |
| 386 | def __init__( |
| 387 | self, |
| 388 | keys: KeysCollection, |
| 389 | pixdim: Sequence[float] | float, |
| 390 | diagonal: bool = False, |
| 391 | mode: SequenceStr = GridSampleMode.BILINEAR, |
| 392 | padding_mode: SequenceStr = GridSamplePadMode.BORDER, |
| 393 | align_corners: Sequence[bool] | bool = False, |
| 394 | dtype: Sequence[DtypeLike] | DtypeLike = np.float64, |
| 395 | scale_extent: bool = False, |
| 396 | recompute_affine: bool = False, |
| 397 | min_pixdim: Sequence[float] | float | None = None, |
| 398 | max_pixdim: Sequence[float] | float | None = None, |
| 399 | ensure_same_shape: bool = True, |
| 400 | allow_missing_keys: bool = False, |
| 401 | lazy: bool = False, |
| 402 | ) -> None: |
| 403 | """ |
| 404 | Args: |
| 405 | pixdim: output voxel spacing. if providing a single number, will use it for the first dimension. |
| 406 | items of the pixdim sequence map to the spatial dimensions of input image, if length |
| 407 | of pixdim sequence is longer than image spatial dimensions, will ignore the longer part, |
| 408 | if shorter, will pad with `1.0`. |
| 409 | if the components of the `pixdim` are non-positive values, the transform will use the |
| 410 | corresponding components of the original pixdim, which is computed from the `affine` |
| 411 | matrix of input image. |
| 412 | diagonal: whether to resample the input to have a diagonal affine matrix. |
| 413 | If True, the input data is resampled to the following affine:: |
| 414 | |
| 415 | np.diag((pixdim_0, pixdim_1, pixdim_2, 1)) |
| 416 | |
| 417 | This effectively resets the volume to the world coordinate system (RAS+ in nibabel). |
| 418 | The original orientation, rotation, shearing are not preserved. |
| 419 | |
| 420 | If False, the axes orientation, orthogonal rotation and |
| 421 | translations components from the original affine will be |
| 422 | preserved in the target affine. This option will not flip/swap |
| 423 | axes against the original ones. |
| 424 | mode: {``"bilinear"``, ``"nearest"``} or spline interpolation order 0-5 (integers). |
| 425 | Interpolation mode to calculate output values. Defaults to ``"bilinear"``. |
| 426 | See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html |
| 427 | When it's an integer, the numpy (cpu tensor)/cupy (cuda tensor) backends will be used |
| 428 | and the value represents the order of the spline interpolation. |
| 429 | See also: https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.map_coordinates.html |
| 430 | It also can be a sequence, each element corresponds to a key in ``keys``. |
| 431 | padding_mode: {``"zeros"``, ``"border"``, ``"reflection"``} |
| 432 | Padding mode for outside grid values. Defaults to ``"border"``. |
| 433 | See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html |
| 434 | When `mode` is an integer, using numpy/cupy backends, this argument accepts |
| 435 | {'reflect', 'grid-mirror', 'constant', 'grid-constant', 'nearest', 'mirror', 'grid-wrap', 'wrap'}. |
| 436 | See also: https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.map_coordinates.html |
| 437 | It also can be a sequence, each element corresponds to a key in ``keys``. |
| 438 | align_corners: Geometrically, we consider the pixels of the input as squares rather than points. |
| 439 | See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html |
| 440 | It also can be a sequence of bool, each element corresponds to a key in ``keys``. |
| 441 | dtype: data type for resampling computation. Defaults to ``float64`` for best precision. |
| 442 | If None, use the data type of input data. To be compatible with other modules, |
| 443 | the output data type is always ``float32``. |
nothing calls this directly
no test coverage detected