Skip to content
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

Helper function for scaling images #415

Merged
merged 21 commits into from
Aug 24, 2023
Merged

Helper function for scaling images #415

merged 21 commits into from
Aug 24, 2023

Conversation

camisowers
Copy link
Contributor

@camisowers camisowers commented Aug 15, 2023

If you haven't already, please read through our contributing guidelines before opening your PR

What is the purpose of this PR?

Closes #403. Adds a helper function that changes resolution of image data by scaling the size of the FOV.
Implement this function in notebook 3f to change resolution of FOVs to match the rest in the run

How did you implement your changes

Use skimage.transform.rescale() to scale the data in the helper function rescale_image().

  1. Write a wrapper function to take in the FOV resolutions, then scale and re-save any images that need to be altered.

Remaining issues
Implement this helper function in:

  • stitch_images()
  • rosetta stitching

Here is an exampled of downscaled rosetta stitched images. Both the 0.5 and 0.25 images can now be opened in fiji, and the default is currently set to 0.25.

Original stitched image: (69632 x 10240)
Screenshot 2023-08-24 at 10 34 41 AM

Downscaled by 0.5: (34816 x 5120)
Screenshot 2023-08-24 at 10 35 24 AM

Downscaled by 0.25: (17408 x 2560)
Screenshot 2023-08-24 at 10 36 15 AM

@camisowers camisowers added the enhancement New feature or request label Aug 15, 2023
@camisowers camisowers self-assigned this Aug 15, 2023
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@camisowers camisowers marked this pull request as ready for review August 17, 2023 00:38
Copy link
Contributor

@alex-l-kong alex-l-kong left a comment

Choose a reason for hiding this comment

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

Only aesthetic comments

src/toffy/json_utils.py Outdated Show resolved Hide resolved
tests/image_stitching_test.py Outdated Show resolved Hide resolved
Copy link
Contributor

@srivarra srivarra left a comment

Choose a reason for hiding this comment

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

Looks pretty good, just a few suggestions on taking advantage of numpy's duck array for xarrays along with a small testing question.

src/toffy/image_stitching.py Outdated Show resolved Hide resolved
src/toffy/image_stitching.py Outdated Show resolved Hide resolved
src/toffy/image_stitching.py Outdated Show resolved Hide resolved
src/toffy/image_stitching.py Outdated Show resolved Hide resolved
tests/image_stitching_test.py Outdated Show resolved Hide resolved
src/toffy/json_utils.py Show resolved Hide resolved
Copy link
Contributor

@srivarra srivarra left a comment

Choose a reason for hiding this comment

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

Looks good! Just a single failing test fix.

@alex-l-kong alex-l-kong self-requested a review August 23, 2023 20:35
Copy link
Contributor

@alex-l-kong alex-l-kong left a comment

Choose a reason for hiding this comment

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

Looks good, just one small comment

@ngreenwald
Copy link
Member

Will you send me the TIFs at different downsampling ratios?

Copy link
Member

@ngreenwald ngreenwald left a comment

Choose a reason for hiding this comment

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

I would add the downscaling coefficient as an argument that gets defaulted to 0.25 for the places where it's called in the notebooks, rather than a hidden variable.

@ngreenwald ngreenwald merged commit b30ee65 into main Aug 24, 2023
4 checks passed
@ngreenwald ngreenwald deleted the resolution_scaling branch August 24, 2023 22:59
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.

Add utility function for easy downscaling and upscaling of images
4 participants