Skip to content

Fix line-by-line derotation for non-square images - #71

Merged
lauraporta merged 2 commits into
neuroinformatics-unit:mainfrom
Sarthak-Shreshtha01:fix/issue-67
Oct 16, 2026
Merged

lauraporta merged 2 commits into
neuroinformatics-unit:mainfrom
Sarthak-Shreshtha01:fix/issue-67

Conversation

@Sarthak-Shreshtha01

Copy link
Copy Markdown
Contributor

Use the image width for line length and horizontal coordinate bounds in derotate_an_image_array_line_by_line so non-square images can be derotated. The related tests pass, including the new test_derotate_non_square_image, test_derotate_non_square_image_with_center, and test_derotate_non_square_image_with_homography tests.

Fixes #67

Signed-off-by: Sarthak <sarthakshreshtha345@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 19:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@lauraporta

Copy link
Copy Markdown
Member

Hi @Sarthak-Shreshtha01, see my comment in the issue :)

- FullPipeline: keep the width as num_pixels_per_line, use the largest
  circle that fits for mask_diameter and (width // 2, height // 2) as the
  default center of rotation.
- add_circle_mask: crop and pad rows and columns separately, which also
  keeps the frame size when the size minus the diameter is odd.
- fit_ellipse_to_points: bound the center by the width and the height.
- IncrementalPipeline: pass both sizes to the ellipse fit and log the
  offset from the actual image center instead of 128.
- Rotator: keep the frame shape and center the rotation on the frame.

Signed-off-by: Sarthak <sarthakshreshtha345@gmail.com>
@Sarthak-Shreshtha01

Copy link
Copy Markdown
Contributor Author

@lauraporta Done.

@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.08%. Comparing base (1926b6a) to head (0ad3bc1).

Files with missing lines Patch % Lines
derotation/analysis/full_derotation_pipeline.py 71.42% 2 Missing ⚠️
derotation/analysis/fit_ellipse.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #71      +/-   ##
==========================================
+ Coverage   43.69%   45.08%   +1.38%     
==========================================
  Files          14       14              
  Lines        1126     1129       +3     
==========================================
+ Hits          492      509      +17     
+ Misses        634      620      -14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lauraporta lauraporta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @Sarthak-Shreshtha01, it does look good to me. The queued test will not run as the mac os image has been retired, fixing this in a separate PR #72

@lauraporta
lauraporta merged commit 9204b2b into neuroinformatics-unit:main Oct 16, 2026
13 of 14 checks passed
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.

Derotation fails for non-square images

3 participants