Skip to content

Conversation

@Nowhere4Nothing
Copy link
Collaborator

@Nowhere4Nothing Nowhere4Nothing commented Oct 12, 2025

Tests added
test_manual_fusion_tab

These tests verify that:

  • The main window and manual fusion tab can be set up with test DICOM data.
  • All fusion views (axial, sagittal, coronal) are present, visible, and enabled.
  • The fusion options tab and its controls (sliders, combo boxes, buttons) exist and work as expected.
  • Translation and rotation sliders respond to value changes and can be reset.
  • Color pair and opacity controls update the overlay as expected.
  • Zoom, metadata, and view update functions work for the fusion views.
  • The fusion options tab is present in the left panel and the four-views layout is active.
  • Saving and loading fusion state opens the correct file dialogs (mocked).
  • The transform matrix dialog can be opened and is visible.

Test_manual_fusion_tab_builder
This mock class records calls to setup methods and simulates the attributes and methods
expected by the ImageFusionTabBuilder. It is used to verify that the builder interacts
with the main window as expected during tab construction.

test_view_manula_fusion
Tests for OnkoDICOM's image fusion infrastructure.

These tests verify that:

  • DICOM image slices (CT, MR, PT) can be found and loaded from test data directories.
  • The MovingImageLoader and ManualFusionLoader can load moving image series for fusion.
  • The VTKEngine can load both fixed and moving image series for manual fusion.
  • The fusion infrastructure works without requiring RTSS/ROI data or GUI components.

No GUI is launched; these are logic and engine-level tests only.

Summary by Sourcery

Add comprehensive tests for OnkoDICOM's image fusion functionality, covering GUI manual fusion tab, backend fusion logic, and tab builder integration.

Tests:

  • Add GUI tests for the manual fusion tab to verify view visibility, control interactions, layout, and state save/load and matrix dialog behaviors
  • Add backend tests for MovingImageLoader, ManualFusionLoader, and VTKEngine to validate DICOM image loading and fusion workflows without GUI
  • Add tests for ImageFusionTabBuilder to ensure correct setup method calls on MainWindow during fusion tab construction

added a test for create fusion tab builder
Adds a test that verifies that the manual fusion tab in OnkoDICOM:

Loads correctly with the expected widgets and controls,
Allows interaction with the fusion controls (translation, rotation, color, opacity),
And that the main fusion views (axial, sagittal, coronal, single) are present and functional.
split the test up into multiple so that if one fails its easier to narrow down
Added more tests to test the widgets / buttons and everything loads and works with manual fusion load.
Added a test to see if the VTK engine is there

Added a test that tests to see if the moving image and fixed image loads from the vtk engine

Note: still need to get rid of the debugs
Made tests views image fusion less complicated and got rid of the GUI trhings
it now just tests if the vtk engine gets the fixed and overlay and can load them

added more info about the tests to both of them
Moved things around to make neater and deleted a line from a docstring
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 12, 2025

Reviewer's Guide

This PR introduces a comprehensive test suite for the image fusion feature, covering GUI-level behaviors in the manual fusion tab, engine- and loader-level logic tests for DICOM loading and fusion infrastructure, and builder tests to verify the construction of the fusion tab.

File-Level Changes

Change Details Files
Added GUI-level tests for manual fusion tab interactions
  • Fixture to initialize MainWindow with test DICOM data
  • Assertions for fusion view existence, visibility, and enabling
  • Translation/rotation sliders and reset button behavior tests
  • Color pair combo and opacity slider functionality tests
  • Mocked file dialogs for save/load state and transform matrix dialog visibility
test/ImageFusion/test_manual_fusion_tab.py
Added engine-level tests for image fusion infrastructure
  • Helpers to discover and sort image slice DICOM files
  • Test for MovingImageLoader in manual mode
  • VTKEngine tests for loading fixed and moving series
  • ManualFusionLoader tests with signal capture and VTK data assertions
test/ImageFusion/test_views_image_fusion.py
Added builder tests for ImageFusionTabBuilder
  • DummyMainWindow mock to record fusion setup calls
  • Parameterized tests for manual versus auto fusion modes
  • Assertions that key setup and finalize methods are invoked
test/ImageFusion/test_image_fusion_tab_builder.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Remove print statements and delete unused code
Added a skip for CI / workflow because the dialog box would require interaction and it could be creating a time out in the workflow

added a new test for CI that just tests to see if the save and load buttons are there and doesnt interact with it
Update to fix method that looks for 2 directories in the test folder. As image fusion needs two but there is not in there we needed to just get it to resuse the same directory for moving and fixed images
Updated tests to add a patient container.clear() so these tests dont contaminate other test
Testing by commenting out code to see which tests messes with the rest of the tests
Tests were failing because this test modified and changed files if there was only one directory in tests. But as manual fusion requires 2, i previously tried to make it use the same directory twice. Added a skip instead if there is only one directory
This test kept failing so im taking it out for now
Copy link
Collaborator

@AJB-BigA AJB-BigA left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Collaborator

@Kahreiru Kahreiru left a comment

Choose a reason for hiding this comment

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

I see no issues with these.

Out of curiosity, how does the testing of the GUI work with the runner being headless I assume you don't actually open the window.

@didymo didymo merged commit 755dd22 into didymo:dev Oct 17, 2025
8 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.

4 participants