Skip to content

✨ Add on-the-fly Registered Slide Visualization #875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 61 commits into
base: develop
Choose a base branch
from

Conversation

measty
Copy link
Collaborator

@measty measty commented Oct 22, 2024

This PR is a rough draft of code to allow a registration transform to be loaded as an 'overlay', which will allow the slide to be viewed as if that registration transform had been applied to it. This will work with either an affine transformation saved as a .npy, or a non-rigid one represented by a SimpleITK displacement field saved as a .mha (such as what would be output by DeeperHistoReg, for example).

It introduces a new WSIReader subclass called TransformedWSIReader, which when initialized with a slide and transformation will apply the transformation on the fly when regions are requested.

It also adds '.npy' and '.mha' to the overlay types the visualization tool picks up; upon loading one of these types, the current slide will be opened as a TransformedWSIReader with that transform, allowing it to be visualized on the fly as a registered slide.

still to do:

  • Implement read_bounds (currently only done read_rect)
  • Correctly handle coord_space argument
  • Check affine capabilities of read_bounds
  • Add unit tests

@shaneahmed shaneahmed changed the title ENH: Add on-the-fly registered slide visualization ✨ Add on-the-fly Registered Slide Visualization Oct 23, 2024
@shaneahmed shaneahmed added the enhancement New feature or request label Oct 23, 2024
@shaneahmed shaneahmed added this to the Release v1.6.0 milestone Oct 23, 2024
@adamshephard adamshephard self-assigned this Feb 27, 2025
Copy link

codecov bot commented Feb 27, 2025

Codecov Report

Attention: Patch coverage is 98.93048% with 2 lines in your changes missing coverage. Please review.

Project coverage is 99.63%. Comparing base (b6eefcf) to head (45f3477).

Files with missing lines Patch % Lines
tiatoolbox/visualization/tileserver.py 94.73% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #875      +/-   ##
===========================================
- Coverage    99.70%   99.63%   -0.08%     
===========================================
  Files           71       71              
  Lines         8851     9024     +173     
  Branches      1154     1171      +17     
===========================================
+ Hits          8825     8991     +166     
- Misses          23       28       +5     
- Partials         3        5       +2     

☔ View full report in Codecov by Sentry.
📢 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.

@adamshephard adamshephard marked this pull request as ready for review April 11, 2025 18:34
im_region_4 = wsi4.read_rect(location, size, resolution=0, units="level")

# We don't expect arrays to be the same, but dimensions should be
assert im_region.shape == im_region_4.shape
Copy link
Member

Choose a reason for hiding this comment

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

Can we also test the values or just shape is enough?

Copy link
Contributor

Choose a reason for hiding this comment

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

Here, we haven't performed the test with the correct MHA files as didn't want to add lots of new slides to the server. So think shape alone is reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants