Home > phiwave > @phiw_wvimg > subsref.m

subsref

PURPOSE ^

SUBSREF Method to overload subscripted references

SYNOPSIS ^

function R = subsref(obj, s)

DESCRIPTION ^

 SUBSREF Method to overload subscripted references

 $Id: subsref.m,v 1.3 2005/06/05 04:37:48 matthewbrett Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function R = subsref(obj, s)
0002 % SUBSREF Method to overload subscripted references
0003 %
0004 % $Id: subsref.m,v 1.3 2005/06/05 04:37:48 matthewbrett Exp $
0005 
0006 if nargin < 2
0007   error('Crazy no of args')
0008 end
0009 
0010 switch s(1).type
0011  case '.'
0012   % dump out if processing is not done
0013   if strcmp(s(1).subs, 'img') & ~isproc(obj)
0014     error('The object is not processed yet')
0015   end
0016   %   Publicize subscripted reference to private fields of object.
0017   R = builtin('subsref', obj, s);
0018  case '{}'
0019   % Cell ref.  Maybe this could return cells full of the indexed
0020   % levels/quadrants, but not for now
0021   error('Cell subscripting not valid for wvimg objects')
0022  case '()'
0023   % bracket ref.
0024   if length(s) > 1
0025     error('Complicated subscripting')
0026   end
0027 
0028   % dump out if processing is not done
0029   if ~isproc(obj)
0030     error('The object is not processed yet')
0031   end
0032 
0033   nsubs = length(s.subs);
0034   if all([s.subs{:}]==':')
0035     R = obj.img;
0036     if nsubs ~= 3
0037       R = R(:);
0038     end
0039     return
0040   elseif nsubs == 3
0041     R = subsref(obj.img,s);
0042     return
0043   end
0044   [blks s.subs sz] = pr_procsubs(obj.wavelet,obj.wvol.dim(1:3),obj.scales, ...
0045                    s.subs);
0046   R = zeros(sum(sz),1);
0047   iR = 1;
0048   for b = 1:length(blks)
0049     e = iR + sz(b);
0050     R(iR:e-1) = subsref(obj.img, phiw_lims('subs', blks{b}));
0051     iR = e;
0052   end
0053 end

Generated on Wed 06-Jul-2005 18:07:21 by m2html © 2003