-
Notifications
You must be signed in to change notification settings - Fork 53
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
resize each block to custom shape #244
Conversation
Codecov ReportBase: 84.46% // Head: 84.54% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #244 +/- ##
==========================================
+ Coverage 84.46% 84.54% +0.07%
==========================================
Files 13 13
Lines 1474 1475 +1
==========================================
+ Hits 1245 1247 +2
+ Misses 229 228 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Hmmm.... lots of failures on comparison of the dask arrays. |
Strange that the tests passed on all the
|
Strange, but tests are NOT failing for |
Looks like #243 is the fix needed. So once that's merged I can revert my merge above. |
This pull request has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/converting-other-idr-images-into-public-zarr/44025/20 |
e1fdd12
to
5673e4c
Compare
cc @aeisenbarth |
I haven't observed such issues, probably because we stayed always with the same chunk size 256. The explanation makes a lot of sense to me for this example. In general, the problem with block-based scaling is the accumulation of rounding errors. It is interesting that for the opposite case (target size 3338, factor 0.5000749, output block size 501) |
I'm still failing to get "Build using Zarr development branch / ubuntu-latest 3.8 (pull_request)" green. I'll open a PR to remove that and then we can start trying to ressurect it. |
@aeisenbarth: is there another test that you think would detect accumulation in the opposite case? |
I think that if there was an accumulation of chunks where the pixel size is rounded up, then the concatenated array would be a few pixels larger than expected, but this would then be cropped/sliced at:
But using Line 146 in c1302e0
So that the scale |
@joshmoore - anything else needed here? |
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.
Not particularly, and thanks for the explanation. If anyone sees an edge case that needs covering, feel free to add tests 🙂
Bug-fix: when using
ome_zarr.dask_utils.resize()
to resize an array that has chunks of different sizes (e.g. at the edge of a large image), these chunks are resized to the same dimensions as the other chunks. This creates a lager image than expected, but this is then cropped.E.g. image of 1050 x 1050 with chunk size of 512 x 512, this will give edge chunks of size 512 x 26 or 26 x 26.
When downsampling the image, ALL chunks will get resized to 256 x 256, so the edge chunks will get stretched.
This will give a slightly bigger output image than expected, but this is then cropped.
E.g. idr image 14257890 at lowest resolution:
Resized with
ome_zarr.dask_utils.resize()
to give a half-size array gives stretched edge tiles:This is fixed by this PR.