This paper proposes a methodology for the joint alignment of a sequence of images based on a groupwise registration procedure by using a new family of metrics that exploit the expected sparseness of the temporal intensity curves corresponding to the aligned points. Therefore, this methodology is able to tackle the alignment of temporal sequences of images in which the represented phenomenon varies in time. Specifically, we have applied it to the correction of motion in contrast-enhanced first-pass perfusion cardiac magnetic resonance images. The time sequence is elastically registered as a whole by using the aforementioned family of multi-image metrics and jointly optimizing the parameters of the transformations involved. The proposed metrics are able to cope with dynamic changes in the intensity content of corresponding points in the sequence guided by the assumption that these changes allow for a sparse representation in a properly selected frame. Results have shown the statistically significant improvement in the performance of the proposed metric with respect to previous groupwise registration metrics for the problem at hand, which is especially relevant to correct for elastic deformations.