Commit 94e9e17
authored
6007 reverse_indexing for PILReader (#6008)
Fixes #6007
### Description
- reverse_indexing = False:
to support consistency with PIL/torchvision
```py
img = LoadImage(image_only=True, ensure_channel_first=True, reverse_indexing=False)("MONAI-logo_color.png") # PILReader
torchvision.utils.save_image(img, "MONAI-logo_color_torchvision.png", normalize=True)
```
- reverse_indexing = True:
to support consistency with other backends in monai
```py
img = LoadImage(image_only=True, ensure_channel_first=True, reader="PILReader", reverse_indexing=True)(filename) # PIL backend
img_1 = LoadImage(image_only=True, ensure_channel_first=True, reader="ITKReader")(filename) # itk backend
np.testing.assert_allclose(img, img_1) # true
```
### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.
---------
Signed-off-by: Wenqi Li <wenqil@nvidia.com>1 parent f4902b2 commit 94e9e17
File tree
4 files changed
+19
-14
lines changed- monai
- data
- transforms/io
- tests
4 files changed
+19
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1141 | 1141 | | |
1142 | 1142 | | |
1143 | 1143 | | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
1144 | 1147 | | |
1145 | 1148 | | |
1146 | 1149 | | |
1147 | 1150 | | |
1148 | | - | |
| 1151 | + | |
1149 | 1152 | | |
1150 | 1153 | | |
| 1154 | + | |
1151 | 1155 | | |
1152 | 1156 | | |
1153 | 1157 | | |
| |||
1194 | 1198 | | |
1195 | 1199 | | |
1196 | 1200 | | |
1197 | | - | |
1198 | | - | |
| 1201 | + | |
| 1202 | + | |
1199 | 1203 | | |
1200 | 1204 | | |
1201 | 1205 | | |
| |||
1207 | 1211 | | |
1208 | 1212 | | |
1209 | 1213 | | |
1210 | | - | |
| 1214 | + | |
1211 | 1215 | | |
1212 | 1216 | | |
1213 | 1217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
121 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
0 commit comments