Skip to content

Commit 65e8f5b

Browse files
authored
add shape check for arbitrary types for DataStats (#7082)
Fixes #6844. ### Description DataStats was breaking for arbitrary types (other than tensor or array) because of shape attribute. Changes are made in order to be consistent with other DataStats attributes management like `data_type`. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: vgrau98 <victor.grau93@gmail.com>
1 parent 31040c8 commit 65e8f5b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

monai/transforms/utility/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ def __call__(
681681
if self.data_type if data_type is None else data_type:
682682
lines.append(f"Type: {type(img)} {img.dtype if hasattr(img, 'dtype') else None}")
683683
if self.data_shape if data_shape is None else data_shape:
684-
lines.append(f"Shape: {img.shape}")
684+
lines.append(f"Shape: {img.shape if hasattr(img, 'shape') else None}")
685685
if self.value_range if value_range is None else value_range:
686686
if isinstance(img, np.ndarray):
687687
lines.append(f"Value range: ({np.min(img)}, {np.max(img)})")

runtests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ then
544544
if ! is_pip_installed pylint
545545
then
546546
echo "Pip installing pylint ..."
547-
${cmdPrefix}${PY_EXE} -m pip install pylint>2.16
547+
${cmdPrefix}${PY_EXE} -m pip install "pylint>2.16,!=3.0.0"
548548
fi
549549
${cmdPrefix}${PY_EXE} -m pylint --version
550550

0 commit comments

Comments
 (0)