"Fossies" - the Fresh Open Source Software Archive

Member "sip-0.12.1/macros/sip_fftshift.sci" (18 Apr 2012, 1816 Bytes) of package /linux/privat/sip-0.12.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Scilab source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "sip_fftshift.sci": 0.5.6_vs_0.12.1.

    1 function x = sip_fftshift(x,job,fun)
    2 // 
    3 // Swap arrays (used with fft).
    4 // Does the same thing as M4t1ab fftshift.
    5 // Fun argument may be used to change the way the shuffling is done
    6 // with deff('sel=fun(sk)','c=floor(sk/2);sel=[c+1:sk,1:c]')
    7 //
    8 // AUTHOR
    9 //    Ricardo Fabbri, with help from Scilab Group.
   10 //
   11 // $Revision: 1.2 $ $Date: 2009-03-29 21:34:48 $
   12 
   13   warning('This function is deprecated. Use fftshift from Scilab instead.');
   14   warning('This function might be removed in future versions of SIP.');
   15   if argn(2)<2 then job='all',end
   16   if argn(2)<3 then 
   17     deff('sel=fun(sk)','c=ceil(sk/2);sel=[c+1:sk,1:c]')
   18   end
   19   if job=='r' then job=1,elseif job=='c' then job='2',end
   20   ind=list()
   21   if job=='all' then
   22     for sk=size(x),ind($+1)=fun(sk),end
   23   else
   24     for sk=size(x),ind($+1)=:,end;ind(job)=fun(sz(job))
   25   end
   26   x=x(ind(:))
   27 endfunction
   28 
   29 //
   30 // -------------------------------------------------------------------------
   31 // SIP - Scilab Image Processing toolbox
   32 // Copyright (C) 2002-2009  Ricardo Fabbri
   33 //
   34 // This program is free software; you can redistribute it and/or modify
   35 // it under the terms of the GNU General Public License as published by
   36 // the Free Software Foundation; either version 2 of the License, or
   37 // (at your option) any later version.
   38 //
   39 // This program is distributed in the hope that it will be useful,
   40 // but WITHOUT ANY WARRANTY; without even the implied warranty of
   41 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   42 // GNU General Public License for more details.
   43 //
   44 // You should have received a copy of the GNU General Public License
   45 // along with this program; if not, write to the Free Software
   46 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   47 // -------------------------------------------------------------------------
   48 //