spm_get_volumes.m 951 B

1234567891011121314151617181920212223242526272829303132
  1. function gl = spm_get_volumes(P)
  2. % Compute total volumes from tissue segmentations
  3. % FORMAT gl = spm_get_volumes(P)
  4. % P - a matrix of image filenames
  5. % gl - a vector of volumes (in litres)
  6. %__________________________________________________________________________
  7. % Copyright (C) 2006-2011 Wellcome Trust Centre for Neuroimaging
  8. % John Ashburner
  9. % $Id: spm_get_volumes.m 5670 2013-10-04 16:48:38Z ged $
  10. warning('spm:deprecated', ...
  11. ['spm_get_volumes will be removed in the future, please use ' ...
  12. 'the Tissue Volumes Utility in the Batch interface, or:\n\t' ...
  13. 'spm_summarise(P, ''all'', ''litres'')']);
  14. if ~nargin
  15. [P,sts] = spm_select(Inf,'image','Select images');
  16. if ~sts, gl = []; return; end
  17. end
  18. V = spm_vol(P);
  19. if spm_check_orientations(V, false)
  20. gl = spm_summarise(V, 'all', 'litres');
  21. else
  22. N = numel(V);
  23. gl = nan(N, 1);
  24. for n = 1:N
  25. gl(n) = spm_summarise(V(n), 'all', 'litres');
  26. end
  27. end