-
Notifications
You must be signed in to change notification settings - Fork 1.5k
RandKSpaceSpikeNoise got an unexpected keyword argument 'dim' #3867
Description
Describe the bug
RandKSpaceSpikeNoise does not work with NumPy array if intensity_range is not set manually.
In case a NumPy array is provided, the linked part will call np.mean(.., dim=...) but NumPy does not support dim arguments (should be axis). The implementation works fine for torch.Tensors.
MONAI/monai/transforms/intensity/array.py
Lines 1816 to 1818 in d6327a7
| mod = torch if isinstance(k, torch.Tensor) else np | |
| log_abs = mod.log(mod.absolute(k) + 1e-10) | |
| shifted_means = mod.mean(log_abs, dim=tuple(range(-n_dims, 0))) * 2.5 |
To Reproduce
Call transform on NumPy array with default values (specifically intensity_range =None).
Expected behavior
No crash.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
Ensuring you use the relevant python executable, please paste the output of:
python -c 'import monai; monai.config.print_debug_info()'
Additional context
Add any other context about the problem here.