There is increased use of medical imaging techniques that produce four dimensional (4D) datasets such as fMRI and 3D dynamic echocardiograms. These datasets consume even larger amounts of resources for transmission or storage compared to the traditional 2D data sets. In this paper, we extend the zero tree algorithms, EZW (Embedded Zero tree coding of Wavelet coefficients) and SPIHT (Set Partitioning in Hierarchichal Trees) to 4D to compress the 4D datasets more efficiently. Integer to integer wavelet transforms scaled by appropriate subband energy weights are used to get lossy to lossless compression. We also investigate the effects of lossy compression on the end result of fMRI analysis.