Skip to content

Commit 769a4c3

Browse files
committed
[DLMED] restore the doc-string
Signed-off-by: Nic Ma <nma@nvidia.com>
1 parent 9495d6e commit 769a4c3

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

monai/data/grid_dataset.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,6 @@ class PatchIter:
2929
Return a patch generator with predefined properties such as `patch_size`.
3030
Typically used with :py:class:`monai.data.GridPatchDataset`.
3131
32-
Note:
33-
The `patch_size` is the size of the patch to sample from the input arrays.
34-
It is assumed the arrays first dimension is the channel dimension which will be yielded in its entirety
35-
so this should not be specified in `patch_size`. For example, for an input 3D array with 1 channel of size
36-
(1, 20, 20, 20) a regular grid sampling of eight patches (1, 10, 10, 10) would be specified by
37-
a `patch_size` of (10, 10, 10).
38-
39-
Args:
40-
patch_size: size of patches to generate slices for, 0/None selects whole dimension
41-
start_pos: starting position in the array, default is 0 for each dimension
42-
mode: {``"constant"``, ``"edge"``, ``"linear_ramp"``, ``"maximum"``, ``"mean"``,
43-
``"median"``, ``"minimum"``, ``"reflect"``, ``"symmetric"``, ``"wrap"``, ``"empty"``}
44-
One of the listed string values or a user supplied function. Defaults to ``"wrap"``.
45-
See also: https://numpy.org/doc/1.18/reference/generated/numpy.pad.html
46-
pad_opts: other arguments for the `np.pad` function.
47-
note that `np.pad` treats channel dimension as the first dimension.
48-
4932
"""
5033

5134
def __init__(
@@ -55,6 +38,25 @@ def __init__(
5538
mode: Union[NumpyPadMode, str] = NumpyPadMode.WRAP,
5639
**pad_opts: Dict,
5740
):
41+
"""
42+
43+
Args:
44+
patch_size: size of patches to generate slices for, 0/None selects whole dimension
45+
start_pos: starting position in the array, default is 0 for each dimension
46+
mode: {``"constant"``, ``"edge"``, ``"linear_ramp"``, ``"maximum"``, ``"mean"``,
47+
``"median"``, ``"minimum"``, ``"reflect"``, ``"symmetric"``, ``"wrap"``, ``"empty"``}
48+
One of the listed string values or a user supplied function. Defaults to ``"wrap"``.
49+
See also: https://numpy.org/doc/1.18/reference/generated/numpy.pad.html
50+
pad_opts: other arguments for the `np.pad` function.
51+
note that `np.pad` treats channel dimension as the first dimension.
52+
53+
Note:
54+
The `patch_size` is the size of the
55+
patch to sample from the input arrays. It is assumed the arrays first dimension is the channel dimension which
56+
will be yielded in its entirety so this should not be specified in `patch_size`. For example, for an input 3D
57+
array with 1 channel of size (1, 20, 20, 20) a regular grid sampling of eight patches (1, 10, 10, 10) would be
58+
specified by a `patch_size` of (10, 10, 10).
59+
"""
5860
self.patch_size = (None,) + tuple(patch_size) # expand to have the channel dim
5961
self.start_pos = ensure_tuple(start_pos)
6062
self.mode: NumpyPadMode = look_up_option(mode, NumpyPadMode)

0 commit comments

Comments
 (0)