Implement stacked cube analysis of extended sources.

This is still pretty slow code, will now dive into this to better understand what the bottle necks are.