Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes grid_sample, interpolate URLs #3712

Merged
merged 3 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion monai/apps/deepgrow/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ class RestoreLabeld(MapTransform):
One of the listed string values or a user supplied function for padding. Defaults to ``"constant"``.
See also: https://numpy.org/doc/1.18/reference/generated/numpy.pad.html
align_corners: Geometrically, we consider the pixels of the input as squares rather than points.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
It also can be a sequence of bool, each element corresponds to a key in ``keys``.
meta_keys: explicitly indicate the key of the corresponding meta data dictionary.
for example, for data with key `image`, the metadata by default is in `image_meta_dict`.
Expand Down
6 changes: 3 additions & 3 deletions monai/data/nifti_saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ def __init__(
mode: {``"bilinear"``, ``"nearest"``}
This option is used when ``resample = True``.
Interpolation mode to calculate output values. Defaults to ``"bilinear"``.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
padding_mode: {``"zeros"``, ``"border"``, ``"reflection"``}
This option is used when ``resample = True``.
Padding mode for outside grid values. Defaults to ``"border"``.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
align_corners: Geometrically, we consider the pixels of the input as squares rather than points.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
dtype: data type for resampling computation. Defaults to ``np.float64`` for best precision.
If None, use the data type of input data.
output_dtype: data type for saving data. Defaults to ``np.float32``.
Expand Down
6 changes: 3 additions & 3 deletions monai/data/nifti_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ def write_nifti(
mode: {``"bilinear"``, ``"nearest"``}
This option is used when ``resample = True``.
Interpolation mode to calculate output values. Defaults to ``"bilinear"``.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
padding_mode: {``"zeros"``, ``"border"``, ``"reflection"``}
This option is used when ``resample = True``.
Padding mode for outside grid values. Defaults to ``"border"``.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
align_corners: Geometrically, we consider the pixels of the input as squares rather than points.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
dtype: data type for resampling computation. Defaults to ``np.float64`` for best precision.
If None, use the data type of input data.
output_dtype: data type for saving data. Defaults to ``np.float32``.
Expand Down
2 changes: 1 addition & 1 deletion monai/data/png_saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(
resample: whether to resample and resize if providing spatial_shape in the metadata.
mode: {``"nearest"``, ``"linear"``, ``"bilinear"``, ``"bicubic"``, ``"trilinear"``, ``"area"``}
The interpolation mode. Defaults to ``"nearest"``.
See also: https://pytorch.org/docs/stable/nn.functional.html#interpolate
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html
scale: {``255``, ``65535``} postprocess data by clipping to [0, 1] and scaling
[0, 255] (uint8) or [0, 65535] (uint16). Default is None to disable scaling.
data_root_dir: if not empty, it specifies the beginning parts of the input file's
Expand Down
2 changes: 1 addition & 1 deletion monai/data/png_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def write_png(
output_spatial_shape: spatial shape of the output image.
mode: {``"nearest"``, ``"linear"``, ``"bilinear"``, ``"bicubic"``, ``"trilinear"``, ``"area"``}
The interpolation mode. Defaults to ``"bicubic"``.
See also: https://pytorch.org/docs/stable/nn.functional.html#interpolate
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html
scale: {``255``, ``65535``} postprocess data by clipping to [0, 1] and scaling to
[0, 255] (uint8) or [0, 65535] (uint16). Default is None to disable scaling.

Expand Down
6 changes: 3 additions & 3 deletions monai/handlers/segmentation_saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ def __init__(

- NIfTI files {``"bilinear"``, ``"nearest"``}
Interpolation mode to calculate output values.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
- PNG files {``"nearest"``, ``"linear"``, ``"bilinear"``, ``"bicubic"``, ``"trilinear"``, ``"area"``}
The interpolation mode.
See also: https://pytorch.org/docs/stable/nn.functional.html#interpolate
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html

padding_mode: This option is used when ``resample = True``. Defaults to ``"border"``.

- NIfTI files {``"zeros"``, ``"border"``, ``"reflection"``}
Padding mode for outside grid values.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
- PNG files
This option is ignored.

Expand Down
2 changes: 1 addition & 1 deletion monai/inferers/inferer.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class SlidingWindowInferer(Inferer):
spatial dimensions.
padding_mode: {``"constant"``, ``"reflect"``, ``"replicate"``, ``"circular"``}
Padding mode when ``roi_size`` is larger than inputs. Defaults to ``"constant"``
See also: https://pytorch.org/docs/stable/nn.functional.html#pad
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.pad.html
cval: fill value for 'constant' padding mode. Default: 0
sw_device: device for the window data.
By default the device (and accordingly the memory) of the `inputs` is used.
Expand Down
2 changes: 1 addition & 1 deletion monai/inferers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def sliding_window_inference(
spatial dimensions.
padding_mode: {``"constant"``, ``"reflect"``, ``"replicate"``, ``"circular"``}
Padding mode for ``inputs``, when ``roi_size`` is larger than inputs. Defaults to ``"constant"``
See also: https://pytorch.org/docs/stable/nn.functional.html#pad
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.pad.html
cval: fill value for 'constant' padding mode. Default: 0
sw_device: device for the window data.
By default the device (and accordingly the memory) of the `inputs` is used.
Expand Down
2 changes: 1 addition & 1 deletion monai/networks/blocks/upsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(
If ends with ``"linear"`` will use ``spatial dims`` to determine the correct interpolation.
This corresponds to linear, bilinear, trilinear for 1D, 2D, and 3D respectively.
The interpolation mode. Defaults to ``"linear"``.
See also: https://pytorch.org/docs/stable/nn.html#upsample
See also: https://pytorch.org/docs/stable/generated/torch.nn.Upsample.html
align_corners: set the align_corners parameter of `torch.nn.Upsample`. Defaults to True.
Only used in the "nontrainable" mode.
bias: whether to have a bias term in the default preconv and deconv layers. Defaults to True.
Expand Down
2 changes: 1 addition & 1 deletion monai/networks/blocks/warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, mode=GridSampleMode.BILINEAR.value, padding_mode=GridSamplePa
- mode: ``"nearest"``, ``"bilinear"``, ``"bicubic"``.
- padding_mode: ``"zeros"``, ``"border"``, ``"reflection"``

See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html

For MONAI C++/CUDA extensions, the possible values are:

Expand Down
6 changes: 3 additions & 3 deletions monai/networks/layers/spatial_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,11 @@ def __init__(
coordinates.
mode: {``"bilinear"``, ``"nearest"``}
Interpolation mode to calculate output values. Defaults to ``"bilinear"``.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
padding_mode: {``"zeros"``, ``"border"``, ``"reflection"``}
Padding mode for outside grid values. Defaults to ``"zeros"``.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
align_corners: see also https://pytorch.org/docs/stable/nn.functional.html#grid-sample.
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
align_corners: see also https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html.
reverse_indexing: whether to reverse the spatial indexing of image and coordinates.
set to `False` if `theta` follows pytorch's default "D, H, W" convention.
set to `True` if `theta` follows `scipy.ndimage` default "i, j, k" convention.
Expand Down
4 changes: 2 additions & 2 deletions monai/transforms/croppad/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ def __init__(
``"mean"``, ``"median"``, ``"minimum"``, ``"reflect"``, ``"symmetric"``, ``"wrap"``, ``"empty"``}
available modes for PyTorch Tensor: {``"constant"``, ``"reflect"``, ``"replicate"``, ``"circular"``}.
One of the listed string values or a user supplied function. Defaults to ``"constant"``.
See also: https://numpy.org/doc/1.18/reference/generated/numpy.pad.html
https://pytorch.org/docs/stable/generated/torch.nn.functional.pad.html
See also: https://numpy.org/doc/1.18/reference/ghttps://pytorch.orgenerated/numpy.pad.html
/docs/stable/generated/torch.nn.functional.pad.html
It also can be a sequence of string, each element corresponds to a key in ``keys``.
method: {``"symmetric"``, ``"end"``}
Pad image symmetrically on every side or only pad at the end sides. Defaults to ``"symmetric"``.
Expand Down
6 changes: 3 additions & 3 deletions monai/transforms/io/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,16 @@ class SaveImage(Transform):

- NIfTI files {``"bilinear"``, ``"nearest"``}
Interpolation mode to calculate output values.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
- PNG files {``"nearest"``, ``"linear"``, ``"bilinear"``, ``"bicubic"``, ``"trilinear"``, ``"area"``}
The interpolation mode.
See also: https://pytorch.org/docs/stable/nn.functional.html#interpolate
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html

padding_mode: This option is used when ``resample = True``. Defaults to ``"border"``.

- NIfTI files {``"zeros"``, ``"border"``, ``"reflection"``}
Padding mode for outside grid values.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
- PNG files
This option is ignored.

Expand Down
6 changes: 3 additions & 3 deletions monai/transforms/io/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,16 @@ class SaveImaged(MapTransform):

- NIfTI files {``"bilinear"``, ``"nearest"``}
Interpolation mode to calculate output values.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
- PNG files {``"nearest"``, ``"linear"``, ``"bilinear"``, ``"bicubic"``, ``"trilinear"``, ``"area"``}
The interpolation mode.
See also: https://pytorch.org/docs/stable/nn.functional.html#interpolate
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html

padding_mode: This option is used when ``resample = True``. Defaults to ``"border"``.

- NIfTI files {``"zeros"``, ``"border"``, ``"reflection"``}
Padding mode for outside grid values.
See also: https://pytorch.org/docs/stable/nn.functional.html#grid-sample
See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
- PNG files
This option is ignored.

Expand Down
Loading