Spinal screw placement is a challenging task due to small bone corridors and high risk of neurological or vascular complications, benefiting from precision guidance/navigation and quality assurance (QA). Implicit to both guidance and QA is the definition of a surgical plan-i.e. the desired trajectories and device selection for target vertebrae-conventionally requiring time-consuming manual annotations by a skilled surgeon. We propose automation of such planning by deriving the pedicle trajectory and device selection from a patient's preoperative CT or MRI. An atlas of vertebrae surfaces was created to provide the underlying basis for automatic planning-in this work, comprising 40 exemplary vertebrae at three levels of the spine (T7, T8, and L3). The atlas was enriched with ideal trajectory annotations for 60 pedicles in total. To define trajectories for a given patient, sparse deformation fields from the atlas surfaces to the input (CT or MR image) are applied on the annotated trajectories. Mean value coordinates are used to interpolate dense deformation fields. The pose of a straight trajectory is optimized by image-based registration to an accumulated volume of the deformed annotations. For evaluation, input deformation fields were created using coherent point drift (CPD) to perform a leave-one-out analysis over the atlas surfaces. CPD registration demonstrated surface error of 0.89 ± 0.10 mm (median ± interquartile range) for T7/T8 and 1.29 ± 0.15 mm for L3. At the pedicle center, registered trajectories deviated from the expert reference by 0.56 ± 0.63 mm (T7/T8) and 1.12 ± 0.67 mm (L3). The predicted maximum screw diameter differed by 0.45 ± 0.62 mm (T7/T8), and 1.26 ± 1.19 mm (L3). The automated planning method avoided screw collisions in all cases and demonstrated close agreement overall with expert reference plans, offering a potentially valuable tool in support of surgical guidance and QA.