Skip to content

Preprocessing wingdisc #66

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

Merged
merged 22 commits into from
May 29, 2025

Conversation

Skxsmy
Copy link
Contributor

@Skxsmy Skxsmy commented Feb 26, 2025

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

Add functionality of preprocessing wing disc images for future template building.
What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
Enable software to preprocess wingdisc images.
What does this PR do?
Add preprocessing pipeline for wing disc images.

References

Please reference any existing issues/PRs that relate to this PR.

How has this PR been tested?

Locally and with pre-commits

Is this a breaking change?

No

Does this PR require an update to the documentation?

If any features have changed, or have been added. Please explain how the documentation has been updated (and link to the associated PR). See here for details.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality (unit & integration)
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

Copy link
Member

@alessandrofelder alessandrofelder left a comment

Choose a reason for hiding this comment

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

some tiny comments @Skxsmy - looking good. Almost there, I think :)


# Apply median filter to the downsampled image
mf_image = median_filter(down_sampled_image, size=3)
mf_image = np.pad(mf_image, ((15, 15), (0, 0), (0, 0)), mode="reflect")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
mf_image = np.pad(mf_image, ((15, 15), (0, 0), (0, 0)), mode="reflect")
mf_image = np.pad(mf_image, ((15, 15), (0, 0), (0, 0)))

I think?

Comment on lines 183 to 185
normalised_image = (mf_image - np.min(mf_image)) / (
np.max(mf_image) - np.min(mf_image)
)
Copy link
Member

Choose a reason for hiding this comment

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

Think we are "squishing" the range of pixels too much here for our new images?

Suggested change
normalised_image = (mf_image - np.min(mf_image)) / (
np.max(mf_image) - np.min(mf_image)
)
normalised_image = (mf_image - np.min(mf_image)) / ((
np.max(mf_image) - np.min(mf_image)*65535
)

maybe? (to limit to unsigned int 16)

Or we can try using the bias correction algorithm we used for the bird template instead of this.

Copy link
Member

Choose a reason for hiding this comment

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

Or actually, after discussing today, replace with slice-wise normalisation?

@Skxsmy Skxsmy force-pushed the preprocessing_wingdisc branch from daa6613 to 52ee4d2 Compare May 22, 2025 15:56
Copy link

codecov bot commented May 22, 2025

Codecov Report

Attention: Patch coverage is 0% with 24 lines in your changes missing coverage. Please review.

Project coverage is 8.42%. Comparing base (1b36684) to head (297316e).
Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
...inglobe_template_builder/preproc/wingdisc_utils.py 0.00% 24 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main     #66      +/-   ##
========================================
- Coverage   8.63%   8.42%   -0.21%     
========================================
  Files         16      17       +1     
  Lines        730     748      +18     
========================================
  Hits          63      63              
- Misses       667     685      +18     

☔ 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.

@alessandrofelder alessandrofelder self-requested a review May 28, 2025 12:26
@alessandrofelder alessandrofelder marked this pull request as ready for review May 28, 2025 12:26
@alessandrofelder
Copy link
Member

This looks good now @Skxsmy , as discussed.
Could you update the PR description, by filling in the headings, please?

Copy link
Member

@alessandrofelder alessandrofelder left a comment

Choose a reason for hiding this comment

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

Thanks @Skxsmy

Comment on lines 183 to 185
normalised_image = (mf_image - np.min(mf_image)) / (
np.max(mf_image) - np.min(mf_image)
)
Copy link
Member

Choose a reason for hiding this comment

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

Or actually, after discussing today, replace with slice-wise normalisation?

@alessandrofelder alessandrofelder merged commit d900a5c into brainglobe:main May 29, 2025
13 of 15 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.

2 participants