A method for spatially localizing a rib cage prior to transcostal ultrasound treatment of visceral tissue includes computationally refining a three-dimensional model of the rib cage based on image slices taken at multiple locations along the ribs with orientations dependent on local rib orientations.