spm_check_results.m 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. function spm_check_results(SPMs,xSPM)
  2. % Display several MIPs in the same figure
  3. % FORMAT spm_check_results(SPMs,xSPM)
  4. % SPMs - char or cell array of paths to SPM.mat[s]
  5. % xSPM - structure containing thresholding details, see spm_getSPM.m
  6. %
  7. % Beware: syntax and features of this function are likely to change.
  8. %__________________________________________________________________________
  9. % Copyright (C) 2012 Wellcome Trust Centre for Neuroimaging
  10. % Guillaume Flandin
  11. % $Id: spm_check_results.m 4660 2012-02-20 17:39:29Z guillaume $
  12. cwd = pwd;
  13. %-Get input parameter SPMs
  14. %--------------------------------------------------------------------------
  15. if ~nargin || isempty(SPMs)
  16. [SPMs, sts] = spm_select(Inf,'^SPM\.mat$','Select SPM.mat[s]');
  17. if ~sts, return; end
  18. end
  19. SPMs = cellstr(SPMs);
  20. %-Get input parameter xSPM
  21. %--------------------------------------------------------------------------
  22. xSPM.swd = spm_file(SPMs{1},'fpath');
  23. try, [xSPM.thresDesc, xSPM.u] = convert_desc(xSPM.thresDesc); end
  24. [tmp, xSPM] = spm_getSPM(xSPM);
  25. if ~isfield(xSPM,'units'), xSPM.units = {'mm' 'mm' 'mm'}; end
  26. [xSPM.thresDesc, xSPM.u] = convert_desc(xSPM.thresDesc);
  27. %-
  28. %--------------------------------------------------------------------------
  29. Fgraph = spm_figure('GetWin','Graphics');
  30. spm_figure('Clear','Graphics');
  31. mn = numel(SPMs);
  32. n = round(mn^0.4);
  33. m = ceil(mn/n);
  34. w = 1/n;
  35. h = 1/m;
  36. ds = (w+h)*0.02;
  37. for ij=1:numel(SPMs)
  38. i = 1-h*(floor((ij-1)/n)+1);
  39. j = w*rem(ij-1,n);
  40. xSPM.swd = spm_file(SPMs{ij},'fpath');
  41. [tmp, myxSPM] = spm_getSPM(xSPM);
  42. hMIPax(ij) = axes('Parent',Fgraph,'Position',[j+ds/2 i+ds/2 w-ds h-ds],'Visible','off');
  43. hMIPax(ij) = spm_mip_ui(myxSPM.Z,myxSPM.XYZmm,myxSPM.M,myxSPM.DIM,hMIPax(ij),myxSPM.units);
  44. axis(hMIPax(ij),'image');
  45. set(findobj(hMIPax(ij),'type','image'),'UIContextMenu',[]);
  46. hReg = get(hMIPax(ij),'UserData');
  47. set(hReg.hXr,'visible','off');
  48. set(hReg.hMIPxyz,'visible','off');
  49. end
  50. linkaxes(hMIPax);
  51. cd(cwd);
  52. %==========================================================================
  53. % function [str, u] = convert_desc(str)
  54. %==========================================================================
  55. function [str, u] = convert_desc(str)
  56. td = regexp(str,'p\D?(?<u>[\.\d]+) \((?<thresDesc>\S+)\)','names');
  57. if isempty(td)
  58. td = regexp(str,'\w=(?<u>[\.\d]+)','names');
  59. td.thresDesc = 'none';
  60. end
  61. if strcmp(td.thresDesc,'unc.'), td.thresDesc = 'none'; end
  62. u = str2double(td.u);
  63. str = td.thresDesc;