Added support for NChannelImage pattern and ExtendToNChannel patterngene...

With fixes.