spm_mesh_isoline.m 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. function C = spm_mesh_isoline(M, T, t)
  2. % Compute isolines on a triangular mesh
  3. % FORMAT C = spm_mesh_isoline(M, T, t)
  4. % M - a GIfTI object or patch structure
  5. % T - [vx1] data vector
  6. % t - isovalue [Default: 0]
  7. %
  8. % C - struct array of isolines with fields 'xdata', 'ydata', 'zdata' and
  9. % 'isopen'
  10. %__________________________________________________________________________
  11. %
  12. % M = gifti(fullfile(spm('Dir'),'canonical','cortex_20484.surf.gii'));
  13. % M = export(M,'patch');
  14. % M = spm_mesh_inflate(M);
  15. % T = randn(size(M.vertices,1),1);
  16. % T = spm_mesh_smooth(M,T,100);
  17. % H = spm_mesh_render('Disp',M);
  18. % H = spm_mesh_render('Overlay',H,T);
  19. % hold on
  20. % t = linspace(min(T),max(T),20);
  21. % for i=1:numel(t)
  22. % C = spm_mesh_isoline(M,T,t(i));
  23. % for j=1:numel(C)
  24. % plot3(C(j).xdata,C(j).ydata,C(j).zdata,'k-');
  25. % end
  26. % end
  27. %__________________________________________________________________________
  28. % Copyright (C) 2019 Wellcome Trust Centre for Neuroimaging
  29. % Guillaume Flandin
  30. % $Id: spm_mesh_isoline.m 7618 2019-06-17 12:29:46Z guillaume $
  31. if nargin < 3, t = 0; end
  32. C = spm_mesh_contour(M,struct('T',T,'t',t));