A framework for the statistical analysis of mass spectrometry imaging experiments