Combine calculations into one method

Trying to loop through the image set as few times as possible.