use cellfun instead of for loops
multi-core version of image generator - should be up to date with most recent version of standard script