Automatic skull defect restoration and cranial implant generation for cranioplasty