Modified so only store the masked pixels in order to save memory, required addition of new functions to remove non-mask pixels and to put them back in to recreate the image.

Multiple changes to the find mean and PCA, still not completed but does work.