Skip to content

Docs: add spatial shape constraints to SegResNetDS docstring#8797

Open
Talhax55z wants to merge 6 commits intoProject-MONAI:devfrom
Talhax55z:docs-segresnet-ds-shape-constraints
Open

Docs: add spatial shape constraints to SegResNetDS docstring#8797
Talhax55z wants to merge 6 commits intoProject-MONAI:devfrom
Talhax55z:docs-segresnet-ds-shape-constraints

Conversation

@Talhax55z
Copy link
Copy Markdown

Fixes #6771

Description

Adds spatial shape constraint documentation to the SegResNetDS class docstring.
Documents that input spatial dimensions must be divisible by 2 ** (len(blocks_down) - 1),
with a worked example and pointers to the existing shape_factor() and is_valid_shape() methods.

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
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 064f178a-17c4-4c3d-9623-e532d18f5447

📥 Commits

Reviewing files that changed from the base of the PR and between 497ca39 and ee7c987.

📒 Files selected for processing (1)
  • monai/networks/nets/segresnet_ds.py
✅ Files skipped from review due to trivial changes (1)
  • monai/networks/nets/segresnet_ds.py

📝 Walkthrough

Walkthrough

Extended the SegResNetDS class docstring to add a "Spatial shape constraints" note. It specifies that in isotropic mode (resolution=None) each spatial dimension must be divisible by 2 ** (len(blocks_down) - 1) (default blocks_down=(1, 2, 2, 4) → divisible by 8). For anisotropic mode (resolution provided) it notes divisibility may differ per dimension and points to shape_factor() and is_valid_shape() for exact factors and validation, including an example of valid vs invalid shapes. No executable logic, control flow, or public API signatures were changed.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive PR partially addresses #6771 by documenting SegResNetDS constraints, but doesn't cover the full scope of requested network documentation (SwinUNETR, DiNTS, etc.). Clarify whether this PR addresses only SegResNetDS as a starting point, or if #6771 requires documentation updates across all mentioned networks.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title concisely describes the main change: adding spatial shape constraints documentation to SegResNetDS docstring.
Description check ✅ Passed Description includes issue reference, clear summary of changes, and appropriate types of changes selections matching the docstring-only nature.
Out of Scope Changes check ✅ Passed Changes are limited to SegResNetDS docstring additions, staying within scope of documented objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@monai/networks/nets/segresnet_ds.py`:
- Around line 257-263: The docstring's fixed divisibility statement must be
conditioned on isotropic mode: update the "Spatial shape constraints" text in
segresnet_ds.py to state that the simple rule "divisible by 2 **
(len(blocks_down) - 1)" only applies when not using anisotropic/resolution-based
scaling (i.e., isotropic mode); when resolution is provided, note that
is_valid_shape() uses shape_factor() from anisotropic_scales and required
divisors are per-dimension (may differ across axes). Mention the resolution
parameter and anisotropic_scales, and point readers to use shape_factor() and
is_valid_shape() for the correct per-dimension divisors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: aa4056de-e4e0-483e-bdcb-95f562b8f8f6

📥 Commits

Reviewing files that changed from the base of the PR and between a8176f1 and 28ab77c.

📒 Files selected for processing (1)
  • monai/networks/nets/segresnet_ds.py

I, Talhax55z <muhammadtalha223@gmail.com>, hereby add my Signed-off-by to this commit: 28ab77c
I, Talhax55z <muhammadtalha223@gmail.com>, hereby add my Signed-off-by to this commit: 584c915

Signed-off-by: Talhax55z <muhammadtalha223@gmail.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 this pull request may close these issues.

Documentation of spatial shape constraints for the networks

1 participant