spm_mesh_euler.m 690 B

123456789101112131415161718
  1. function ksi = spm_mesh_euler(M)
  2. % Compute the Euler characteristic of a triangle mesh
  3. % M - patch structure
  4. %
  5. % ksi - Euler characteristic
  6. %__________________________________________________________________________
  7. %
  8. % The Euler characteristic is defined according to the formula:
  9. % \ksi = V - E + F
  10. % See https://www.wikipedia.org/wiki/Euler_characteristic
  11. %__________________________________________________________________________
  12. % Copyright (C) 2018 Wellcome Trust Centre for Neuroimaging
  13. % Guillaume Flandin
  14. % $Id: spm_mesh_euler.m 7397 2018-08-15 11:04:26Z guillaume $
  15. ksi = size(M.vertices,1) - size(spm_mesh_edges(M),1) + size(M.faces,1);