Home > phiwave > @phiw_wvimg > subsasgn.m

subsasgn

PURPOSE ^

SUBSASGN Method to overload subsasgn for phiw_wvimg object

SYNOPSIS ^

function obj = subsasgn(obj, s, rhs)

DESCRIPTION ^

 SUBSASGN  Method to overload subsasgn for phiw_wvimg object

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function obj = subsasgn(obj, s, rhs)
0002 % SUBSASGN  Method to overload subsasgn for phiw_wvimg object
0003 %
0004 % $Id: subsasgn.m,v 1.3 2005/06/05 04:37:15 matthewbrett Exp $
0005 
0006 if nargin < 3
0007   error('Crazy no of args')
0008 end
0009 
0010 % set change flag
0011 obj.changef = 1;
0012 
0013 switch s(1).type
0014  case '.'
0015   % do processing if necessary
0016   if strcmp(s(1).subs, 'img') & length(s)>1 & ~isproc(obj)
0017     if obj.options.verbose
0018       warning('Object not yet processed, processing now')
0019     end
0020     obj = doproc(obj);
0021   end
0022   %   Publicize subscripted reference to private fields of object.
0023  obj = builtin('subsasgn',obj ,s , rhs);
0024 
0025  case '{}'
0026   % Cell ref.  Maybe this could insert cells full of the indexed
0027   % levels/quadrants, but not for now
0028   error('Cell subscripting not valid for wvimg objects')
0029   
0030  case '()'
0031   % bracket ref.
0032   if length(s) > 1
0033     error('Complicated subscripting')
0034   end
0035 
0036   if ~isproc(obj)
0037     if obj.options.verbose
0038       warning('Object not yet processed, processing now')
0039     end
0040     obj = doproc(obj);
0041   end
0042 
0043   nsubs = length(s.subs);
0044   if all([s.subs{:}]==':')
0045     obj.img(:) = rhs(:);
0046     return
0047   end
0048   if nsubs == 3
0049     obj.img = subsasgn(obj.img,s,rhs);
0050     return
0051   end
0052   [blks s.subs sz] = pr_procsubs(obj.wavelet,obj.wvol.dim(1:3),obj.scales, ...
0053                    s.subs);
0054   rhsz = prod(size(rhs));
0055   if rhsz == 1
0056     rhs = zeros(1,sum(sz))+rhs;
0057   elseif rhsz ~= sum(sz)
0058     error('Not enough rhs to fill quadrants');
0059   end
0060   iR = 1;
0061   for b = 1:length(blks)
0062     e = iR + sz(b);
0063     obj.img = subsasgn(obj.img, phiw_lims('subs', blks{b}), ...
0064                reshape(...
0065                rhs(iR:e-1),...
0066                phiw_lims('dims', blks{b})));
0067     iR = e;
0068   end
0069 end

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