Prevent a redefinition error when using boost::shared_ptr.

MSVC 2008 and later version support std::shared_ptr. Adding "using std::tr1::shared_ptr" caused a redefinition of boost:shared_ptr through other files. Tested with Visual C++ 2012 and boost 1.51.0.
Fix an unitialized value warning.
Fix the issue with libtiff 4 noted by arekz in issue #525.
Fix minor cast warnings.
Fix an out-of-bounds exception thrown by msvc in debug mode.

By default msvc performs vector range checks in debug mode, causing calls like ```vector[vector.size()]``` to fail.
Limit the number of channels to read when setting a specific number of channels.

By default getting a pixel gets all the channels in the source. When the target number of channels was smaller than the channel in the source there was a buffer overflow in the pixel buffer. This error was silent on gcc/Linux but caused a corrupted heap error in msvc.
Do not try to read pixels for 0-sized images when printing the SHA-1 info.
Call resize instead of reserve when allocating the ouput buffer in dpxoutput.

```vector::reserve``` does not modify the size, this was causing out-of-bounds errors in msvc when trying to use even ```m_buf[0]```.
Fix downcasting warnings in the jpeg2000 plugin.
Make sure the jpeg2000 event manager transfer object remains valid.

The contents of the stack-allocated event manager structure created in the helper function are undefined after calling it. MSVC was overwritting those values, causing segfaults during the decoding.