apply thresholding calculated previously FORMAT [objs] = thresh_apply(objs, th_obj, dndescrip) Inputs objs - wv_img objects to apply thresholding to th_obj - thresholding wv_img object from thresh_calc dndescrip - optional denoising description string Outputs objs - thresholded objects $Id: thresh_apply.m,v 1.3 2005/05/31 00:49:20 matthewbrett Exp $
0001 function [objs] = thresh_apply(objs, th_obj, dndescrip) 0002 % apply thresholding calculated previously 0003 % FORMAT [objs] = thresh_apply(objs, th_obj, dndescrip) 0004 % 0005 % Inputs 0006 % objs - wv_img objects to apply thresholding to 0007 % th_obj - thresholding wv_img object from thresh_calc 0008 % dndescrip - optional denoising description string 0009 % 0010 % Outputs 0011 % objs - thresholded objects 0012 % 0013 % $Id: thresh_apply.m,v 1.3 2005/05/31 00:49:20 matthewbrett Exp $ 0014 0015 if nargin < 2 0016 error('Need objects to threshold and threshold object'); 0017 end 0018 if nargin < 3 0019 dndescrip = []; 0020 end 0021 0022 % get whole thresholding object as image 0023 th_obj = doproc(th_obj); 0024 th_img = th_obj.img; 0025 clear th_obj; 0026 0027 % apply thresholds 0028 for oi = 1:prod(size(objs)) 0029 obj = objs(oi); 0030 obj = doproc(obj); 0031 in_mask = isfinite(obj.img); 0032 obj.img(in_mask) = obj.img(in_mask) .* th_img(in_mask); 0033 obj.descrip = strvcat(obj.descrip, dndescrip); 0034 objs(oi) = obj; 0035 end