From 6afc013fb5c605e058c4c3b020f74aca9603defb Mon Sep 17 00:00:00 2001 From: vgrau98 Date: Tue, 3 Oct 2023 13:52:25 +0000 Subject: [PATCH] add shape check for arbitrary types for DataStats Fixes: #6844 DataStats was breaking for arbitrary types (other than tensor or array). Signed-off-by: vgrau98 --- monai/transforms/utility/array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monai/transforms/utility/array.py b/monai/transforms/utility/array.py index ef2a714a25..f9b81865e0 100644 --- a/monai/transforms/utility/array.py +++ b/monai/transforms/utility/array.py @@ -681,7 +681,7 @@ def __call__( if self.data_type if data_type is None else data_type: lines.append(f"Type: {type(img)} {img.dtype if hasattr(img, 'dtype') else None}") if self.data_shape if data_shape is None else data_shape: - lines.append(f"Shape: {img.shape}") + lines.append(f"Shape: {img.shape if hasattr(img, 'shape') else None}") if self.value_range if value_range is None else value_range: if isinstance(img, np.ndarray): lines.append(f"Value range: ({np.min(img)}, {np.max(img)})")