Three-dimensional imaging with a nuclear magnetic resonance force microscope