Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: NumpyReader for .npz files with variable names. #7147

Closed
mandelkow opened this issue Oct 20, 2023 · 0 comments · Fixed by #7148
Closed

Bug: NumpyReader for .npz files with variable names. #7147

mandelkow opened this issue Oct 20, 2023 · 0 comments · Fixed by #7148

Comments

@mandelkow
Copy link

npz_keys = [f"arr_{i}" for i in range(len(img))] if self.npz_keys is None else self.npz_keys

If npz_keys is not given, NumpyReader assumes variables in .npz files to be named arr_0, arr_1,...
This may or may not be true. It would be better to use the variable names from the file like so:

                npz_keys = self.npz_keys if self.npz_keys else list( img.keys() ) # or img.files
KumoLiu added a commit to KumoLiu/MONAI that referenced this issue Oct 20, 2023
Signed-off-by: KumoLiu <yunl@nvidia.com>
wyli pushed a commit that referenced this issue Oct 20, 2023
Fixes #7147.


### 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: KumoLiu <yunl@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant