forked from sharktank-bic/qMTLab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshowMontage.m
43 lines (41 loc) · 1.01 KB
/
showMontage.m
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
function [figH,m,cbH] = showMontage(imVol, slices, cmap, crop, numCols, figNum, flip)
%
% [figH,m,cbH] = showMontage(imVol, [slices=[]], [cmap=gray(256)], [crop=[]], [numCols=[]], figNum=figure, [flip='none'])
%
% flip options are 'none', 'axial'
%
% HISTORY:
% 2007.02.22 RFD wrote it.
if(~exist('slices','var') || isempty(slices))
slices = [];
end
if(~exist('cmap','var') || isempty(cmap))
cmap = gray(256);
end
if(exist('crop','var') && ~isempty(crop))
newSz = [diff(crop')+1 size(imVol,3)];
imVol = imVol(crop(1,1):crop(1,2),:,:);
imVol = imVol(:,crop(2,1):crop(2,2),:);
end
if(~exist('numCols','var'))
numCols = [];
end
if(~exist('figNum','var'))
% figH = figure;
else
% figH = figure(figNum);
end
if(~exist('flip','var') || isempty(flip))
flip = 'none';
end
if(strcmpi(flip(1),'a'))
imVol = flipdim(permute(imVol,[2 1 3 4]),1);
end
colormap(cmap);
m = makeMontage(imVol,slices,[],numCols);
imagesc(m);
axis image;
cbH = colorbar;
if(nargout<2) clear m; end
if(nargout<1) clear figH; end
return;