-
Notifications
You must be signed in to change notification settings - Fork 1
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
Brightness normalisation #25
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25 +/- ##
==========================================
+ Coverage 95.54% 96.95% +1.41%
==========================================
Files 6 6
Lines 673 756 +83
==========================================
+ Hits 643 733 +90
+ Misses 30 23 -7 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stitching PR Notes: UI Tests
![Screenshot 2025-01-28 at 15 54 04](https://private-user-images.githubusercontent.com/29216006/407388685-a4cf7bb7-3823-428b-86b4-ef2f9e4db5c9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxMjgzMDAsIm5iZiI6MTczOTEyODAwMCwicGF0aCI6Ii8yOTIxNjAwNi80MDczODg2ODUtYTRjZjdiYjctMzgyMy00MjhiLTg2YjQtZWYyZjllNGRiNWM5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDE5MDY0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVlNDNmNzdmOTJkMWU2OWVkYzE5YzAyZjZiZDU2MjQ4ZmYyOTgzZTVmNDliNjY3MThiYjcyMDUyMzEyZjBmMDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.LdpVebrwJJuLSepshblMSJLR6fNkp_LCclNr75szej4)
Problem
Adjusting intensity values during stitching requires a cumbersome process.
Steps Recap
- Add tiles to viewer.
- Add Fiji path.
- Stitch.
- Adjust intensity (80p).
- No feedback when process completes.
- Adjust intensity (90p).
- Feedback: "Intensity already adjusted at this resolution scale."
- User deletes all Napari layers, reloads dataset, and restitches (561).
- Result: Tiles visually unstitched.
- Repeat stitching at (647), same result.
Attempted Solution
- Delete data folder (suspecting pre-calculated files causing issues).
- Re-extract dataset from archive.
- Restart Napari.
- Repeat process:
- Add tiles, add Fiji path, stitch → works.
Outcome
Can finally test different intensity values.
) | ||
|
||
self.update_tiles_from_mosaic(data_for_napari) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no feedback on the end of the adjustment process. Drafting a possible solution:
# there is actually no worker instantiated here, not sure how to do this 🤣 | |
worker.finished.connect(self._on_adjust_intensity_finished) | |
worker.start() | |
def _on_adjust_intensity_finished(self): | |
show_info("Intensity adjustment complete") | |
# not sure if there should be anything else here |
The percentile based on which the normalisation is done. | ||
""" | ||
if self.intensity_adjusted[resolution_level]: | ||
print("Intensity already adjusted at this resolution scale.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might want to re-calculate it!
self.stitch_button.setEnabled(False) | ||
self.adjust_intensity_button.setEnabled(False) | ||
worker.finished.connect(self._on_stitch_finished) | ||
worker.start() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sincerely, I don't understand why it is not re-stitching, there are no filters controlling for saved values 🤔
Before submitting a pull request (PR), please read the contributing guide.
Please fill out as much of this template as you can, but if you have any problems or questions, just leave a comment and we will help out :)
Description
What is this PR
Why is this PR needed?
There can be large intensity differences between each tile. This PR introduces a method to normalise the intensities between each tile.
What does this PR do?
This is done by assuming that the overlapping area should have equal intensity between each tile. This is used to calculate a scaling factor between two tiles. This scaling factor is applied and the comparison is done for the subsequent tiles. For example say an image contains 4 tiles and each tile overlaps with all other tiles:
The first round of comparisons will calculate scaling factors for tile 1 + 2, 1 + 3, 1 + 4. The scaling factors will be applied lazily to the tiles. The second round of comparisons will calculate scaling factors based on tile 2 + 3, 2 + 4.
The final result will be a
num_tiles
bynum_tiles
matrix that contains a scaling factor for each tile comparison.The final factor is calculated as the product of all scaling factors calculated for that tile. This final scaling factor is then applied to the full resolution image prior to fusing/saving to disk.
How has this PR been tested?
Tests added for new functionality.
Is this a breaking change?
No
Checklist: