Make sure that we respect dataWindow and displayWindow.

This commit fixes a crash when reading a image with a dataWindow box
within a bigger displayWindow. Fix bug #9697.