Skip to content

Commit

Permalink
add shape check for arbitrary types for DataStats
Browse files Browse the repository at this point in the history
Fixes: Project-MONAI#6844

DataStats was breaking for arbitrary types (other than tensor or array).

Signed-off-by: vgrau98 <[email protected]>
  • Loading branch information
vgrau98 committed Oct 3, 2023
1 parent 31040c8 commit 6afc013
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion monai/transforms/utility/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)})")
Expand Down

0 comments on commit 6afc013

Please sign in to comment.