%transform LIF images to concentration images %======================================================================= % Copyright 2008-2022, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France % http://www.legi.grenoble-inp.fr % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr % % This file is part of the toolbox UVMAT. % % UVMAT 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 2 of the license, % or (at your option) any later version. % % UVMAT 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 (see LICENSE.txt) for more details. %======================================================================= function [DataOut]=ima2concentration(DataIn,XmlData) %% request input parameters DataOut=[]; if (isfield(DataIn,'Action') && isfield(DataIn.Action,'RUN') && isequal(DataIn.Action.RUN,0)) return end if ~isfield(XmlData,'LIFCalib') msgbox_uvmat('ERROR','no LIF calibration data available, first run LIFCalib in uvmat') return end cpath=which('uvmat'); addpath(fullfile(fileparts(cpath),'transform_field'))% define path for phys_polar.m %% rescale the image [nby,nbx]=size(DataIn.A); x=linspace(DataIn.Coord_x(1),DataIn.Coord_x(2),nbx)-nbx/2; y=linspace(DataIn.Coord_y(1),DataIn.Coord_y(2),nby)-nby/2; [X,Y]=meshgrid(x,y); coeff_quad=0.15*4/(nbx*nbx);% image luminosity reduced by 10% at the edge DataIn.A=double(DataIn.A).*(1+coeff_quad*(X.*X+Y.*Y)); %% Transform images to polar coordinates with origin at the light source position XmlData.TransformInput.PolarCentre=XmlData.LIFCalib.LightOrigin; %position of the laser origin [x, y] DataIn.Action.RUN=1;% avoid input menu in phys_polar DataOut=phys_polar(DataIn,XmlData); [npangle,npr]=size(DataOut.A);%size of the image in polar coordinates dX=(DataOut.Coord_x(2)-DataOut.Coord_x(1))/(npr-1);% radial step %% introduce the reference line where the laser enters the fluid region r_edge=XmlData.LIFCalib.RefLineRadius'*ones(1,npr);% radial position of the reference line extended as a matrix (npx,npy) A_ref=XmlData.LIFCalib.RefLineLum'*ones(1,npr);% luminosity on the reference line extended as a matrix (npx,npy) R=ones(npangle,1)*linspace(DataOut.Coord_x(1), DataOut.Coord_x(2),npr);%radial coordinate extended as a matrix (npx,npy) %gamma_coeff=XmlData.LIFCalib.DecayRate; DataOut.A(R=1 & R<=npx & Theta >=1 & Theta<=npy;%flagin=1 inside the original image vec_A=reshape(DataIn.A,1,npx*npy);%put the original image in line ind_in=find(flagin); ind_out=find(~flagin); ICOMB=((R-1)*npy+(npy+1-Theta)); ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A vec_B(ind_in)=vec_A(ICOMB); vec_B(ind_out)=zeros(size(ind_out)); DataOut.A=flipdim(reshape(vec_B,npy,npx),1);%new image in real coordinates DataOut.Coord_x=RangeX; DataOut.Coord_y=RangeY;