Changeset 1072 for trunk/src/uvmat.m


Ignore:
Timestamp:
Jan 17, 2020, 8:13:53 PM (4 years ago)
Author:
sommeria
Message:

LIF updated and bug corrections

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r1071 r1072  
    10071007                data.RangeY=UvData.Field.CoordMesh;
    10081008            case 'plane_z'
     1009                data.Type='plane';
     1010                if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
     1011                    data.RangeY=[UvData.Field.ZMin UvData.Field.ZMax];
     1012                else
     1013                    msgbox_uvmat('ERROR','The input field is not 3D: no vertical plane projection')
     1014                    return
     1015                end
    10091016                data.Angle=[0 90];
    10101017                data.DX=UvData.Field.CoordMesh;
    10111018                data.DY=UvData.Field.CoordMesh;
    1012                 data.RangeZ=UvData.Field.CoordMesh;
     1019                data.RangeZ=UvData.Field.CoordMesh;     
    10131020                data.Coord=[];
    10141021            otherwise
     
    10211028    end
    10221029end
    1023 
     1030hset_object=findobj(allchild(0),'Tag','set_object');
     1031if ~isempty(hset_object)
     1032    delete(hset_object)%delete existing GUI set_object
     1033end
    10241034hset_object=set_object(data,handles);% call the GUI set_object
    10251035hchild=get(hset_object,'children');
     
    14381448end
    14391449if numel(find(select_line))<2
    1440     msgbox_uvmat('ERROR',{'light rays must be defined by at least two lines created by Projection object/line in the menu bar'; ...
    1441     'use a third line to get a reference luminosity profile accross the illumination beam'});
     1450    msgbox_uvmat('ERROR',{'lines must be defined by Projection object in the upper menu bar: ';'1-two lines following the illumination rays'; ...
     1451    '2-a reference line near the fluid boundary receiving the illumination beam';'a mask polygon to select the area in which the exponential decay is fitted'});
    14421452    return
    14431453else
     
    14571467    blackoffset=XmlData.LIFCalib.BlackOffset ;% image value for black background, to be determined by taking images with a cover on the objective lens
    14581468end
    1459 answer=msgbox_uvmat('INPUT_TXT','camera offset value in the absence of illumination:', num2str(blackoffset));
     1469
     1470prompt = {'offset luminosity value in the absence of illumination';'smoothing length for the reference line (in pixels)'};
     1471    dlg_title = 'set the parameters for LIF';
     1472    num_lines= 2;
     1473    def     = { '0';'20'};
     1474    answer = inputdlg(prompt,dlg_title,num_lines,def);
     1475
    14601476if strcmp(answer,'Cancel')
    14611477    return
    14621478else
    1463     XmlData.LIFCalib.BlackOffset=str2num(answer) ;% image value for black background, to be determined by taking images with a cover on the objective lens
     1479    XmlData.LIFCalib.BlackOffset=str2num(answer{1}) ;% image value for black background, to be determined by taking images with a cover on the objective lens
     1480    XmlData.LIFCalib.SmoothingLength=str2num(answer{2}) ;% smoothing length used for the reference line
    14641481end
    14651482
     
    14911508
    14921509%% use the third line for reference luminosity, renormalize the image intensity along each ray to get a uniform brightness along this line
     1510%UvData.Field.CoordMesh
    14931511if numel(find(select_line))==3
    14941512    x_ref=linspace(LineData{3}.Coord(1,1),LineData{3}.Coord(2,1),10);
     
    15081526    line_nan= isnan(dist_source);
    15091527    dist_source_pixel(line_nan)=1;
    1510     width=20; %number of pixels used for reference
     1528    width=XmlData.LIFCalib.SmoothingLength; %number of pixels used for reference
    15111529    DataPol.A=double(DataPol.A)-XmlData.LIFCalib.BlackOffset;% black background substracted
    15121530    Anorm=zeros(size(DataPol.A));
     
    15161534    end
    15171535    lum(line_nan)=NaN;
     1536    XmlData.LIFCalib.RefLineAzimuth=DataPol.Coord_y;
     1537    XmlData.LIFCalib.RefLineRadius=dist_source;
     1538    XmlData.LIFCalib.RefLineLum=lum;
    15181539    figure(11)
    15191540    plot(1:size(DataPol.A,1),lum)
     
    15541575    [XLine,YLine] = pol2cart(ThetaLine,RLine);
    15551576    XLine=XLine+x0;
    1556     YLine=YLine+y0; 
     1577    YLine=YLine+y0;
    15571578    if ~isempty(index_mask)
    15581579        ind_good=inpolygon(XLine,YLine,MaskData.Coord(:,1),MaskData.Coord(:,2));
    15591580        if numel(find(ind_good))>100
    1560         ALine=ALine(ind_good);
    1561         RLine=RLine(ind_good);
     1581            ALine=ALine(ind_good);
     1582            RLine=RLine(ind_good);
    15621583        else
    15631584            continue
     
    15651586    end
    15661587    p = polyfit(RLine,ALine,1);
    1567         gamma_coeff(iY)=-p(1);
     1588    gamma_coeff(iY)=-p(1);
    15681589end
    15691590
     
    15781599ylabel('decay coeff(m-1)')
    15791600
     1601%% keep the average of gamma_coeff
     1602XmlData.LIFCalib.DecayRate=mean(gamma_coeff(gamma_coeff>0));
     1603
    15801604%% record the calibration data in the xml file
    15811605XmlFileName=find_imadoc(get(handles.RootPath,'String'),get(handles.SubDir,'String'),get(handles.RootFile,'String'),get(handles.FileExt,'String'));
    1582 answer=msgbox_uvmat('INPUT_Y-N','save the illumination origin in the current xml file?');
     1606answer=msgbox_uvmat('INPUT_Y-N','save the LIF parameters in the current xml file?');
    15831607if strcmp(answer,'Yes')
    15841608    t=xmltree(XmlFileName); %read the file
     
    16051629    end
    16061630    uid_origin=find(t,'ImaDoc/LIFCalib/LightOrigin');
    1607     if ~isempty(uid_origin)  %if GeometryCalib does not already exists, create it
    1608          t=delete(t,uid_origin);
     1631    if ~isempty(uid_origin)  %if LightOrigin already exists, delete it
     1632        t=delete(t,uid_origin);
    16091633    end
    16101634    uid_line=find(t,'ImaDoc/LIFCalib/Ray1Coord');
    1611     if ~isempty(uid_line)  %if GeometryCalib does not already exists, create it
    1612          t=delete(t,uid_line);
    1613     end
    1614        uid_line=find(t,'ImaDoc/LIFCalib/Ray2Coord');
    1615     if ~isempty(uid_line)  %if GeometryCalib does not already exists, create it
    1616          t=delete(t,uid_line);
    1617     end
    1618        uid_mask=find(t,'ImaDoc/LIFCalib/MaskPolygonCoord');
    1619     if ~isempty(uid_mask)  %if GeometryCalib does not already exists, create it
    1620          t=delete(t,uid_mask);
    1621     end
    1622      uid_BlackOffset=find(t,'ImaDoc/LIFCalib/BlackOffset');
    1623     if ~isempty(uid_BlackOffset)  %if GeometryCalib does not already exists, create it
    1624          t=delete(t,uid_BlackOffset);
    1625     end
     1635    if ~isempty(uid_line)  %if Ray1Coord already exists, delete it
     1636        t=delete(t,uid_line);
     1637    end
     1638    uid_line=find(t,'ImaDoc/LIFCalib/Ray2Coord');
     1639    if ~isempty(uid_line)  %if Ray2Coord already exists, delete it
     1640        t=delete(t,uid_line);
     1641    end
     1642    uid_line=find(t,'ImaDoc/LIFCalib/RefLineCoord');
     1643    if ~isempty(uid_line)  %if RefLineCoord already exists, delete it
     1644        t=delete(t,uid_line);
     1645    end
     1646    uid_mask=find(t,'ImaDoc/LIFCalib/MaskPolygonCoord');
     1647    if ~isempty(uid_mask) %if MaskPolygonCoord already exists, delete it
     1648        t=delete(t,uid_mask);
     1649    end
     1650    uid_BlackOffset=find(t,'ImaDoc/LIFCalib/BlackOffset');
     1651    if ~isempty(uid_BlackOffset)  %if BlackOffset already exists, delete it
     1652        t=delete(t,uid_BlackOffset);
     1653    end
     1654    uid_DecayRate=find(t,'ImaDoc/LIFCalib/DecayRate');
     1655    if ~isempty(uid_DecayRate)  %if DecayRate already exists, delete it
     1656        t=delete(t,uid_DecayRate);
     1657    end
     1658    uid_RefLineRadius=find(t,'ImaDoc/LIFCalib/RefLineRadius');
     1659    if ~isempty(uid_RefLineRadius)  %if RefLineLum already exists, delete it
     1660        t=delete(t,uid_RefLineRadius);
     1661    end
     1662    uid_RefLineLum=find(t,'ImaDoc/LIFCalib/RefLineLum');
     1663    if ~isempty(uid_RefLineLum)  %if RefLineLum already exists, delete it
     1664        t=delete(t,uid_RefLineLum);
     1665    end
     1666    uid_RefLineAzimuth=find(t,'ImaDoc/LIFCalib/RefLineAzimuth');
     1667    if ~isempty(uid_RefLineAzimuth)  %if RefLineLum already exists, delete it
     1668        t=delete(t,uid_RefLineAzimuth);
     1669    end
     1670   
    16261671    % save the LIF calibration data
    16271672    t=struct2xml(XmlData.LIFCalib,t,uid_illumination);
    16281673    save(t,XmlFileName);
    1629 end
    1630 
    1631 
    1632 
    1633 
     1674   
     1675    % display the concentration in uvmat
     1676    InputFileREFRESH_Callback(hObject, eventdata, handles);% refresh the current xml file to apply 'ima2concentration'
     1677    transform_list=get(handles.TransformName,'String');
     1678    ichoice=find(strcmp('ima2concentration',transform_list),1);%look for the selected fct in the existing menu
     1679    if isempty(ichoice)% if the item is not found, add it to the menu (before 'more...' and select it)
     1680        transform_list=transform_list(1:end-1);
     1681        ichoice=numel(transform_list)-1;
     1682    end
     1683    set(handles.TransformName,'Value',ichoice)
     1684    TransformName_Callback(hObject, eventdata, handles)
     1685end
    16341686
    16351687
     
    31493201    set(handles.Dt_txt,'String','')% the time interval indication is suppressed
    31503202    return
    3151 end
    3152 
    3153 %% check the input file indexing:
    3154 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
    3155 NomType=get(handles.NomType,'String');
    3156 if ~isempty(find(regexp(NomType,'-')))
    3157     msgbox_uvmat('ERROR','The movie pair requires file series with a single index on the first input line')
    3158     return
    3159 end
    3160 filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line)
    3161 
    3162 set(handles.movie_pair,'BusyAction','queue')%
    3163 set(handles.CheckFixPair,'Value',1)% impose fixed pair (needed for function runpm)
    3164 set(handles.REFRESH,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity
    3165 set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity
    3166 drawnow
    3167 % list_fields=get(handles.FieldName,'String');% list menu fields
    3168 % index_fields=get(handles.FieldName,'Value');% selected string index
    3169 % FieldName=list_fields{index_fields}; % selected field
    3170 
    3171 
    3172 % if isequal(FieldName,'image')
    3173 %     index=1;
    3174 
    3175 % else
    3176 %     list_fields=get(handles.FieldName_1,'String');% list menu fields
    3177 %     index_fields=get(handles.FieldName_1,'Value');% selected string index
    3178 %     FieldName=list_fields{index_fields}; % selected field
    3179 %     if isequal(FieldName,'image')
    3180 %         index=2;
    3181 %         [RootPath,SubDir,RootFile,FileIndex_1,Ext,NomType]=read_file_boxes_1(handles);% get info from the second input line
    3182 %     else
    3183 %         msgbox_uvmat('ERROR','an image or movie must be first introduced as input')
    3184 %         set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
    3185 %         set(handles.movie_pair,'Value',0)
    3186 %         return
    3187 %     end
    3188 % end
    3189 num_i1=str2num(get(handles.i1,'String'));
    3190 num_j1=stra2num(get(handles.j1,'String'));
    3191 num_i2=str2num(get(handles.i2,'String'));
    3192 num_j2=stra2num(get(handles.j2,'String'));
    3193 
    3194 %% determine the name 'imaname_1' of the second file in the pair
    3195 imaname_1='';
    3196 if isempty(num_j2)% no second j index indicated
    3197     if isempty(num_i2)
    3198         if strcmp(get(handles.j2,'Visible'),'on') %if the j box is visible
    3199             imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i1,[],num_j1+1);
    3200         end
    3201         if exist(imaname_1,'file')
    3202             num_j2=num_j1+1;% look by default for the next j index as the second file
    3203             set(handles.j2,'String',num2stra(num_j2,NomType));
    3204         else
    3205             imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i1+1,[],num_j1);
    3206             if exist(imaname_1,'file')
    3207                 num_i2=num_i1+1;
    3208                 set(handles.i2,'String',num2str(num_i2));
    3209             else
    3210                 msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie')
    3211                 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
    3212                 set(handles.movie_pair,'Value',0)
    3213                 return
    3214             end
    3215         end
    3216     else
    3217         num_j2=num_j1;%repeat the index i1 by default
    3218     end
    3219 end
    3220 if isempty(num_i2)
    3221     num_i2=num_i1;%repeat the index i1 by default
    3222 end
    3223 if isempty(num_j1)
    3224     num_j1=1;
    3225 end
    3226 if isempty(num_j2)
    3227     num_j2=num_j1;%repeat the index i1 by default
    3228 end
    3229 imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i2,[],num_j2);
    3230 if strcmp(NomType,'*')
    3231     num_frame=num_i2;
    3232 else
    3233     num_frame=num_j2;
    3234 end
    3235 if ~exist(imaname_1,'file')
    3236       msgbox_uvmat('ERROR',['second input open (-)  ' imaname_1 ' not found']);
    3237       set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
    3238        set(handles.movie_pair,'Value',0)
    3239       return
    3240 end
    3241 
    3242 %% display the first field in the pair (including possibly a background field from second line input filename_1)
    3243 filename_1='';%default
    3244 FileIndex_1='';
    3245 if get(handles.SubField,'Value')
    3246     [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles);
    3247     filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1];
    3248 end
    3249 % num_i1=stra2num(get(handles.i1,'String'));
    3250 % num_i2=stra2num(get(handles.i2,'String'));
    3251 % num_j1=stra2num(get(handles.j1,'String'));
    3252 % num_j2=stra2num(get(handles.j2,'String'));
    3253 [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndex_1);% get the indices of the second series from the string FileIndex_1
    3254 if isempty(j1_1)% case of movies, the index is not given by file index
    3255     j1_1=num_j1;
    3256 end
    3257 
    3258 errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1);
    3259 
    3260 if isempty(errormsg)
    3261     set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red, update successfull
    3262 else
    3263      msgbox_uvmat('ERROR',errormsg);
    3264      set(handles.REFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull
    3265 end
    3266 UvData=get(handles.uvmat,'UserData');
    3267 Field_a=UvData.Field;% movie on the field defined by the second input line
    3268 
    3269 %% display time interval for the image pair
    3270 if isfield(UvData,'XmlData')&&isfield(UvData.XmlData{1},'Time')...
    3271         && size(UvData.XmlData{1}.Time,1)>=num_i2+1 && size(UvData.XmlData{1}.Time,2)>=num_j2+1
    3272     dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1));
    3273     if  isfield(UvData,'TimeUnit')
    3274         set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  m' UvData.TimeUnit] )
    3275     else
    3276         set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  10^(-3)'] )
    3277     end
    3278 else
    3279     set(handles.Dt_txt,'String','')
    3280 end
    3281 
    3282 %% read the second field
    3283 if isempty(UvData.MovieObject)
    3284     [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileInfo{index}.FileType,[],num_frame);
    3285 else
    3286     [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileInfo{1}.FileType,UvData.MovieObject{1},num_frame);
    3287 end
    3288 if ~isempty(errormsg)
    3289     msgbox_uvmat('ERROR',['Error in reading second image: ' errormsg])
    3290     return
    3291 end
    3292 
    3293 %% apply phys or other transform on the two input fields
    3294 transform=get(handles.TransformPath,'UserData');
    3295 if  ~isempty(transform)
    3296     if isfield(UvData,'XmlData') && ~isempty(UvData.XmlData) %use geometry calib recorded from the ImaDoc xml file as first priority
    3297         if nargin(transform)>=2
    3298             Field_b=transform(Field_b,UvData.XmlData{1});
    3299         else
    3300             Field_b=transform(Field_b);
    3301         end
    3302     end
     3203else
     3204    set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow
     3205    drawnow
     3206end
     3207
     3208increment=str2double(get(handles.num_IndexIncrement,'String')); %get the field increment d
     3209if isnan(increment)% case of free increment: move to next available field index
     3210    increment='+';
    33033211end
    33043212
     
    33083216set(handles.speed,'Visible','on')
    33093217set(handles.speed_txt,'Visible','on')
     3218set(handles.movie_pair,'BusyAction','queue')
    33103219while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue') % enable STOP command
    33113220    % read and plot the series of images in non erase mode
    3312     set(hima,'CData',Field_b.A); %TODO: generalise to other kinds of fields
     3221    errormsg=runpm(hObject,eventdata,handles,increment);
     3222    if ~isempty(errormsg)
     3223        msgbox_uvmat('ERROR',errormsg);
     3224    end
     3225   
     3226    %     set(hima,'CData',Field_b.A); %TODO: generalise to other kinds of fields
    33133227    pause(1.02-get(handles.speed,'Value'));% wait for next image
    3314     set(hima,'CData',Field_a.A);
     3228    errormsg=runpm(hObject,eventdata,handles,-increment);
     3229   
     3230    %     set(hima,'CData',Field_a.A);
    33153231    pause(1.02-get(handles.speed,'Value'));% wait for next image
    33163232end
     
    33183234set(handles.movie_pair,'Value',0)
    33193235set(handles.Dt_txt,'String','')
     3236
     3237
     3238
     3239
     3240set(handles.runplus,'BackgroundColor',[1 0 0])%paint the command button back in red
     3241
     3242%
     3243% set(handles.runmin,'BackgroundColor',[1 1 0])%paint the command button in yellow
     3244% drawnow
     3245% increment=-str2double(get(handles.num_IndexIncrement,'String')); %get the field increment d
     3246% if isnan(increment)% case of free increment: move to previous available field index
     3247%     increment='-';
     3248% end
     3249% errormsg=runpm(hObject,eventdata,handles,increment);
     3250% if ~isempty(errormsg)
     3251%     msgbox_uvmat('ERROR',errormsg);
     3252% end
     3253% set(handles.runmin,'BackgroundColor',[1 0 0])%paint the command button back in red
     3254%
     3255% %% check the input file indexing:
     3256% [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
     3257% NomType=get(handles.NomType,'String');
     3258% if ~isempty(find(regexp(NomType,'-')))
     3259%     msgbox_uvmat('ERROR','The movie pair requires file series with a single index on the first input line')
     3260%     return
     3261% end
     3262% filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line)
     3263%
     3264% set(handles.movie_pair,'BusyAction','queue')%
     3265% set(handles.CheckFixPair,'Value',1)% impose fixed pair (needed for function runpm)
     3266% set(handles.REFRESH,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity
     3267% set(handles.movie_pair,'BackgroundColor',[1 1 0])%paint the command button in yellow to indicate its activity
     3268% drawnow
     3269%
     3270% num_i1=str2num(get(handles.i1,'String'));
     3271% num_j1=stra2num(get(handles.j1,'String'));
     3272% num_i2=str2num(get(handles.i2,'String'));
     3273% num_j2=stra2num(get(handles.j2,'String'));
     3274%
     3275% %% determine the name 'imaname_1' of the second file in the pair
     3276% imaname_1='';
     3277% if isempty(num_j2)% no second j index indicated
     3278%     if isempty(num_i2)
     3279%         if strcmp(get(handles.j2,'Visible'),'on') %if the j box is visible
     3280%             imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i1,[],num_j1+1);
     3281%         end
     3282%         if exist(imaname_1,'file')
     3283%             num_j2=num_j1+1;% look by default for the next j index as the second file
     3284%             set(handles.j2,'String',num2stra(num_j2,NomType));
     3285%         else
     3286%             imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i1+1,[],num_j1);
     3287%             if exist(imaname_1,'file')
     3288%                 num_i2=num_i1+1;
     3289%                 set(handles.i2,'String',num2str(num_i2));
     3290%             else
     3291%                 msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie')
     3292%                 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
     3293%                 set(handles.movie_pair,'Value',0)
     3294%                 return
     3295%             end
     3296%         end
     3297%     else
     3298%         num_j2=num_j1;%repeat the index i1 by default
     3299%     end
     3300% end
     3301% if isempty(num_i2)
     3302%     num_i2=num_i1;%repeat the index i1 by default
     3303% end
     3304% if isempty(num_j1)
     3305%     num_j1=1;
     3306% end
     3307% if isempty(num_j2)
     3308%     num_j2=num_j1;%repeat the index i1 by default
     3309% end
     3310% imaname_1=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,num_i2,[],num_j2);
     3311% if strcmp(NomType,'*')
     3312%     num_frame=num_i2;
     3313% else
     3314%     num_frame=num_j2;
     3315% end
     3316% if ~exist(imaname_1,'file')
     3317%       msgbox_uvmat('ERROR',['second input open (-)  ' imaname_1 ' not found']);
     3318%       set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
     3319%        set(handles.movie_pair,'Value',0)
     3320%       return
     3321% end
     3322%
     3323% %% display the first field in the pair (including possibly a background field from second line input filename_1)
     3324% filename_1='';%default
     3325% FileIndex_1='';
     3326% if get(handles.SubField,'Value')
     3327%     [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles);
     3328%     filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1];
     3329% end
     3330% [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndex_1);% get the indices of the second series from the string FileIndex_1
     3331% if isempty(j1_1)% case of movies, the index is not given by file index
     3332%     j1_1=num_j1;
     3333% end
     3334%
     3335% errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1);
     3336%
     3337% if isempty(errormsg)
     3338%     set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red, update successfull
     3339% else
     3340%      msgbox_uvmat('ERROR',errormsg);
     3341%      set(handles.REFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull
     3342% end
     3343% UvData=get(handles.uvmat,'UserData');
     3344% Field_a=UvData.Field;% movie on the field defined by the second input line
     3345%
     3346% %% display time interval for the image pair
     3347% if isfield(UvData,'XmlData')&&isfield(UvData.XmlData{1},'Time')...
     3348%         && size(UvData.XmlData{1}.Time,1)>=num_i2+1 && size(UvData.XmlData{1}.Time,2)>=num_j2+1
     3349%     dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1));
     3350%     if  isfield(UvData,'TimeUnit')
     3351%         set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  m' UvData.TimeUnit] )
     3352%     else
     3353%         set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) '  10^(-3)'] )
     3354%     end
     3355% else
     3356%     set(handles.Dt_txt,'String','')
     3357% end
     3358%
     3359% %% read the second field
     3360% if isempty(UvData.MovieObject)
     3361%     [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileInfo{index}.FileType,[],num_frame);
     3362% else
     3363%     [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileInfo{1}.FileType,UvData.MovieObject{1},num_frame);
     3364% end
     3365% if ~isempty(errormsg)
     3366%     msgbox_uvmat('ERROR',['Error in reading second image: ' errormsg])
     3367%     return
     3368% end
     3369%
     3370% %% apply phys or other transform on the two input fields
     3371% transform=get(handles.TransformPath,'UserData');
     3372% if  ~isempty(transform)
     3373%     if isfield(UvData,'XmlData') && ~isempty(UvData.XmlData) %use geometry calib recorded from the ImaDoc xml file as first priority
     3374%         if nargin(transform)>=2
     3375%             Field_b=transform(Field_b,UvData.XmlData{1});
     3376%         else
     3377%             Field_b=transform(Field_b);
     3378%         end
     3379%     end
     3380% end
     3381%
     3382% %% make movie until movie speed is set to 0 or STOP is activated
     3383% hima=findobj(handles.PlotAxes,'Tag','ima');% %handles.PlotAxes =main plotting window (A GENERALISER)
     3384% set(handles.STOP,'Visible','on')
     3385% set(handles.speed,'Visible','on')
     3386% set(handles.speed_txt,'Visible','on')
     3387% while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue') % enable STOP command
     3388%     % read and plot the series of images in non erase mode
     3389%     set(hima,'CData',Field_b.A); %TODO: generalise to other kinds of fields
     3390%     pause(1.02-get(handles.speed,'Value'));% wait for next image
     3391%     set(hima,'CData',Field_a.A);
     3392%     pause(1.02-get(handles.speed,'Value'));% wait for next image
     3393% end
     3394% set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
     3395% set(handles.movie_pair,'Value',0)
     3396% set(handles.Dt_txt,'String','')
    33203397
    33213398%------------------------------------------------------------------------
     
    59256002        set(hhset_object.SAVE,'Enable','on')
    59266003    end
     6004else
     6005    delete(hset_object)
    59276006end
    59286007
Note: See TracChangeset for help on using the changeset viewer.