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

Add TMA FOV validation functions for user sanity checking #30

Merged
merged 44 commits into from
Feb 1, 2022

Conversation

alex-l-kong
Copy link
Contributor

@alex-l-kong alex-l-kong commented Jan 26, 2022

What is the purpose of this PR?

Closes #16 (and closes #18). Users may need some guidance as to which FOVs are the most likeliest that need remapping. This includes:

  1. User-proposed FOVs that are far away from their auto-generated FOV
  2. User-proposed FOVs mapping to the same auto-generated FOV
  3. User-proposed FOV names that don't match their corresponding auto-generated FOV names.

We want a way to display these to the user on the initial visualization, as well as update them on the fly when the user remaps FOVs.

How did you implement your changes

We allow the user to specify which combination of the 3 issues stated above they wish to validate in autolabel_tma_cores.ipynb. Each of these issues is handled in a separate validation function that builds a list of mappings that do not pass the specified tests. These non-passes will be displayed in a text box right above the slide image display.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@alex-l-kong alex-l-kong changed the base branch from main to tiling_add January 26, 2022 18:05
Base automatically changed from tiling_add to main January 27, 2022 17:46
@alex-l-kong
Copy link
Contributor Author

NOTE: now that we're running a lot of tests for certain functions randomizing order, need to start moving away from simple != testing for randomization (the branch is failing again because of this, it'll happen more often than usual if we're running a double-digit amount of tests on these functions). I think the best way to handle this is to start using a random seed for these functions, although I'm open to other ideas.

@alex-l-kong
Copy link
Contributor Author

More along the lines of setting consistent random seeds, looks like the pytest-randomly library may allow us to do this fairly seamlessly: https://github.com/pytest-dev/pytest-randomly.

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.

Looks good, minor changes only

templates/autolabel_tma_cores.ipynb Outdated Show resolved Hide resolved
toffy/tiling_utils.py Outdated Show resolved Hide resolved
toffy/tiling_utils.py Outdated Show resolved Hide resolved
@alex-l-kong
Copy link
Contributor Author

alex-l-kong commented Jan 31, 2022

After some thought, I've decided to do some major restructuring to the pipeline:

  • assign_closest_fovs will now be a hidden call in tma_interactive_remap...this notebook cell was looking more and more unnecessary by the day and it'll help address the issue of the function being too involved. We also don't need an explicit manual_to_auto_map in the notebook if we're just going to read that in as mapping after the interactive remapping process anyway.
  • We'll have assign_closest_fovs return the original manual_to_auto_map and a distance matrix (in microns) in numpy.ndarray or pandas.DataFrame format between each FOV. Having a lookup table for the distances between FOVs in microns will greatly reduce the number of conversion calls we'll need to make when remap_manual_to_auto_display is called. It also removes the need for a convert_pixels_to_microns function when recalculating distances on remap for validation purposes, preventing inconsistent results (due to floating point precision/rounding errors converting from microns to pixels and back won't yield the same results).

Let me know your thoughts @ngreenwald.

@ngreenwald
Copy link
Member

Sure thing, if you think it'll simplify things go for it

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.

Nice, this is much more clear

toffy/tiling_utils.py Outdated Show resolved Hide resolved
toffy/tiling_utils.py Show resolved Hide resolved
@ngreenwald ngreenwald merged commit b0b4db5 into main Feb 1, 2022
@ngreenwald ngreenwald deleted the tma_validate branch February 1, 2022 23:09
@camisowers camisowers added the enhancement New feature or request label Sep 28, 2022
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.

Ordering of automatically generated TMA FOV names sanity checks for TMA remapping
3 participants