-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraw_image
More file actions
45 lines (36 loc) · 996 Bytes
/
draw_image
File metadata and controls
45 lines (36 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
clear all;
close all;
clc
slice = 1;
folder = 'path/to/image';
image_file = sprintf('%s/image.nii.gz', folder);
imgnii = load_nii(image_file);
image = imgnii.img;
if slice == 1
display_image = squeeze(image(x,:,:));
elseif slice == 2
display_image = squeeze(image(:,y,:));
else
display_image = squeeze(image(:,:,z));
end
[m,n] = size(display_image);
figure,
imagesc(imrotate(display_image,90),[0 1]), axis image, axis off, colormap hot
set(gcf, 'Position', [100, 100, 2*m,2*n]);
ax = gca;
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) - ti(1) - ti(3);
ax_height = outerpos(4) - ti(2) - ti(4);
left = outerpos(1);
bottom = outerpos(2);
ax_width = outerpos(3);
ax_height = outerpos(4);
ax.Position = [left bottom ax_width, ax_height];
fig=gcf;
fig.PaperPositionMode = 'auto';
fig_pos = fig.PaperPosition;
fig.PaperSize=[fig_pos(3) fig_pos(4)];
print(sprintf('heat_image_%g', slice), '-dpng');