General code cleanup and better documentation. New function for working with large images, by breaking it up into patches. New option for cleaning up the SAM segmentation result when it is of poor quality and contains large objects that span multiple grains.