Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
handle NaN voxels values following tedana
  • Loading branch information
fishpm authored Sep 5, 2023
1 parent 44ef8cf commit 5a9b8ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions QA/spmup_spatialcorr.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions QA/spmup_volumecorr.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -163,4 +163,4 @@
end

r_outliers = r_outliers';
r_course = r_course';
r_course = r_course';

0 comments on commit 5a9b8ac

Please sign in to comment.