BUG: Add mutex lock to MersenneTwister GetInstance

Access to singleton variable is protected with mutex. During
initialization concurrent access can result in a segmentation fault.

Common functionality in New and GetInstance was refactored into
CreateInstance.

Change-Id: I96d7a7f7b8b57e8cb293cddfcce2c6c623b3faa6
BUG: Invalid read during ImageIOBase SetDirection.

This bug was unveiled by a new test that writes a 3D images to a series of
2D DICOM files.  In this case, the ImagesSeriesWriter re-uses the 3D ImageIO
object on each of the 2D slices when writing with ImageFileWriter.

Change-Id: I592b6cd99d45854be24ddd1e074af4aa03a1ad33
BUG: Same test function in different file causes conflict

Having the same templated function name in multiple test file for the
same executable can cause the symbols to be mixed up. This patch
addresses a number of TIFF failing tests on OSX with genuine gcc 4.2.

Change-Id: If304ebcf5dbab53e8d7df78eeada7c1a82d492f2
Merge branch 'FixMersenneTwisterGetInstanceThreading' into release

Change-Id: I5d23e73779daa361008da80838209c76a81c6e71
Merge branch 'imagebase-invalid-read-release' into release

Change-Id: I00e8842fdc34a8f89341de3a2dd363e376b60f84