Skip to content

Fix ImageContainer2D for Fury v2: wrap image in UI and handle RGB images#1138

Open
VanshAgarwal24036 wants to merge 4 commits intofury-gl:v2from
VanshAgarwal24036:port-imagecontainer2d-v2
Open

Fix ImageContainer2D for Fury v2: wrap image in UI and handle RGB images#1138
VanshAgarwal24036 wants to merge 4 commits intofury-gl:v2from
VanshAgarwal24036:port-imagecontainer2d-v2

Conversation

@VanshAgarwal24036
Copy link
Copy Markdown

This PR fixes and ports ImageContainer2D to work properly with the current Fury v2 architecture.

Fixes #1108

This PR:

  • Wraps the image actor inside a _ImageUI class that properly subclasses UI.
  • Implements the required _update_actors_position method.
  • Converts RGB images to grayscale to ensure compatibility with the underlying image actor.
  • Ensures correct actor positioning using the new UI system.
  • Adds a dedicated test for ImageContainer2D.

@VanshAgarwal24036
Copy link
Copy Markdown
Author

Hi maintainers

All tests and ruff checks pass locally.
Kindly approve the workflows so CI can run.

Thank you!

@VanshAgarwal24036
Copy link
Copy Markdown
Author

@maharshi-gor @ganimtron-10 plz review

@m-agour
Copy link
Copy Markdown
Contributor

m-agour commented Feb 28, 2026

Hi @VanshAgarwal24036 , thanks for this PR, but, we are currently develpoing the v2 branch not the master branch, and given there is no conflicts with master I don't think is is based on v2, please always start your branch based on v2 branch not master.

@VanshAgarwal24036
Copy link
Copy Markdown
Author

Thankyou @m-agour I will review again and do changes accordingly to v2 branch

@VanshAgarwal24036 VanshAgarwal24036 force-pushed the port-imagecontainer2d-v2 branch from f7d396d to d95620c Compare March 1, 2026 16:49
@VanshAgarwal24036 VanshAgarwal24036 changed the base branch from master to v2 March 1, 2026 16:51
@VanshAgarwal24036
Copy link
Copy Markdown
Author

@m-agour please check now

@m-agour m-agour requested a review from ganimtron-10 March 2, 2026 02:21
Copy link
Copy Markdown
Contributor

@maharshi-gor maharshi-gor left a comment

Choose a reason for hiding this comment

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

Thank you @VanshAgarwal24036 for the work.

The PR requires better doc-strings and few feature support.

Copy link
Copy Markdown
Contributor

@ganimtron-10 ganimtron-10 left a comment

Choose a reason for hiding this comment

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

Hi @VanshAgarwal24036,

Thanks for the PR. I noticed you closed a previous PR for the same thing, just fyi you don't need to create a new PR for new changes. If you commit to the same branch, it will automatically reflect in the existing PR.

I haven't done a deep dive yet, but here are my initial thoughts:

  1. Please include a demo using ImageContainer2D to make it easier to test the functionality.
  2. Don't create a separate file for tests, they should follow the existing project structure.
  3. Try to add more tests to validate all aspects of the UI, not just the happy path.

Please update the PR accordingly. Thanks!

@VanshAgarwal24036
Copy link
Copy Markdown
Author

Thanks for the helpful feedback!

I’ve updated the PR according to the suggestions:

  • Fixed the actor import as recommended.
  • Added support for the size parameter.
  • Added a demo example for ImageContainer2D.
  • Moved the tests to follow the existing project test structure and added more cases.

Also, since this is my first contribution to FURY, I initially got confused when the PR showed a very large number of commits. After looking into it, I realized that I had mistakenly based my branch on the wrong branch instead of v2. I closed the earlier PR and recreated the changes correctly based on the v2 branch.

Please let me know if any further improvements are needed. Thanks again for the review!

@VanshAgarwal24036
Copy link
Copy Markdown
Author

@ganimtron-10 @maharshi-gor please tell me how to start workflow waiting

@VanshAgarwal24036 VanshAgarwal24036 force-pushed the port-imagecontainer2d-v2 branch from b69a9af to 8691dc2 Compare March 7, 2026 10:27
@VanshAgarwal24036
Copy link
Copy Markdown
Author

VanshAgarwal24036 commented Mar 7, 2026

@maharshi-gor As my PR is failing with 20 checks so on your suggestion to @ganimtron-10 on his PR to rebase the branch and the checks pass as same problem in my PR also so now i have rebased so Please review it.

@VanshAgarwal24036
Copy link
Copy Markdown
Author

Hi @maharshi-gor and @ganimtron-10

I have rebased the branch on the latest v2 as suggested and updated the PR.
All CI checks should now run against the updated base.

Could you please take another look when you get time?
Thanks for your guidance!

Copy link
Copy Markdown
Contributor

@ganimtron-10 ganimtron-10 left a comment

Choose a reason for hiding this comment

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

Hi @VanshAgarwal24036 ,
Thanks for the PR!

PTAL at the below comments.

Comment on lines +192 to +197
def test_image_container_rgb():
"""Test that RGB images are converted to grayscale."""
img = np.zeros((10, 10, 3), dtype=np.uint8)
container = ui.ImageContainer2D(img)

assert container is not None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

where are we testing rgb converted to grayscale?

@VanshAgarwal24036
Copy link
Copy Markdown
Author

Updated the implementation to align with the current backend constraints.
RGB inputs are now converted to grayscale internally since the image actor supports only 2D images.
Simplified the pipeline and updated tests + example accordingly.

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.

Port ImageContainer2D Component to v2

4 participants