Spatial and Temporal Correlation Analysis with an Application to fMRI Data