Smart needle developed to make brain surgery safer