Added error checking and bug fixed corner cases.

The specialised get pixels was removed as this was causing obscure
errors when dealing with general L and s. This should not make
any real difference performance wise.
Added test cases for high level interface.