Amniocentesis is used to extract fetal cells for genetic analysis. The position of the fetus is first determined by ultrasound; a needle is then inserted through the abdominal and uterine walls to recover amniotic fluid and fetal cells.