Mercurial > hg > aimmat
annotate aim-mat/tools/@frame/logcompress.m @ 4:537f939baef0 tip
various bug fixes and changed copyright message
author | Stefan Bleeck <bleeck@gmail.com> |
---|---|
date | Tue, 16 Aug 2011 14:37:17 +0100 |
parents | 74dedb26614d |
children |
rev | line source |
---|---|
tomwalters@0 | 1 % method of class @frame |
tomwalters@0 | 2 % |
tomwalters@0 | 3 % INPUT VALUES: |
tomwalters@0 | 4 % |
tomwalters@0 | 5 % RETURN VALUE: |
tomwalters@0 | 6 % |
tomwalters@0 | 7 % |
tomwalters@0 | 8 % (c) 2003, University of Cambridge, Medical Research Council |
tomwalters@0 | 9 % Stefan Bleeck (stefan@bleeck.de) |
tomwalters@0 | 10 % http://www.mrc-cbu.cam.ac.uk/cnbh/aimmanual |
tomwalters@0 | 11 % $Date: 2003/03/13 14:48:22 $ |
tomwalters@0 | 12 % $Revision: 1.6 $ |
tomwalters@0 | 13 |
tomwalters@0 | 14 function nap=logcompress(nap,options) |
tomwalters@0 | 15 |
tomwalters@0 | 16 %if nargin <2 |
tomwalters@0 | 17 % options.dynamic_range=50; |
tomwalters@0 | 18 %end |
tomwalters@0 | 19 |
tomwalters@0 | 20 nap=halfwayrectify(nap); |
tomwalters@0 | 21 vals=getvalues(nap); |
tomwalters@0 | 22 |
tomwalters@0 | 23 %gtfb output values are: 0< gt_vals <1 |
tomwalters@0 | 24 %therefore we will scale for 16bit values |
tomwalters@0 | 25 %operationally only 15 bits are used as we |
tomwalters@0 | 26 %half wave rectify |
tomwalters@0 | 27 vals=vals.*2.^15; |
tomwalters@0 | 28 |
tomwalters@0 | 29 %avoid log problems by making everything > 1 |
tomwalters@0 | 30 vals(find(vals<1))=1; |
tomwalters@0 | 31 vals=20.*log10(vals); |
tomwalters@0 | 32 |
tomwalters@0 | 33 |
tomwalters@0 | 34 nap=setvalues(nap,vals); |
tomwalters@0 | 35 |