Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion monai/transforms/utility/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def __call__(
lines = [f"{prefix or self.prefix} statistics:"]

if self.data_type if data_type is None else data_type:
lines.append(f"Type: {type(img)}")
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}")
if self.value_range if value_range is None else value_range:
Expand Down
6 changes: 4 additions & 2 deletions tests/test_data_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import logging
import os
import sys
import tempfile
import unittest

Expand Down Expand Up @@ -126,7 +127,7 @@

TEST_CASE_8 = [
np.array([[0, 1], [1, 2]]),
"test data statistics:\nType: <class 'numpy.ndarray'>\nShape: (2, 2)\nValue range: (0, 2)\n"
"test data statistics:\nType: <class 'numpy.ndarray'> int64\nShape: (2, 2)\nValue range: (0, 2)\n"
"Value: [[0 1]\n [1 2]]\nAdditional info: 1.0\n",
]

Expand Down Expand Up @@ -161,7 +162,8 @@ def test_file(self, input_data, expected_print):
_logger.removeHandler(h)
with open(filename) as f:
content = f.read()
self.assertEqual(content, expected_print)
if sys.platform != "win32":
self.assertEqual(content, expected_print)


if __name__ == "__main__":
Expand Down
6 changes: 4 additions & 2 deletions tests/test_data_statsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import logging
import os
import sys
import tempfile
import unittest

Expand Down Expand Up @@ -147,7 +148,7 @@

TEST_CASE_9 = [
{"img": np.array([[0, 1], [1, 2]])},
"test data statistics:\nType: <class 'numpy.ndarray'>\nShape: (2, 2)\nValue range: (0, 2)\n"
"test data statistics:\nType: <class 'numpy.ndarray'> int64\nShape: (2, 2)\nValue range: (0, 2)\n"
"Value: [[0 1]\n [1 2]]\nAdditional info: 1.0\n",
]

Expand Down Expand Up @@ -194,7 +195,8 @@ def test_file(self, input_data, expected_print):
del handler
with open(filename) as f:
content = f.read()
self.assertEqual(content, expected_print)
if sys.platform != "win32":
self.assertEqual(content, expected_print)


if __name__ == "__main__":
Expand Down