Skip to content

Add composite image config and display options#222

Open
d33bs wants to merge 5 commits into
cytomining:mainfrom
d33bs:multi-channel
Open

Add composite image config and display options#222
d33bs wants to merge 5 commits into
cytomining:mainfrom
d33bs:multi-channel

Conversation

@d33bs

@d33bs d33bs commented Jul 17, 2026

Copy link
Copy Markdown
Member

Description

What kind of change(s) are included?

  • Documentation (changes docs or other related content)
  • Bug fix (fixes an issue).
  • Enhancement (adds functionality).
  • Breaking change (these changes would cause existing functionality to not work as expected).

Checklist

Please ensure that all boxes are checked before indicating that this pull request is ready for review.

  • I have read and followed the CONTRIBUTING.md guidelines.
  • I have searched for existing content to ensure this is not a duplicate.
  • I have performed a self-review of these additions (including spelling, grammar, and related).
  • These changes pass all pre-commit checks.
  • I have added comments to my code to help provide understanding
  • I have added a test which covers the code changes found within this PR
  • I have deleted all non-relevant text in this pull request template.

Summary by CodeRabbit

  • New Features

    • Added support for rendering multi-channel single-cell composites from multiple image channels.
    • Supports custom composite channel colors, composite naming, and an option to merge all available channels.
    • Composite rendering includes segmentation outlines and center markers/points.
  • Improvements

    • Enhanced notebook thumbnail sizing with a minimum width floor and more consistent crop sizing.
    • Improved table header styling to keep header text on one line.
  • Documentation

    • Updated README and added/expanded usage examples demonstrating composite channels and display options (including overlays).
  • Chores

    • Updated pre-commit hook revision pins to newer versions.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4466af5b-cac5-4e4f-a374-1afb398d39d3

📥 Commits

Reviewing files that changed from the base of the PR and between 1a8f2c8 and 491e2e7.

📒 Files selected for processing (2)
  • src/cytodataframe/frame.py
  • tests/test_frame.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/cytodataframe/frame.py
  • tests/test_frame.py

📝 Walkthrough

Walkthrough

CytoDataFrame now renders configurable multi-channel composite crops with optional segmentation overlays, preserves crop geometry across channels, and enforces notebook image sizing. Documentation, tests, and pre-commit hook revisions were also updated.

Changes

Composite rendering

Layer / File(s) Summary
Composite options and image composition
src/cytodataframe/frame.py
Adds composite configuration, channel/color resolution, resizing, tinted blending, decoration overlays, width normalization, and composite HTML generation.
Notebook composite integration
src/cytodataframe/frame.py
Generates composite columns from shared row crop geometry and adds image minimum-width and nowrap header styling.
Composite examples and validation
tests/test_frame.py, README.md, docs/src/examples/cytodataframe_at_a_glance.py
Tests composite rendering, channel forms, overlays, layout CSS, and disabled-option behavior; documentation adds composite examples and updates metadata.

Pre-commit hook maintenance

Layer / File(s) Summary
Pre-commit revision updates
.pre-commit-config.yaml
Updates pinned revisions for pyproject-fmt, codespell, and Ruff hooks.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CytoDataFrame
  participant CompositeRenderer
  participant NotebookHTML
  CytoDataFrame->>CompositeRenderer: Resolve channels and crop geometry
  CompositeRenderer->>CompositeRenderer: Tint, resize, blend, and overlay images
  CompositeRenderer->>NotebookHTML: Add composite HTML image column
  NotebookHTML->>NotebookHTML: Render thumbnails with minimum width
Loading

Possibly related PRs

Suggested reviewers: jenna-tomkinson

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding composite image configuration and display options.
Docstring Coverage ✅ Passed Docstring coverage is 85.29% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@d33bs

d33bs commented Jul 19, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/cytodataframe/frame.py (1)

3504-3510: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Optional: log the swallowed exception before returning "".

A failed composite render is silently converted to an empty cell with no diagnostic trail, and Ruff flags the blind except Exception (BLE001). A debug log keeps the current behavior while making silent-empty composites diagnosable.

♻️ Suggested change
         try:
             return self._image_array_to_html(composite_array)
-        except Exception:
+        except Exception as exc:
+            logger.debug("Failed to render composite image as HTML: %s", exc)
             return ""
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cytodataframe/frame.py` around lines 3504 - 3510, Update the exception
handler around _image_array_to_html to log the caught exception at debug level
before returning an empty string. Preserve the existing fallback behavior while
replacing the blind exception handling with an explicitly bound exception so
Ruff BLE001 is satisfied.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/cytodataframe/frame.py`:
- Around line 3095-3101: Normalize numeric width values to CSS pixel strings
before applying the image minimum-width logic in the rendering method containing
_resolve_image_min_width. Ensure configured integer widths such as 300 become
“300px” for both the emitted width style and _resolve_image_min_width, while
preserving existing handling for non-numeric width values.

---

Nitpick comments:
In `@src/cytodataframe/frame.py`:
- Around line 3504-3510: Update the exception handler around
_image_array_to_html to log the caught exception at debug level before returning
an empty string. Preserve the existing fallback behavior while replacing the
blind exception handling with an explicitly bound exception so Ruff BLE001 is
satisfied.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: af938fa7-6aea-417b-9f8c-a2d409fcd40f

📥 Commits

Reviewing files that changed from the base of the PR and between 16b7923 and 1a8f2c8.

📒 Files selected for processing (6)
  • .pre-commit-config.yaml
  • README.md
  • docs/src/examples/cytodataframe_at_a_glance.ipynb
  • docs/src/examples/cytodataframe_at_a_glance.py
  • src/cytodataframe/frame.py
  • tests/test_frame.py

Comment thread src/cytodataframe/frame.py
@d33bs
d33bs marked this pull request as ready for review July 20, 2026 17:41
@d33bs
d33bs requested a review from jenna-tomkinson as a code owner July 20, 2026 17:41
@jenna-tomkinson

Copy link
Copy Markdown
Member

@d33bs Lucky number 222!

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.

2 participants