def neurite_centre_of_mass(neurite):
centre_of_mass = np.zeros(<NUM_LIT:3>)<EOL>total_volume = <NUM_LIT:0><EOL>seg_vol = np.array(map(mm.segment_volume, nm.iter_segments(neurite)))<EOL>seg_centre_of_mass = np.array(map(segment_centre_of_mass, nm.iter_segments(neurite)))<EOL>seg_centre_of_mass = seg_centre_of_mass * seg_vol[:, np.newaxis]<EOL>centre_of_mass = np.sum(seg_centre_of_mass, axis=<NUM_LIT:0>)<EOL>total_volume = np.sum(seg_vol)<EOL>return centre_of_mass / total_volume<EOL>
Calculate and return centre of mass of a neurite.