Conventional approaches to image registration are generally limited to image-wide rigid transformations. However, the body and its internal organs are non-rigid structures that change shape due to changes in the body's posture during image acquisition, and due to normal, pathological and treatment-related variations. Inter-subject matching also constitutes a non-rigid registration problem. In this paper, we present a fully automated non-rigid image registration method that maximizes a local voxel-based similarity metric. Overlapping image blocks are defined on a 3D grid. The transformation vector field representing image deformation is found by translating each block so as to maximize the local similarity measure. The resulting sparsely sampled vector field is median filtered and interpolated by a Gaussian function to ensure a locally smooth transformation. A hierarchical stretegy is adopted to progressively establish local registration associated with image structures at diminishing scale. Simulation studies were carried out to evaluate the proposed algorithm and to determine the robustness of various voxel-based cost functions. Mutual information, normalized mutual information, correlation ratio (CR) and a new symmetric version of CR were evaluated and compared. A T1-weighted magnetic resonance (MR) image was used to test intra-modality registration. Proton density and T2-weighted MR images of the same subject were used to evaluate inter-modality registration. The proposed algorithm was tested on the 2D MR images distorted by known deformations and 3D images simulating inter-subject distortions. We studied the robustness of cost functions with respect to image sampling. Results indicate that the symmetric CR gives comparable registration to mutual information in intra- and inter-modality tasks at full sampling and is superior to mutual information in registering sparsely sampled images.