-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrot90m.m
33 lines (28 loc) · 1012 Bytes
/
rot90m.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
function dRotImage = rot90m(dimage)
%%**********************************************************************
%
% function dRotImage = rot270(dimage)
%
% rotates a matrix by 90 deg. matrix dimage can have up to 4 dimension,
% however dimension 1 and 2 will be rotated
%
% INPUT: [unit]
% -----------------------------------------------------------------------
% dimage Image or matrix (up to 4D)
%
% OUTPUT:
% -----------------------------------------------------------------------
% dRotImage rotated image or matrix
%
%%**********************************************************************
ds = size(dimage);
if(length(ds) == 2)
dRotImage = rot90(dimage);
end
if(length(ds) > 2)
for lS = 1:ds(3)
for lM = 1:size(dimage,4)
dRotImage(:,:,lS,lM) = ((rot90(dimage(:,:,lS,lM))));
end
end
end