Working on Fit mask to original image

Working on Fit mask to original image. Added perimeter to allow switching.