BUG: Fixed handling of inconsistenly placed \r

Sometimes on Windows the line endings were \r\n,
sometimes just \n. Rather than debug the inconsistency,
this patch removes \r from strings read from the pipe.
This stops the library from hanging on Windows and makes
all tests to run to completion.

Also fixed a test that was accessing spacing for
dimensions 3, 4, and 5 in a 2D image, which caused
an out-of-bounds read in a vector.