%% Code summary % Fluence Parameter Estimation (GPU version) % To investigate computation time % Input files: 'multiWavParam.mat','multiWavData.mat' % - 'param' contains all parameters for system, data and recon % - 'totalImg' contains beamformed image(data) % - image size: 1024 x 128 x 20 x 1 x 10 % - (axial samples x channals x sources x frames x wavelengths) % MinWoo Kim % 04/02/2020 clear all disp('** Start !! **'); %% load data disp('-Load data'); load('multiWavParam.mat'); % parameters load('multiWavData.mat'); % test data %% local parameters disp('-- parameter setting'); sourcInx = param.Core.sourcInx; % Full source indices ax = param.Core.laser_wav; % Spectrum wavelengh [nm] fiberAmp = param.Core.fiberAmp; % laser source power lb = param.Core.lb; % searching boundary ub = param.Core.ub; % searching boundary ROIz = param.Core.ROIz; % region of interest ROIx = param.Core.ROIx; % region of interest min_thres = param.Core.min_thres; % threshold to pick up pixels max_thres = param.Core.max_thres; % threshold to pick up pixels [zPNum,xPNum,scNum,FrNum,WvNum] = size(totalImg); % data size laSourPo = param.Core.laSourPo; % laser source position alpha = param.Core.alpha; % laser source angle [radian] xOrg = param.PData(2).Origin(1); % image origin [lambda] zOrg = param.PData(2).Origin(3); % image origin [lambda] pdeltaX = param.PData(2).PDelta(1); % image resolution [lambda] pdeltaZ = param.PData(2).PDelta(3); % image resolution [lambda] lambda = param.Core.lambda; % wavelength ninx = param.Core.sourcEffInx; % effective source indices scNum2 = length(ninx); %effective source number pL = 1; % axial average number uasBinNum = 100; % searching bin ueffBinNum = 100; % searching bin totBinNum = uasBinNum*ueffBinNum; % searching bin %% Noise correction disp('-- Noise correction'); refImg = totalImg(:,:,:,:,1); weiImg = ones(zPNum,xPNum); windMat = ones(100,30); refImg = convn(refImg,windMat,'same'); weiImg = repmat(convn(weiImg,windMat,'same'),[1,1,scNum]); refImg = refImg./weiImg; totalImg = totalImg(:,:,:,:,2:end)-repmat(refImg,[1,1,1,1,WvNum-1]); WvNum = WvNum-1; %% Selection of pixels for estimation disp('-- Pixel selection & duplication & alignment'); % selection aveImg = squeeze(mean(mean(mean(totalImg,5),4),3)); tempImg = zeros(size(aveImg)); tempImg(ROIz,ROIx) = aveImg(ROIz,ROIx); aveImg = tempImg; roiInx = find(aveImg>min_thres & aveImg