source: trunk/loci/visbio/reverse.m @ 485

Revision 485, 982 bytes checked in by curtis, 15 years ago (diff)

Move M files to main VisBio folder; update version number and what's new.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1function [result] = reverse(pix, params)
2%reverse is a function that reverses the order of the input planes
3%
4%  pix    - a 3D array of pixels dimensioned (Y, X, N)
5%  params - not used
6%
7%For example, an RGB image would be passed in with R at (:,:,1), G at (:,:,2)
8%and B at (:,:,3). The reverse function returns a 3D array with the same
9%dimensions, but ordered BGR -- B at (:,:,1), G at (:,:,2) and R at (:,:,3).
10
11if size(pix, 1) == 0
12  if size(params, 1) == 0
13    % return parameter list with default values
14    % (no parameters for reverse)
15    result = {};
16  else
17    % input dimensions must be prepended to parameter list
18    leny = params(1);
19    lenx = params(2);
20    num = params(3);
21
22    % return output image dimensions for the given
23    % input dimensions and parameter values
24    result = [leny lenx num];
25  end
26else
27  % process pixels
28  leny = size(pix, 1);
29  lenx = size(pix, 2);
30  num = size(pix, 3);
31  for n = 1:num
32    result(:,:,num-n+1) = pix(:,:,n);
33  end
34end
Note: See TracBrowser for help on using the repository browser.