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)
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: