compErrInt : Computes the error of alignment between two fourier transformed images using lamMin and lamMax to calculate the masks INPUT : fftA : fourier transform of image A fftB : fourier transform of image B lamMin : minimum lambda to calculate mask lamMax : maximum lambda to calculate mask OUTPUT : errNum : error value Copyright (C) 2016 Wiggins Lab Written by Paul Wiggins. University of Washington, 2016 This file is part of SuperSegger. SuperSegger is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SuperSegger is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with SuperSegger. If not, see <http://www.gnu.org/licenses/>.
0001 function errNum = compErrInt( fftA, fftB, lamMin, lamMax ) 0002 % compErrInt : Computes the error of alignment between two fourier transformed images 0003 % using lamMin and lamMax to calculate the masks 0004 % 0005 % INPUT : 0006 % fftA : fourier transform of image A 0007 % fftB : fourier transform of image B 0008 % lamMin : minimum lambda to calculate mask 0009 % lamMax : maximum lambda to calculate mask 0010 % OUTPUT : 0011 % errNum : error value 0012 % 0013 % Copyright (C) 2016 Wiggins Lab 0014 % Written by Paul Wiggins. 0015 % University of Washington, 2016 0016 % This file is part of SuperSegger. 0017 % 0018 % SuperSegger is free software: you can redistribute it and/or modify 0019 % it under the terms of the GNU General Public License as published by 0020 % the Free Software Foundation, either version 3 of the License, or 0021 % (at your option) any later version. 0022 % 0023 % SuperSegger is distributed in the hope that it will be useful, 0024 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0026 % GNU General Public License for more details. 0027 % 0028 % You should have received a copy of the GNU General Public License 0029 % along with SuperSegger. If not, see <http://www.gnu.org/licenses/>. 0030 0031 0032 persistent mask; 0033 persistent mask0; 0034 0035 ss = size(fftA); 0036 0037 if isempty(mask) || ~all( size(mask) == ss ) 0038 kx = (1:ss(2))/ss(2); % array of incremental values up to 1 0039 ky = (1:ss(1))/ss(1); 0040 [kX,kY] = meshgrid(kx,ky); 0041 k = sqrt(kX.^2+kY.^2); 0042 mask = and(k<lamMin^-1,k>lamMax^-1); 0043 mask0 = k>lamMax^-1; 0044 end 0045 0046 % mean of the values of the fourier transformed image include in mask 0047 mfftA = mean(abs(fftA(mask))); 0048 mfftB = mean(abs(fftB(mask))); 0049 0050 % mean of the values of the fourier transformed image include in mask0 0051 m0fftA = mean(abs(fftA(mask0))); 0052 m0fftB = mean(abs(fftB(mask0))); 0053 0054 % error calculation 0055 errNum = abs(mfftA-mfftB)/abs(mfftA+mfftB) + abs(m0fftA-m0fftB)/abs(m0fftA+m0fftB); 0056 0057 end