From 5a9b8acee5920937d293a6362232dba96931fc2e Mon Sep 17 00:00:00 2001 From: fishpm Date: Tue, 5 Sep 2023 15:45:35 +0200 Subject: [PATCH] Add files via upload handle NaN voxels values following tedana --- QA/spmup_spatialcorr.m | 6 ++++-- QA/spmup_volumecorr.m | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/QA/spmup_spatialcorr.m b/QA/spmup_spatialcorr.m index 8e70c52..d79d9aa 100644 --- a/QA/spmup_spatialcorr.m +++ b/QA/spmup_spatialcorr.m @@ -18,8 +18,8 @@ % -------------------------- % Copyright (C) SPMUP Team -if exist('nanmean','file') == 0 - error('you do not have stats toolbox to perform this operation, sorry') +if exist('nansum','file') ~= 2 +% error('you do not have stats toolbox to perform this operation, sorry') end %% check inputs @@ -97,6 +97,7 @@ parfor i = 1:size(Y,4) S = squeeze(Y(:,:,:,i)); % take one volume vols = reshape(S,[size(Y,1)*size(Y,2),n]); % reshape each slice as vectors + vols(isnan(vols)) = 0; % handle images with NaNs (e.g., tedana output) all_r = corr(vols); % all correlations between slices idx = 2:n+1:numel(all_r); % take only one above diag (12,23,34,..) r(i,:) = all_r(idx); @@ -138,6 +139,7 @@ parfor i = 1:size(Y,3) S = squeeze(Y(:,:,i,:)); % take one slice all volumes vols = reshape(S,[size(Y,1)*size(Y,2),n]); % reshape slices as vectors + vols(isnan(vols)) = 0; % handle images with NaNs (e.g., tedana output) all_r = corr(vols); % all correlations between volumes idx = 2:n+1:numel(all_r); % take only one above diag (12,23,34,..) r(i,:) = all_r(idx); diff --git a/QA/spmup_volumecorr.m b/QA/spmup_volumecorr.m index 62cef09..b60d6a0 100644 --- a/QA/spmup_volumecorr.m +++ b/QA/spmup_volumecorr.m @@ -19,8 +19,8 @@ % -------------------------- % Copyright (C) SPMUP Team -if exist('nanmean','file') == 0 - error('you do not have stats toolbox to perform this operation, sorry') +if exist('nansum','file') ~= 2 +% error('you do not have stats toolbox to perform this operation, sorry') end %% check inputs @@ -163,4 +163,4 @@ end r_outliers = r_outliers'; -r_course = r_course'; +r_course = r_course'; \ No newline at end of file