Total variation regularization of pose signals with an application to 3D freehand ultrasound