added image generation
fix bug with correction
added mask for pattern