Magnetic resonance tagging is a technique for measuring heart deformations through creation of a stripe grid pattern on cardiac images. Typically, sets of tag surfaces are encoded in the tissue appearing as dark lines on 2D images. In this paper, we present a Maximum A Posteriori (MAP) framework for detecting tag lines using a Markov random field defined on the lattice generated by uniform sampling of B-spline models in 3D and 4D. In the 3D case, MAP estimation is cast for finding the optimal solid for the tag features present in the current image set given an initial solid from the previous frame. The method also allows the parameters of the solid model including the number of knots and the spline order to be adjusted within the same framework. Fitting can start with a solid with less knots and lower spline order, and proceed to one with more knots and/or higher order so as to achieve more accuracy. The optimal solids obtained from 3D tracking for all the frames in the image sequence are considered a 4D B-spline model with linear time interpolation. The framework is then applied to arrive at a 4D B-spline model with higher order time interpolation. The method has been validated with 5 sets of in-vivo data, comprised of a sum total of 882 short-axis (SA) and long-axis (LA) images.