Skip to content

Commit

Permalink
Adjusted colorbar and a few other things
Browse files Browse the repository at this point in the history
  • Loading branch information
jbteves committed Feb 5, 2019
1 parent 093ac00 commit 1528e39
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 20 deletions.
Binary file added custom_map.mat
Binary file not shown.
50 changes: 30 additions & 20 deletions meica_component_displayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ function meica_component_displayer(tr, savedir)

end

% Custom color map
[path,name,ext] = fileparts(which('meica_component_displayer'));
custom_cmap_loc = fullfile(path,'custom_map.mat');
load(custom_cmap_loc);


%Prepare motion calc and loading.
cfg.motionparam = 'dfile.r01.1D'; %output from MEICA, organized as: roll pitch yaw dS dL dP
Expand Down Expand Up @@ -111,7 +116,7 @@ function meica_component_displayer(tr, savedir)
if Motion
%%Making the motion plots, including framewise displacement

figure('visible', 'off', 'windowstyle', 'normal');
figure('visible', 'on', 'windowstyle', 'normal');
grid on; grid minor;
[fwd,~]=bramila_framewiseDisplacement(cfg); %calculate FD using script

Expand Down Expand Up @@ -151,10 +156,18 @@ function meica_component_displayer(tr, savedir)
fprintf('Making component plots.\n');
count = 0; %for displaying things every so often

figure('visible', 'off', 'windowstyle','normal');
figure('visible', 'on', 'windowstyle','normal');

n_colors = 256;
colormaptype = 'parula';
cmap_fh = str2func(colormaptype);

for i = 1:comp_number;
for i = 1:comp_number
% cmap = cmap_fh(n_colors);
% for v = 1:(n_colors/2)
% cmap(v,:) = [1 1 1];
% end
cmap = custom_map;

if mod(count, 10) == 0
fprintf('.'); %print progress every 10 components, less annoying.
Expand Down Expand Up @@ -197,16 +210,13 @@ function meica_component_displayer(tr, savedir)
[sag_img, cor_img, hor_img] = three_cut_maker(current_image,num_cuts);

subplot(12,5,16:25)
imshow(sag_img,[-bounds bounds])
colormap bone
imshow(sag_img,[-bounds bounds],'Colormap',cmap)

subplot(12,5,26:35)
imshow(cor_img,[-bounds bounds])
colormap bone
imshow(cor_img,[-bounds bounds],'Colormap',cmap)

subplot(12,5,36:45)
imshow(hor_img,[-bounds bounds])
colormap bone
imshow(hor_img,[-bounds bounds],'Colormap',cmap)

%Now adding in the fourier transform.
Fs = 1/tr; % Sampling frequency
Expand All @@ -230,7 +240,7 @@ function meica_component_displayer(tr, savedir)
%%
fprintf('\nCollecting Explained Variance...');

figure('visible', 'off', 'windowstyle','normal');
figure('visible', 'on', 'windowstyle','normal');

BOLD_var = 0;
REJ_var = 0;
Expand Down Expand Up @@ -282,7 +292,7 @@ function meica_component_displayer(tr, savedir)
%%
fprintf('\nShowing Elbow of Kappa, with Rho...');

figure('visible', 'off', 'windowstyle','normal');
figure('visible', 'on', 'windowstyle','normal');
plot(imported_ctab(:,2))
hold on
plot(imported_ctab(:,3))
Expand All @@ -296,7 +306,7 @@ function meica_component_displayer(tr, savedir)
fprintf('\nScattering Kappa vs Rho ');

k_r = horzcat(imported_ctab(:,2),imported_ctab(:,3));
figure('visible', 'off', 'windowstyle','normal');
figure('visible', 'on', 'windowstyle','normal');
scatter(k_r(:,1),k_r(:,2), imported_ctab(:,4)*100, color_table);
title('Kappa vs Rho');
ylabel('Rho');
Expand Down Expand Up @@ -336,7 +346,7 @@ function meica_component_displayer(tr, savedir)

tsnr_range = tsnr_max_MEDN*0.8;

figure('visible', 'off', 'windowstyle','normal');
figure('visible', 'on', 'windowstyle','normal');
subplot(8,5,1:10)
imshow(sag_img,[0 tsnr_range])
title('TSNR of MEDN timeseries');
Expand Down Expand Up @@ -382,7 +392,7 @@ function meica_component_displayer(tr, savedir)

[sag_img, cor_img, hor_img] = three_cut_maker(tsnr_tsoc,num_cuts);

figure('visible', 'off', 'windowstyle','normal');
figure('visible', 'on', 'windowstyle','normal');
subplot(8,5,1:10)
imshow(sag_img,[0 tsnr_range])

Expand Down Expand Up @@ -418,7 +428,7 @@ function meica_component_displayer(tr, savedir)

[sag_img, cor_img, hor_img] = three_cut_maker(tsnr_e2,num_cuts);

figure('visible', 'off', 'windowstyle','normal');
figure('visible', 'on', 'windowstyle','normal');
subplot(8,5,1:10)
imshow(sag_img,[0 tsnr_range])
title('TSNR of Second Echo');
Expand Down Expand Up @@ -451,7 +461,7 @@ function meica_component_displayer(tr, savedir)

[sag_img, cor_img, hor_img] = three_cut_maker(tsnr_ratio,num_cuts);

figure('visible', 'off', 'windowstyle','normal');
figure('visible', 'on', 'windowstyle','normal');
subplot(8,5,1:10)
imshow(sag_img,[0 5])
title('TSNR Ratio, MEDN vs TSOC timeseries');
Expand Down Expand Up @@ -488,7 +498,7 @@ function meica_component_displayer(tr, savedir)

[sag_img, cor_img, hor_img] = three_cut_maker(tsnr_ratio,num_cuts);

figure('visible', 'off', 'windowstyle','normal');
figure('visible', 'on', 'windowstyle','normal');
subplot(8,5,1:10)
imshow(sag_img,[0 5])
title('TSNR of TSOC vs 2nd Echo');
Expand Down Expand Up @@ -521,7 +531,7 @@ function meica_component_displayer(tr, savedir)

[sag_img, cor_img, hor_img] = three_cut_maker(tsnr_ratio,num_cuts);

figure('visible', 'off', 'windowstyle','normal');
figure('visible', 'on', 'windowstyle','normal');
subplot(8,5,1:10)
imshow(sag_img,[0 5])
title('TSNR of MEDN vs 2nd Echo');
Expand Down Expand Up @@ -550,7 +560,7 @@ function meica_component_displayer(tr, savedir)

%Creating a covariance matrix
fprintf('\nPlotting correlations');
figure('visible', 'off', 'windowstyle','normal');
figure('visible', 'on', 'windowstyle','normal');
imagesc(corr_mat, [-1 1]);
title('Correlation of Motion and ICA comps.');
colorbar
Expand All @@ -560,7 +570,7 @@ function meica_component_displayer(tr, savedir)
%%
%Creating R^2 matrix
fprintf('\nPlotting correlations...squared\n');
figure('visible', 'off', 'windowstyle','normal');
figure('visible', 'on', 'windowstyle','normal');
imagesc((corr_mat.^2), [0 1]);
title('Correlation Coefficient of Motion and ICA comps.');
colorbar
Expand Down

0 comments on commit 1528e39

Please sign in to comment.