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
Fix row-column/X-Y coordinates mix-up in Random Tiler #317
Conversation
fcc91ff
to
b3b748a
Compare
Codecov Report
@@ Coverage Diff @@
## master #317 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 17 17
Lines 1284 1285 +1
Branches 124 124
=========================================
+ Hits 1284 1285 +1
Continue to review full report at Codecov.
|
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 like the fix ❤️ thx
Some comments before i can do another review round :D
@@ -123,7 +123,7 @@ def it_locates_tiles_on_the_slide( | |||
slide = Slide(fixture_slide, "") | |||
random_tiles_extractor = RandomTiler( | |||
tile_size=tile_size, | |||
n_tiles=2, | |||
n_tiles=100, |
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.
did you consider the performance during testrunner increasing the n tiles of 2 order of magnitude?
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 did consider it, but the point is that with only 2 tiles we cannot really see how the tiler is sampling the tiles, if you compare the old and new expectations you will see that only now this test is really meaninfgul
@ernestoarbitrio to do what you suggest I need to unroll the list comprehension to a normal for statement.. I will do that |
Actually i think you can still use comprehension if you write an internal function that given the |
actually this code is wrong..
I need to "split" the tuple in two and then individually reverse.. anyway I will implement it in a subfunction It would be like this in the end |
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.
LGTM, just 1 minor thing. Good to go after this
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.
Thanks @alessiamarcolini for this important PR! All looks good to me.
Description
This PR fixes the mismatch between row-column / X-Y coordinates in the
RandomTiler
. In the end, the result was correct due to a double bug, but know they should both be fixed.Moreover, it fixes inverted
y_ul
andx_br
inCoordinatePair
used in unit testing (causing no harm), and it moves the conversion from np coords to PIL coords toregions_from_binary_mask
Types of Changes
Issues Fixed or Closed by This PR
Checklist