add debug IO interface.
Fix z indexing error.
new test for thresholding data.

ensures we create a volume of the right size.
also fixed some indenting issues.
fix printf specification

'value' actually returns a normal 32bit integer.