Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

mNET_nodes.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. cd 'D:\Labor\Analyses\Toolbox\fMRI'
  2. addpath('FSLNets')
  3. addpath('L1precision')
  4. addpath('pwling')
  5. addpath('../Tools/BCT')
  6. folder_idx = pwd; % get folder ID to store data
  7. files_idx = dir([folder_idx,'/*mat']); % list data2load
  8. baseFileName = files_idx.name;
  9. fullFileName = fullfile(folder_idx, baseFileName);
  10. dirInfos = dir(fullFileName);
  11. clear ('folder_idx','files_idx','baseFileName','fullFileName');
  12. cd 'D:\Labor\Projects\Stroke_tDCS_rsfmri\B_rsfmri_stroke_tDCS_mice\data';
  13. targetFolder=pwd;
  14. clear 'data';
  15. %load matrix data from .mat
  16. load data.mat;
  17. load labels.mat;
  18. % % load data_neu2.mat;
  19. % % load data_full.mat;
  20. % load labelsData.mat;
  21. % load labelsROI.mat;
  22. % load labelsROI_long.mat;
  23. %%
  24. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  25. % 1) extract mNet/ROI and save in matrix
  26. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  27. for ri = 1:size(data,2)
  28. for li = 1:size(data(ri).subj,2)
  29. for ti = 1:size(data(ri).subj(li).tp,2)
  30. mnx=data(ri).subj(li).tp(ti).mNet;
  31. if ~isempty(mnx)
  32. mNet(:,:,(ri-1)*4+ti,li)=mnx;
  33. end
  34. end
  35. % rnx=data(ri).subj(li).mNet;
  36. % ROI(:,:,li,ri)=rnx;
  37. end
  38. end
  39. mNet(mNet==0)=nan;
  40. clear ('mnx','rnx','li','ri');
  41. mNet_mean = squeeze(mean(mNet,4,'omitnan'));
  42. %
  43. %%
  44. DeltaTDCS = (mNet_mean(:,:,11)-mNet_mean(:,:,9))-(mNet_mean(:,:,7)-mNet_mean(:,:,5));
  45. PTdiff=squeeze(mNet(:,:,7,:)-mNet_mean(:,:,5));
  46. for i = 1:98
  47. for k = 1:98
  48. DeltaSD(i,k) = std(PTdiff(i,k,:),'omitnan');
  49. end
  50. end
  51. DDelta=DeltaTDCS./DeltaSD;
  52. %%
  53. [X,Y,On] = grid_communities(M);
  54. dirInfo.name='';
  55. plotmat_values_rsfMRI(DeltaTDCS(On,On),[],dirInfo,[-.75 .75],0,[]);
  56. hold on
  57. axis square;
  58. plot(X,Y,'k','linewidth',2)
  59. %%
  60. NodeDelta=squeeze(mean(DDelta,1,'omitnan'));
  61. ROIDelta(1,:)=NodeDelta(labels.nr14(1:7));
  62. ROIDelta(2,:)=NodeDelta(labels.nr14(8:14));
  63. ROI = cell2table(num2cell(ROIDelta),'VariableNames',lab)
  64. h=heatmap(ROIDelta)
  65. colormap('Parula')
  66. h.YDisplayLabels = {'left','right'}
  67. h.XDisplayLabels = lab;
  68. caxis([0 1])
  69. title('Change in Node Strength (Z-score)')
  70. %%
  71. cd ('D:\Labor\Projekte\Stroke_tDCS_rsfmri\B_rsfmri_stroke_tDCS_mice\results\Old\plot_nodes')
  72. atlas = niftiread("annotations_50_parent_splitted.nii.gz");
  73. nodes = readtable("acronyms_parent_splitted.txt");
  74. nodes = cell2mat(table2cell(nodes(:,1)));
  75. atlas_mapped=nan(size(atlas,1),size(atlas,2),size(atlas,3));
  76. NodesMean = squeeze(mean(group_delta(:,:,3,2),1,'omitnan'));
  77. NodesStd = squeeze(std(group_delta(:,:,3,2),0,1,'omitnan'));
  78. NodesDelta = NodesMean./NodesStd;
  79. % % for l=1:length(nodes)
  80. % %
  81. % % z=find(atlas==nodes(l));
  82. % % if ~isempty(z)
  83. % %
  84. % % atlas_mapped(z)=NodeDelta(l);
  85. % %
  86. % % end
  87. % % end
  88. % % plot_map=atlas_mapped(:,:,124);
  89. % % imshow(plot_map,[-1 0])
  90. % % colormap('Parula')
  91. % % set(im, 'AlphaData', ~isnan(plot_map))
  92. % %
  93. % % % niftiwrite(mask,'atlas_mapped.nii')
  94. % % end
  95. % %
  96. % % %%
  97. % %
  98. % % cd ('D:\Labor\Projects\Stroke_tDCS_rsfmri\B_rsfmri_stroke_tDCS_mice\results\plot_nodes')
  99. % % nodes = readtable("acronyms_parent_splitted.txt");
  100. % % nodes = cell2mat(table2cell(nodes(:,1)));
  101. %%
  102. for k=1:3
  103. clear ("mask_temp")
  104. t=Tiff(strcat('mask',num2str(k),'.tiff'));
  105. mask=read(t);
  106. % l=Tiff(strcat('lesion_',num2str(k),'.tif'));
  107. % lesion=read(l);
  108. mask_temp=nan(size(mask,1),size(mask,2));
  109. % mask_temp(:,:)=-10;
  110. for l=1:length(nodes)
  111. isda=find(mask==nodes(l));
  112. if ~isempty(isda)
  113. mask_temp(isda)=NodesDelta(l);
  114. end
  115. end
  116. % lesion(lesion==0)=nan;
  117. % lm = imshow(lesion);
  118. % colormap(hot)
  119. figure
  120. clims = [-2 1];
  121. imAlpha=ones(size(mask_temp));
  122. imAlpha(isnan(mask_temp))=0;
  123. im = imagesc(mask_temp,'AlphaData',imAlpha);
  124. colorbar("off")
  125. clim([-2 1])
  126. c=colorbar;
  127. c.TickLabels = '';
  128. colormap('jet')
  129. % set(im, 'AlphaData', ~isnan(mask_temp))
  130. set(gca,'color',0*[1 1 1],'XTickLabel','','YTickLabel','');
  131. % title('PT tDCS')
  132. saveas(gca,strcat('Plot_node_change_tDCS_',num2str(k),'.png'))
  133. end