Commit 71ba10c
BUG: Fix image_from_array to handle non-contiguous arrays
The issue was that GetImageViewFromArray always reversed the shape for
non-vector images, regardless of whether the array was C-contiguous or
F-contiguous. However, the C++ code reverses the shape again for F-contiguous
arrays, resulting in a double reversal.
The fix: Only reverse the shape in Python for C-contiguous arrays. For
F-contiguous arrays, pass the shape as-is to C++, which will handle the
reversal there.
Added comprehensive test cases for both image_from_array and
image_view_from_array with transposed arrays.
Co-authored-by: thewtex <25432+thewtex@users.noreply.github.com>1 parent 5b25f72 commit 71ba10c
File tree
2 files changed
+22
-1
lines changed- Modules/Bridge/NumPy/wrapping
- Wrapping/Generators/Python/Tests
2 files changed
+22
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
421 | 439 | | |
422 | 440 | | |
423 | 441 | | |
| |||
0 commit comments