Fix an off-by-one, and a late-night dead-brain bug

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Switch to 3D

... because the PGM reader actually returns width x height x 1.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>