I didn't have an exact sequence of steps in mind, just in general that's how you'd have to approach the problem, and indeed that may require putting scripts together to work with the data arrays rather than trying to make it all work through image processing.