prepare_for_display() validates only the upper bound of rgb_mapping indices. Negative indices therefore pass validation and use NumPy negative indexing, silently selecting channels from the end of the image.
For a 4-channel image, rgb_mapping=[-1, 0, 1] is accepted and maps channel 3 into red instead of rejecting the invalid mapping.
prepare_for_display()validates only the upper bound ofrgb_mappingindices. Negative indices therefore pass validation and use NumPy negative indexing, silently selecting channels from the end of the image.For a 4-channel image,
rgb_mapping=[-1, 0, 1]is accepted and maps channel 3 into red instead of rejecting the invalid mapping.