%% This script highlights how the figures from the article were generated n_ROI = 299; n_conn = 299*298/2; n_sw_tp = 167; n_subjects = length(TC_MW); % We select three connections of interest that we will compare across % parameters COI = [39,207; 148,207; 207,248]; COI_colors{1} = 1/255*[86,214,114;192,214,116;86,214,192]; COI_colors{2} = 1/255*[255,76,0;255,187,0;251,237,0]; % We will plot the same for the different connections for con = 1:size(COI,1) %% 1. Sampling of the regions of interest and associated connection R1 = COI(con,1); R2 = COI(con,2); M = zeros(n_ROI,n_ROI); M(R1,R2) = 1; Mvec = logical(jUpperTriMatToVec(M)); %% 2. Sampling of the related ISFC time courses for s = 1:n_subjects % W = 10 ROI_ISFC_MW(s,:) = ISFC_MW{s}(Mvec,:); ROI_ISFC_RS(s,:) = ISFC_RS{s}(Mvec,:); % W = 5 ROI_ISFC_MW_W5(s,:) = ISFC_MW_W5{s}(Mvec,:); ROI_ISFC_RS_W5(s,:) = ISFC_RS_W5{s}(Mvec,:); end t_MW = 19:2:352; t_MW_W5 = 9:2:352; t_RS = 404:2:678; t_RS_W5 = 394:2:678; %% 3. Plotting of the ISFC time courses for the movie-watching and % resting-state cases figure; set(gcf,'color','w'); % For W = 10 subplot(2,2,1); hold on; set(gca,'Box','off'); plot(t_MW,ROI_ISFC_MW','LineWidth',0.5,'color',COI_colors{1}(con,:)); hold on; ylim([-0.5 0.5]); xlim([t_MW_W5(1),t_MW_W5(end)]); %plot(t_MW,mean(ROI_ISFC_MW,1),'color','r','LineWidth',2); subplot(2,2,2); hold on; set(gca,'Box','off'); plot(t_RS,ROI_ISFC_RS','LineWidth',0.5,'color',COI_colors{2}(con,:)); hold on; ylim([-0.5 0.5]); xlim([t_RS_W5(1),t_RS_W5(end)]); %plot(t_RS,mean(ROI_ISFC_RS,1),'color','r','LineWidth',2); % For W = 5 subplot(2,2,3); hold on; set(gca,'Box','off'); plot(t_MW_W5,ROI_ISFC_MW_W5','LineWidth',0.5,'color',COI_colors{1}(con,:)); hold on; ylim([-0.5 0.5]); xlim([t_MW_W5(1),t_MW_W5(end)]); %plot(t_MW_W5,mean(ROI_ISFC_MW_W5,1),'color','r','LineWidth',2); subplot(2,2,4); hold on; set(gca,'Box','off'); plot(t_RS_W5,ROI_ISFC_RS_W5','LineWidth',0.5,'color',COI_colors{2}(con,:)); hold on; ylim([-0.5 0.5]); xlim([t_RS_W5(1),t_RS_W5(end)]); %plot(t_RS_W5,mean(ROI_ISFC_RS_W5,1),'color','r','LineWidth',2); %% 4. Plotting of the ISFC excursion time courses Plot_Conn_TimeCourse(SignMat,R1,R2,19,352,2,COI_colors{1}(con,:),COI_colors{1}(con,:)); Plot_Conn_TimeCourse(SignMat_W5,R1,R2,9,352,2,COI_colors{1}(con,:),COI_colors{1}(con,:)); Plot_Conn_TimeCourse(SignMat_alphaverynice,R1,R2,19,352,2,COI_colors{1}(con,:),COI_colors{1}(con,:)); Plot_Conn_TimeCourse(SignMat_alphaverynice_W5,R1,R2,9,352,2,COI_colors{1}(con,:),COI_colors{1}(con,:)); end %% 5. Plotting of the spatial patterns at a salient time point idx_W10 = 19; idx_W5 = 24; Spatial_OI = mean(squeeze(SignMat(:,idx_W10,:)),2); tmp_MAT = jVecToUpperTriMat(Spatial_OI,n_ROI)+jVecToUpperTriMat(Spatial_OI,n_ROI)'; tmp_DEG = sum(abs(tmp_MAT),1)/2; Factor_plots = 2*max(tmp_DEG); PlotBrainGraph_Kmeans_withtitle(tmp_MAT,tmp_DEG,CodeBook,0,... Factor_plots,Factor_plots,2,1,'hot','jet',1,0.5,[-1 1],... ['W10_Alpha5'],'W5_Alpha5'); Spatial_OI = mean(squeeze(SignMat_W5(:,idx_W5,:)),2); tmp_MAT = jVecToUpperTriMat(Spatial_OI,n_ROI)+jVecToUpperTriMat(Spatial_OI,n_ROI)'; tmp_DEG = sum(abs(tmp_MAT),1)/2; PlotBrainGraph_Kmeans_withtitle(tmp_MAT,tmp_DEG,CodeBook,0,... Factor_plots,Factor_plots,2,1,'hot','jet',1,0.5,[-1 1],... ['W5_Alpha5'],['W5_Alpha5']);