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/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ def convert_tables_to_dicts(
kwargs: additional arguments for `pandas.merge()` API to join tables.

"""
df = reduce(lambda l, r: pd.merge(l, r, **kwargs), ensure_tuple(dfs))
df = reduce(pd.merge, ensure_tuple(dfs))
# parse row indices
rows: List[Union[int, str]] = []
if row_indices is None:
Expand Down
10 changes: 5 additions & 5 deletions monai/handlers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ class mean median max 5percentile 95percentile notnans
if summary_ops is not None:
supported_ops = OrderedDict(
{
"mean": lambda x: np.nanmean(x),
"median": lambda x: np.nanmedian(x),
"max": lambda x: np.nanmax(x),
"min": lambda x: np.nanmin(x),
"mean": np.nanmean,
"median": np.nanmedian,
"max": np.nanmax,
"min": np.nanmin,
"90percentile": lambda x: np.nanpercentile(x[0], x[1]),
"std": lambda x: np.nanstd(x),
"std": np.nanstd,
"notnans": lambda x: (~np.isnan(x)).sum(),
}
)
Expand Down
2 changes: 1 addition & 1 deletion monai/transforms/intensity/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ def __call__(self, img: Union[np.ndarray, torch.Tensor]) -> Union[torch.Tensor,
raise RuntimeError("Image needs a channel direction.")
if isinstance(self.loc[0], int) and len(img.shape) == 4 and len(self.loc) == 2:
raise RuntimeError("Input images of dimension 4 need location tuple to be length 3 or 4")
if isinstance(self.loc[0], Sequence) and len(img.shape) == 4 and min(map(lambda x: len(x), self.loc)) == 2:
if isinstance(self.loc[0], Sequence) and len(img.shape) == 4 and min(map(len, self.loc)) == 2:
raise RuntimeError("Input images of dimension 4 need location tuple to be length 3 or 4")

n_dims = len(img.shape[1:])
Expand Down
10 changes: 5 additions & 5 deletions monai/transforms/utility/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,11 +1091,11 @@ def __call__(
img_ = img[mask]

supported_ops = {
"mean": lambda x: np.nanmean(x),
"median": lambda x: np.nanmedian(x),
"max": lambda x: np.nanmax(x),
"min": lambda x: np.nanmin(x),
"std": lambda x: np.nanstd(x),
"mean": np.nanmean,
"median": np.nanmedian,
"max": np.nanmax,
"min": np.nanmin,
"std": np.nanstd,
}

def _compute(op: Callable, data: np.ndarray):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_intensity_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
]

TEST_CASE_3 = [
{"ops": [lambda x: np.mean(x), "max", lambda x: np.min(x)], "key_prefix": "orig"},
{"ops": [np.mean, "max", np.min], "key_prefix": "orig"},
np.array([[[0.0, 1.0], [2.0, 3.0]]]),
None,
{"orig_custom_0": 1.5, "orig_max": 3.0, "orig_custom_1": 0.0},
Expand Down
2 changes: 1 addition & 1 deletion tests/test_intensity_statsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
]

TEST_CASE_3 = [
{"keys": "img", "ops": [lambda x: np.mean(x), "max", lambda x: np.min(x)], "key_prefix": "orig"},
{"keys": "img", "ops": [np.mean, "max", np.min], "key_prefix": "orig"},
{"img": np.array([[[0.0, 1.0], [2.0, 3.0]]])},
"img_meta_dict",
{"orig_custom_0": 1.5, "orig_max": 3.0, "orig_custom_1": 0.0},
Expand Down