Writer: check pixel type when setting metadata

The pixel type check here does not need to be tied to the checkParams
method. It can be checked as soon as metadata is supported.

This should allow incompatible writings to fail earlier and with
improved messages.

Closes #154