You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: monai/inferers/utils.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ def sliding_window_inference(
76
76
77
77
Args:
78
78
inputs: input image to be processed (assuming NCHW[D])
79
-
roi_size: the spatial window size for inferences.
79
+
roi_size: the spatial window size for inferences, this must be a single value or a tuple with values for each spatial dimension (eg. 2 for 2D, 3 for 3D).
80
80
When its components have None or non-positives, the corresponding inputs dimension will be used.
81
81
if the components of the `roi_size` are non-positive values, the transform will use the
82
82
corresponding components of img size. For example, `roi_size=(32, -1)` will be adapted
@@ -133,6 +133,9 @@ def sliding_window_inference(
133
133
Note:
134
134
- Inputs must be channel-first and have a batch dim (NCHW / NCDHW).
135
135
- If your data is NHWC/NDHWC, please apply `EnsureChannelFirst` / `EnsureChannelFirstd` upstream.
136
+
137
+
Raises:
138
+
ValueError: When the input dimensions do not match the expected dimensions based on ``roi_size``.
136
139
137
140
"""
138
141
num_spatial_dims=len(inputs.shape) -2
@@ -144,7 +147,7 @@ def sliding_window_inference(
144
147
roi_dims=len(roi_size)
145
148
ifnum_spatial_dims!=roi_dims:
146
149
raiseValueError(
147
-
f"inputs must have {roi_dims+2} dimensions for {roi_dims}D roi_size "
150
+
f"Inputs must have {roi_dims+2} dimensions for {roi_dims}D roi_size "
0 commit comments