funkelab / gunpowder

A library to facilitate machine learning on multi-dimensional images.
https://funkelab.github.io/gunpowder/
MIT License
79 stars 56 forks source link

Transpose around center in SimpleAugment #99

Closed riels89 closed 4 years ago

riels89 commented 4 years ago

Rather than transposing the request offsets, it should transpose around the center of the downstream request.

Old functionality: Source with (1000, 2000) Downstream request for array of size (20, 40) with ROI (90:110, 1480:1520). Transpose request and make upstream request for (1480:1520, 90:110)

This request would then be very far out of bounds and very far from the original requested area.

New functionality: Source with (1000, 2000) Downstream request for array of size (20, 40) with ROI (90:110, 1480:1520). Calculate center: (100, 1500) Calculate distance of offset from center: (10, 20) Transpose distance: (20, 10), because we want our new request to have transposed shape Subtract distance from center to get new offset (80, 1490) Transpose shape: (40, 20) Request ROI of (80:120, 1490:1510)

Example of rotating around center: tranpose