Split colorize into a separate inner loop function that can be injected.
Added callback to colorizeImageData function.