Changeset 384


Ignore:
Timestamp:
Mar 11, 2012, 11:47:21 AM (13 years ago)
Author:
sommeria
Message:

pb with masks corrected
bug in fileparts_uvmat corrected
find_file_series corrected so that it finds the root name corresponding tothe existing xml file : for instance Dalsa1_0001 gives root=Dalsa1 instead of Dalsa
bug corrected in uvmat, runpm (j1 and j2 set to 1 when not visible)

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r382 r384  
    2323%TODO: search range
    2424
    25 % Last Modified by GUIDE v2.5 27-Jan-2012 00:32:33
     25% Last Modified by GUIDE v2.5 10-Mar-2012 22:32:10
    2626% Begin initialization code - DO NOT EDIT
    2727gui_Singleton = 1;
     
    281281end
    282282set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished
     283
    283284%------------------------------------------------------------------------
    284285% --- general function activated for an input file series
     
    10351036%could be included in get_mask callback ?
    10361037if isequal(get(handles.CheckMask,'Value'),1)
    1037     maskname=get(handles.txt_Mask,'String');
     1038    maskname=get(handles.Mask,'String');
    10381039    if ~exist(maskname,'file')
    10391040        get_mask_civ1_Callback(hObject, eventdata, handles);
     
    10411042end
    10421043if isequal(get(handles.CheckMask,'Value'),1)
    1043     maskname=get(handles.txt_Mask,'String');
     1044    maskname=get(handles.Mask,'String');
    10441045    if ~exist(maskname,'file')
    10451046        get_mask_fix1_Callback(hObject, eventdata, handles);
     
    10471048end
    10481049if isequal(get(handles.CheckMask,'Value'),1)
    1049     maskname=get(handles.txt_Mask,'String');
     1050    maskname=get(handles.Mask,'String');
    10501051    if ~exist(maskname,'file')
    10511052        get_mask_civ2_Callback(hObject, eventdata, handles);
     
    10531054end
    10541055if isequal(get(handles.CheckMask,'Value'),1)
    1055     maskname=get(handles.txt_Mask,'String');
     1056    maskname=get(handles.Mask,'String');
    10561057    if ~exist(maskname,'file')
    10571058        get_mask_fix2_Callback(hObject, eventdata, handles);
     
    33103311maskval=get(handles.CheckMask,'Value');
    33113312if isequal(maskval,0)
    3312     set(handles.txt_Mask,'String','')
     3313    set(handles.Mask,'String','')
    33133314else
    33143315    mask_displ='no mask'; %default
     
    33433344        set(handles.CheckMask,'Value',1)
    33443345    end
    3345     set(handles.txt_Mask,'String',mask_displ)
    3346     set(handles.txt_Mask,'String',mask_displ)
    3347     set(handles.txt_Mask,'String',mask_displ)
     3346    set(handles.Mask,'String',mask_displ)
     3347    set(handles.Mask,'String',mask_displ)
     3348    set(handles.Mask,'String',mask_displ)
    33483349end
    33493350
     
    33543355maskval=get(handles.CheckMask,'Value');
    33553356if isequal(maskval,0)
    3356     set(handles.txt_Mask,'String','')
     3357    set(handles.Mask,'String','')
    33573358else
    33583359    mask_displ='no mask'; %default
     
    33853386        set(handles.CheckMask,'Value',1)
    33863387    end
    3387     set(handles.txt_Mask,'String',mask_displ)
    3388     set(handles.txt_Mask,'String',mask_displ)
     3388    set(handles.Mask,'String',mask_displ)
     3389    set(handles.Mask,'String',mask_displ)
    33893390end
    33903391
     
    33953396maskval=get(handles.CheckMask,'Value');
    33963397if isequal(maskval,0)
    3397     set(handles.txt_Mask,'String','')
     3398    set(handles.Mask,'String','')
    33983399else
    33993400    mask_displ='no mask'; %default
     
    34233424        set(handles.CheckMask,'Value',0)
    34243425    end
    3425     set(handles.txt_Mask,'String',mask_displ)
     3426    set(handles.Mask,'String',mask_displ)
    34263427end
    34273428
     
    36763677%     stage=4;%default
    36773678    if strcmp(parent_tag,'Civ1')
    3678             set(handles.txt_Mask,'Visible','on')
    3679         set(handles.txt_Mask,'String',filemask)
     3679            set(handles.Mask,'Visible','on')
     3680        set(handles.Mask,'String',filemask)
    36803681    set(handles.CheckMask,'Value',1)
    36813682    end
     
    36883689% %             stage=4;
    36893690%     end
    3690 %     set(handles.txt_Mask(stage:end),'Visible','on')
    3691 %     set(handles.txt_Mask(stage:end),'String',filemask)
     3691%     set(handles.Mask(stage:end),'Visible','on')
     3692%     set(handles.Mask(stage:end),'String',filemask)
    36923693%     set(handles.CheckMask(stage:end),'Value',1)
    36933694else
     
    43804381
    43814382function NomType_Callback(hObject, eventdata, handles)
    4382 
     4383set(handles.RootPath,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding
     4384RootPath=get(handles.RootPath,'String');
     4385RootFile=get(handles.RootFile,'String');
     4386ref_i=str2num(get(handles.ref_i,'String'));
     4387ref_j=str2num(get(handles.ref_j,'String'));
     4388NomType=get(handles.NomType,'String');
     4389ImaExt=get(handles.ImaExt,'String');
     4390fileinput=fullfile_uvmat(RootPath,'',RootFile,ImaExt,NomType,ref_i,[],ref_j);
     4391errormsg=display_file_name(handles,fileinput);
     4392if ~isempty(errormsg)
     4393    msgbox_uvmat('ERROR',errormsg)
     4394end
     4395set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished
    43834396
    43844397% --- Executes on selection change in ListProgram.
  • trunk/src/fileparts_uvmat.m

    r379 r384  
    9393            end
    9494            NomType=[get_type(num3) delim2 get_type(num2) delim1 get_type(num1)];
    95             RootFile=regexprep(FileName,[num3 delim2 num2 delim1 num1],'');
     95            RootFile=regexprep(FileName,[num3 delim2 num2 delim1 num1 '$'],'');
    9696        else
    9797            switch delim1
     
    110110        i1=str2double(num1);
    111111        NomType=get_type(num1);
    112         RootFile=regexprep(FileName,num1,'');
     112        RootFile=regexprep(FileName,[num1 '$'],'');
    113113    end
    114114else% FileName ends with a letter
  • trunk/src/find_file_series.m

    r379 r384  
    6363        RootFile='';
    6464    end
    65 else   
     65else
     66    %% possibly include the first index in the root name, if there exists a   corresponding xml file   
     67    NomTypePref='';
     68    RootFileNew=RootFile;
     69    if ~isempty(regexp(NomType,['^_']))
     70        NomTypePref='_';
     71        RootFileNew=[RootFileNew '_'];
     72    end
     73    r=regexp(NomType,['^' NomTypePref '(?<num1>\d+)'],'names');%look for a number at the beginning of NomTypeSt
     74    if ~isempty(r)
     75        NomTypePref=[NomTypePref r.num1];
     76        fileinput_end=regexprep(fileinput,['^' RootFileNew],'');
     77        r=regexp(fileinput_end,'^(?<num1>\d+)','names');
     78        if ~isempty(r)           
     79            RootFileNew=[RootFileNew r.num1];
     80        end
     81        if exist(fullfile(RootPath,[RootFileNew '.xml']),'file')
     82            RootFile=RootFileNew;
     83            NomType=regexprep(NomType,['^' NomTypePref],'');
     84            i2_input=j2_input;
     85            j1_input=[];
     86            j2_input=[];
     87        end
     88    end
    6689    %% analyse the list of existing files when relevant
    6790    sep1='';
     
    205228    else
    206229        [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ifile_min).name);% update the representation of indices (number of 0 before the number)
     230        NomType=regexprep(NomType,['^' NomTypePref],'');
    207231    end
    208232end
  • trunk/src/uvmat.m

    r383 r384  
    13541354MaskName=fullfile_uvmat(RootPath,'',RootFile,'.png',MaskData.NomType,num_i1_mask,[],num_j1);
    13551355%MaskName=name_generator(MaskData.Base,num_i1_mask,num_j1,'.png',MaskData.NomType);
    1356 huvmat=get(handles.CheckMask,'parent');
    1357 UvData=get(huvmat,'UserData');
    1358 
     1356% huvmat=get(handles.CheckMask,'parent');
     1357UvData=get(handles.uvmat,'UserData');
    13591358%update mask image if the mask is new
    13601359if ~ (isfield(UvData,'MaskName') && isequal(UvData.MaskName,MaskName))
    13611360    UvData.MaskName=MaskName; %update the recorded name on UvData
    1362     set(huvmat,'UserData',UvData);
     1361    set(handles.uvmat,'UserData',UvData);
    13631362    if ~exist(MaskName,'file')
    13641363        if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
     
    14301429function MenuExportFigure_Callback(hObject, eventdata, handles)
    14311430%------------------------------------------------------------------------
    1432 huvmat=get(handles.MenuExport,'parent');
     1431% huvmat=get(handles.MenuExport,'parent');
    14331432hfig=figure;
    14341433copyobj(handles.axes3,hfig);
     
    15701569i1=str2num(get(handles.i1,'String'));%read the field indices (for movie, it is not given by the file name)
    15711570i2=str2num(get(handles.i2,'String'));
    1572 j1=stra2num(get(handles.j1,'String'));
    1573 j2=stra2num(get(handles.j2,'String'));
     1571j1=1;
     1572if strcmp(get(handles.j1,'Visible'),'on')
     1573    j1=stra2num(get(handles.j1,'String'));
     1574end
     1575j2=j1;
     1576if strcmp(get(handles.j2,'Visible'),'on')
     1577    j2=stra2num(get(handles.j2,'String'));
     1578end
    15741579sub_value= get(handles.SubField,'Value');
    15751580if sub_value % a second input file has been entered
     
    31953200                                                      % associate the set_object interface handle to the plotting axes
    31963201    if isfield(UvData.OpenParam,'SetObjectOrigin')                                               
    3197     pos_uvmat=get(huvmat,'Position');
     3202    pos_uvmat=get(handles.uvmat,'Position');
    31983203    pos_set_object(1:2)=UvData.OpenParam.SetObjectOrigin + pos_uvmat(1:2);
    31993204    pos_set_object(3:4)=UvData.OpenParam.SetObjectSize .* pos_uvmat(3:4); 
     
    32053210    UvData.MouseAction='none';
    32063211end
    3207 set(huvmat,'UserData',UvData)
     3212set(handles.uvmat,'UserData',UvData)
    32083213
    32093214%-------------------------------------------------------
     
    35203525%--------------------------------------------
    35213526%plot first histo
    3522 huvmat=get(handles.histo1_menu,'parent');
     3527%huvmat=get(handles.histo1_menu,'parent');
    35233528histo_menu=get(handles.histo1_menu,'String');
    35243529histo_value=get(handles.histo1_menu,'Value');
    35253530FieldName=histo_menu{histo_value};
    3526 update_histo(handles.histo_u,huvmat,FieldName)
     3531update_histo(handles.histo_u,handles.uvmat,FieldName)
    35273532
    35283533%------------------------------------------------------------------------
     
    35303535%------------------------------------------------------------------------
    35313536%plot second histo
    3532 huvmat=get(handles.histo2_menu,'parent');
     3537%huvmat=get(handles.histo2_menu,'parent');
    35333538histo_menu=get(handles.histo2_menu,'String');
    35343539histo_value=get(handles.histo2_menu,'Value');
    35353540FieldName=histo_menu{histo_value};
    3536 update_histo(handles.histo_v,huvmat,FieldName)
     3541update_histo(handles.histo_v,handles.uvmat,FieldName)
    35373542
    35383543%------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.