0001 function obj = subsasgn(obj, s, rhs)
0002
0003
0004
0005
0006 if nargin < 3
0007 error('Crazy no of args')
0008 end
0009
0010
0011 obj.changef = 1;
0012
0013 switch s(1).type
0014 case '.'
0015
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
0023 obj = builtin('subsasgn',obj ,s , rhs);
0024
0025 case '{}'
0026
0027
0028 error('Cell subscripting not valid for wvimg objects')
0029
0030 case '()'
0031
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