@@ -76,7 +76,8 @@ def sliding_window_inference(
7676
7777 Args:
7878 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
80+ for each spatial dimension (eg. 2 for 2D, 3 for 3D).
8081 When its components have None or non-positives, the corresponding inputs dimension will be used.
8182 if the components of the `roi_size` are non-positive values, the transform will use the
8283 corresponding components of img size. For example, `roi_size=(32, -1)` will be adapted
@@ -134,6 +135,9 @@ def sliding_window_inference(
134135 - Inputs must be channel-first and have a batch dim (NCHW / NCDHW).
135136 - If your data is NHWC/NDHWC, please apply `EnsureChannelFirst` / `EnsureChannelFirstd` upstream.
136137
138+ Raises:
139+ ValueError: When the input dimensions do not match the expected dimensions based on ``roi_size``.
140+
137141 """
138142 num_spatial_dims = len (inputs .shape ) - 2
139143
@@ -144,7 +148,7 @@ def sliding_window_inference(
144148 roi_dims = len (roi_size )
145149 if num_spatial_dims != roi_dims :
146150 raise ValueError (
147- f"inputs must have { roi_dims + 2 } dimensions for { roi_dims } D roi_size "
151+ f"Inputs must have { roi_dims + 2 } dimensions for { roi_dims } D roi_size "
148152 f"(Batch, Channel, { ', ' .join (['Spatial' ] * roi_dims )} ), "
149153 f"but got inputs shape { inputs .shape } .\n "
150154 "If you have channel-last data (e.g. B, D, H, W, C), please use "
0 commit comments