Validate Patch Dimension
Patch validation functions.
validate_patch_dimensions(arr, patch_size, is_3d_patch)
Check patch size and array compatibility.
This method validates the patch sizes with respect to the array dimensions:
- Patch must have two dimensions fewer than the array (S and C).
- Patch sizes are smaller than the corresponding array dimensions.
If one of these conditions is not met, a ValueError is raised.
This method should be called after inputs have been resized.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
ndarray
|
Input array. |
required |
patch_size
|
Union[list[int], tuple[int, ...]]
|
Size of the patches along each dimension of the array, except the first. |
required |
is_3d_patch
|
bool
|
Whether the patch is 3D or not. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the patch size is not consistent with the array shape (one more array dimension). |
ValueError
|
If the patch size in Z is larger than the array dimension. |
ValueError
|
If either of the patch sizes in X or Y is larger than the corresponding array dimension. |