Skip to content

Raise exception for uninstalled LoadImage reader and print writer pkg…#8913

Closed
VedhSontha wants to merge 1 commit into
Project-MONAI:devfrom
VedhSontha:fix-reader-exceptions-and-writer-suggestions
Closed

Raise exception for uninstalled LoadImage reader and print writer pkg…#8913
VedhSontha wants to merge 1 commit into
Project-MONAI:devfrom
VedhSontha:fix-reader-exceptions-and-writer-suggestions

Conversation

@VedhSontha

Copy link
Copy Markdown

… suggestion

Fixes # .

Description

A few sentences describing the changes proposed in this pull request.

Types of changes

  • 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.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1dda030b-d008-44a1-a2f7-91b1af260899

📥 Commits

Reviewing files that changed from the base of the PR and between eccefc5 and 8a13215.

📒 Files selected for processing (4)
  • monai/data/image_writer.py
  • monai/transforms/io/array.py
  • tests/data/test_image_rw.py
  • tests/data/test_init_reader.py

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting


📝 Walkthrough

Walkthrough

This PR enhances error handling for optional dependencies in the image I/O stack. resolve_writer now collects error messages from unavailable backends and formats a single OptionalImportError listing required packages to install. LoadImage improves reader registration to raise OptionalImportError with proper exception chaining instead of silently falling back. Tests are updated to validate conditional behavior based on whether optional dependencies (nibabel, itk, reader packages) are installed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@VedhSontha VedhSontha closed this Jun 11, 2026
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 this pull request may close these issues.

1 participant