Model-based Coding of Multi-dimensional data with applicationsto Medical Imaging