Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
Fixes bug with iterations variables
  • Loading branch information
mschneider1711 committed May 31, 2023
1 parent 32276bc commit 1b07063
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions fMRI/rsfMRI_Processing/getMergedFMRI_data.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function getMergedFMRI_data(fmriStruct,thres_type,thres)
out_path = fmriStruct.out_path;
% initialize counter for the number of regions
numOfRegions_all(1) = 0;
j = 2;
j=2;
for d = 1:length(days)
for g = 1:length(groups)
disp('Processing '+days(d)+': '+groups(g)+' ...');
Expand All @@ -25,7 +25,7 @@ function getMergedFMRI_data(fmriStruct,thres_type,thres)
if j-1 ~= 1 && numOfRegions_all(j) ~= numOfRegions_all(j-1)
disp('Warning: Number of atlas labels differs between two subjects, groups or days!');
end
% Create infoFMRI struct
% Create infoFMRI struct
numOfRegions = unique(numOfRegions_all(2:end));
% numOfRegions_all should contain a 0 in position 1.
% All subsequent positions should contain the number of atlas
Expand Down Expand Up @@ -131,7 +131,18 @@ function getMergedFMRI_data(fmriStruct,thres_type,thres)
end

end


% calculate z-transformation
[rows, cols, depth] = size(coMat);
z_trans_mat = zeros(rows,cols,depth);
for ii=1:rows
for jj=1:cols
for hh=1:depth
z = 0.5*log((1 + coMat(ii,jj,hh)) / (1-coMat(ii,jj,hh)));
z_trans_mat(ii,jj,hh) = z;
end
end
end



Expand All @@ -140,6 +151,7 @@ function getMergedFMRI_data(fmriStruct,thres_type,thres)
infoFMRI.names = namesOfMat;
infoFMRI.matrix = current_matAll;
infoFMRI.raw_matrix = coMat;
infoFMRI.z_trans_matrix = z_trans_mat;
infoFMRI.labels = labels;
infoFMRI.clustercoef = clustercoef;
infoFMRI.participationcoef = participationcoef;
Expand Down Expand Up @@ -168,19 +180,6 @@ function getMergedFMRI_data(fmriStruct,thres_type,thres)
charPathLength_normalized(i) = charPathLength(i)/charPathLength_rand(i);
infoFMRI.smallWorldness = (clustercoef_normalized(:,i)/charPathLength_normalized(i))';
infoFMRI.overallConnectivity = overallConnectivity;

% calculate z-transformation
[rows, cols, depth] = size(coMat);
z_trans_mat = zeros(rows,cols,depth);
for i=1:rows
for j=1:cols
for h=1:depth
z = 0.5*log((1 + coMat(i,j,h)) / (1-coMat(i,j,h)));
z_trans_mat(i,j,h) = z;
end
end
end
infoFMRI.z_trans_matrix = z_trans_mat;

%infoFMRI.smallWorldness = (nanmean(clustercoef(:,i),2)/charPathLength(i))';

Expand Down

0 comments on commit 1b07063

Please sign in to comment.