Skip to content

Docs: add spatial shape constraints to SegResNetDS docstring#8797

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

Docs: add spatial shape constraints to SegResNetDS docstring#8797
Talhax55z wants to merge 5 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: 6d8e84c5-0b1b-4019-9fbc-3194081fe876

📥 Commits

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

📒 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 states that when resolution is 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 cases with resolution provided, it directs readers to shape_factor() and is_valid_shape() for exact per-dimension factors and validation, and includes 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 | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding spatial shape constraint documentation to the SegResNetDS docstring.
Description check ✅ Passed The PR description follows the template, includes the linked issue reference, provides a clear description of changes, and appropriately marks the change type and documentation updates.
Linked Issues check ✅ Passed The PR addresses issue #6771 by documenting spatial shape constraints for SegResNetDS with divisibility requirements, worked examples, and pointers to existing validation methods.
Out of Scope Changes check ✅ Passed All changes are limited to adding docstring documentation for SegResNetDS, staying within scope of issue #6771's request for spatial constraint guidance.

✏️ 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