BUG: check that the mask image matches dimension

Change-Id: I2fcb773de53dd71764e01bfffe05f8c87feda824
WIP: add AmoebaOptimizerv4
WIP: Add ExhaustiveOptimizerv4
WIP: Add OnePlusOneOptimizerv4
WIP: Add PowellOptimizerv4
WIP: fix some compiler issues