============================================================== AVERAGE_SMOOTH: Calculates, reshapes and blurs discrepancy image. Code written by Katherine Smith (or maybe Stephen), 2003 GENERAL discrepancy_image_1d(data,params) INPUT/S -data: Input images. -params: The parameters describing the transformations. OUTPUT/S -disc: Discrepancy image. PENDING WORK -Add a few more comments to this file. -Find out what each parameters does (see INPUT/S) KNOWN BUG/S - COMMENT/S -This function needs to be understood better. RELATED FUNCTION/S ABOUT -Created: November 23rd, 2003 -Last update: Novermber 25th, 2003 -Revision: 0.0.2 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function [disc] = discrepancy_image_1d(data,params) 0002 % ============================================================== 0003 % AVERAGE_SMOOTH: Calculates, reshapes and blurs discrepancy 0004 % image. 0005 % 0006 % Code written by Katherine Smith (or maybe Stephen), 2003 0007 % 0008 % GENERAL 0009 % 0010 % discrepancy_image_1d(data,params) 0011 % 0012 % INPUT/S 0013 % 0014 % -data: 0015 % Input images. 0016 % 0017 % -params: 0018 % The parameters describing the transformations. 0019 % 0020 % 0021 % OUTPUT/S 0022 % 0023 % -disc: 0024 % Discrepancy image. 0025 % 0026 % PENDING WORK 0027 % 0028 % -Add a few more comments to this file. 0029 % -Find out what each parameters does (see INPUT/S) 0030 % 0031 % KNOWN BUG/S 0032 % 0033 % - 0034 % 0035 % COMMENT/S 0036 % 0037 % -This function needs to be understood better. 0038 % 0039 % RELATED FUNCTION/S 0040 % 0041 % 0042 % 0043 % ABOUT 0044 % 0045 % -Created: November 23rd, 2003 0046 % -Last update: Novermber 25th, 2003 0047 % -Revision: 0.0.2 0048 % -Author: R. S. Schestowitz, University of Manchester 0049 % ============================================================== 0050 0051 if(isfield(data,'q0')) 0052 nknots = size(data.q0,2); 0053 whichvar = [1:nknots]; 0054 whichfix = []; 0055 [dummy, prob_im] = eval_nrr_objective_function(data.q1,[],whichvar,whichfix,data.q0(1,:),data.q0(2,:),data,params); 0056 else 0057 [dummy, prob_im] = eval_nrr_objective_function([],[],[],[],[],[],data,params); 0058 end 0059 0060 % Reshape prob_im 0061 disc = zeros(size(data.ref_image)); 0062 disc((data.roi==1)) = prob_im(:); 0063 0064 % Blur 0065 if(isfield(params,'blur')) 0066 h = ones(round(params.blur)); 0067 disc = filter2(h,disc); 0068 end 0069 0070 % Normalise the image 0071 disc = disc - min(disc(:)); 0072 disc = disc/max(disc(:));