We propose a method for the registration of MRI brain images with the physical space. Points on the patients scalp are acquired using a magnetic-field digitizer. The registration transform is the rigid transform that minimizes the mean square distance between those points and the scalp surface segmented from the MRI. The distance to the scalp surface is effciently computed using a 3d Euclidean distance transformation. We apply this method to the visualization of transcranial magnetic stimulation and show that results are precise (4mm) and reproducible (1mm).