Changeset 591 for trunk/src/civ.m


Ignore:
Timestamp:
Mar 25, 2013, 5:43:18 PM (8 years ago)
Author:
sommeria
Message:

various updates, in particular modification of series to do calculations in the cluster

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r589 r591  
    8383end
    8484if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode')
    85     batch_mode=sparam.BatchParam.BatchMode; %sge is currently the only implemented batch mod
     85    batch_mode=sparam.BatchParam.BatchMode;
    8686    test_command='';
    8787    switch batch_mode
     
    900900    uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String','checking files...');
    901901    uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]);
    902     uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI);
     902    %uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI);
     903    uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@stop_status);
    903904    hrefresh=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@refresh_GUI);
    904905    BarPosition=[0.05 0.81 0.01 0.05];
     
    10091010set(hhciv.status,'BackgroundColor',[0 1 0])
    10101011
    1011 %------------------------------------------------------------------------   
    1012 % launched by pressing OK on the status figure
    1013 function close_GUI(hObject, eventdata)
    1014 %------------------------------------------------------------------------
    1015     delete(gcbf)
     1012% %------------------------------------------------------------------------   
     1013% % launched by pressing OK on the status figure
     1014% function close_GUI(hObject, eventdata)
     1015% %------------------------------------------------------------------------
     1016%     delete(gcbf)
    10161017
    10171018
     
    13351336        write_param(Param);
    13361337             
    1337         % create the file used in run or batch
     1338        % create the command file name .m, .bat or .sh depending on the run option
    13381339        switch Param.Program
    13391340            case {'civ_matlab'}
     
    17581759ext_ima=get(handles.ImaExt,'String'); % image extension (the same for all images)
    17591760switch compare
    1760     case 'PIV'
     1761    case {'PIV','PIV volume'}
    17611762       RootFile_ima1=RootFile_ima2;% root name of the two image series is the same
    17621763       NomType_ima1=NomType_ima2;% the index of the first image follows the index of the second one
     
    24972498ListCompareMode=get(handles.ListCompareMode,'String');
    24982499option=ListCompareMode{get(handles.ListCompareMode,'Value')};
    2499 if ~strcmp(option,'PIV') % case 'displacement' or 'stereo PIV'
    2500     filebase=get(handles.RootPath,'String');
    2501     set(handles.sub_txt,'Visible','on')
    2502     set(handles.RootFile_1,'Visible','On');%mkes the second file input window visible
    2503     mode_store=get(handles.ListPairMode,'String');%get the present 'mode'
    2504     set(handles.ListCompareMode,'UserData',mode_store);%store the mode display
    2505     set(handles.ListPairMode,'Visible','off')
    2506    
    2507     %% open an image file with the browser
    2508     ind_opening=1;%default
    2509     browse.incr_pair=[0 0]; %default
    2510     oldfile=get(handles.RootPath,'String');
    2511     menu={'*.png;*.jpg;*.tif;*.avi;*.AVI;', ' (*.png,*.jpg ,.tif, *.avi,*.AVI)';
    2512         '*.png','.png image files'; ...
    2513         '*.jpg',' jpeg image files'; ...
    2514         '*.tif','.tif image files'; ...
    2515         '*.avi;*.AVI','.avi movie files'; ...
    2516         '*.*',  'All Files (*.*)'};
    2517     if strcmp(option,'displacement')
    2518         comment='Pick the reference file for displacements';
    2519     else
    2520         comment='Pick a file of the second series';
    2521     end
    2522     [FileName, PathName] = uigetfile( menu, comment,oldfile);
    2523     fileinput=[PathName FileName];%complete file name
    2524     sizf=size(fileinput);
    2525     if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string
    2526     [path,name,ext]=fileparts(fileinput);
    2527     [path1]=fileparts(filebase);
    2528     if isunix
    2529         [status,path]=system(['readlink ' path]);
    2530         [status,path1]=system(['readlink ' path1]);% look for the true path in case of symbolic paths
    2531     end
    2532     if ~strcmp(path1,path)
    2533         msgbox_uvmat('ERROR','The second image or series must be in the same directory as the first one')
    2534         return
    2535     end
    2536     if strcmp(option,'displacement')
    2537         [tild,RootFile_1]=fileparts(name);
    2538     else
    2539         [FilePath,FileName,Ext]=fileparts(fileinput);
    2540 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
    2541 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
    2542 [RootPath,SubDir,RootFile_1,i1_series,i2_series,j1_series,j2_series,nom_type_1,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName Ext]);
    2543 
    2544         %check image nom type
    2545         if ~strcmp(nom_type_1,get(handles.NomType,'String'))
    2546         msgbox_uvmat('ERROR','The second image series must have the same indexing type as the first one, or use the option displacement for a fixed image')
    2547         return
    2548         end
    2549     end   
    2550     %check image  extension
    2551     if ~strcmp(ext,get(handles.ImaExt,'String'))
    2552         msgbox_uvmat('ERROR','The second image series must have the same extension name as the first one')
    2553         return
    2554     end
    2555     set(handles.RootFile_1,'String',RootFile_1);
    2556 else
    2557     set(handles.ListPairMode,'Visible','on')
    2558     set(handles.RootFile_1,'Visible','Off');
    2559     set(handles.sub_txt,'Visible','off')
    2560     set(handles.RootFile_1,'String',[]);
    2561     mode_store=get(handles.ListCompareMode,'UserData');
    2562     set(handles.ListPairMode,'Value',1)
    2563     set(handles.ListPairMode,'String',mode_store)
    2564     set(handles.CheckStereo,'Value',0)
    2565     set(handles.ListPairMode,'Value',1) % mode 'civX' selected by default
     2500switch option
     2501    case 'PIV'
     2502        set(handles.RootFile_1,'Visible','Off');
     2503        set(handles.sub_txt,'Visible','off')
     2504        set(handles.RootFile_1,'String',[]);
     2505        mode_store=get(handles.ListCompareMode,'UserData');
     2506        set(handles.ListPairMode,'Visible','on')
     2507        set(handles.ListPairMode,'Value',1)
     2508        set(handles.ListPairMode,'String',mode_store)
     2509        set(handles.CheckStereo,'Value',0)     
     2510    case 'PIV volume'     
     2511        set(handles.RootFile_1,'Visible','Off');
     2512        set(handles.sub_txt,'Visible','off')
     2513        set(handles.RootFile_1,'String',[]);
     2514        mode_store=get(handles.ListCompareMode,'UserData');
     2515        set(handles.ListPairMode,'Visible','on')
     2516        set(handles.ListPairMode,'Value',1)
     2517        set(handles.ListPairMode,'String',{'series(Di)'})
     2518        set(handles.CheckStereo,'Value',0)
     2519        set(handles.last_j,'String',get(handles.nb_field2,'String'))% select the whole volume scan by default
     2520        set(handles.incr_i,'String',num2str(2))%
     2521    otherwise
     2522        filebase=get(handles.RootPath,'String');
     2523        set(handles.sub_txt,'Visible','on')
     2524        set(handles.RootFile_1,'Visible','On');%mkes the second file input window visible
     2525        mode_store=get(handles.ListPairMode,'String');%get the present 'mode'
     2526        set(handles.ListCompareMode,'UserData',mode_store);%store the mode display
     2527        set(handles.ListPairMode,'Visible','off')
     2528       
     2529        %% open an image file with the browser
     2530        ind_opening=1;%default
     2531        browse.incr_pair=[0 0]; %default
     2532        oldfile=get(handles.RootPath,'String');
     2533        menu={'*.png;*.jpg;*.tif;*.avi;*.AVI;', ' (*.png,*.jpg ,.tif, *.avi,*.AVI)';
     2534            '*.png','.png image files'; ...
     2535            '*.jpg',' jpeg image files'; ...
     2536            '*.tif','.tif image files'; ...
     2537            '*.avi;*.AVI','.avi movie files'; ...
     2538            '*.*',  'All Files (*.*)'};
     2539        if strcmp(option,'displacement')
     2540            comment='Pick the reference file for displacements';
     2541        else
     2542            comment='Pick a file of the second series';
     2543        end
     2544        [FileName, PathName] = uigetfile( menu, comment,oldfile);
     2545        fileinput=[PathName FileName];%complete file name
     2546        sizf=size(fileinput);
     2547        if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string
     2548        [path,name,ext]=fileparts(fileinput);
     2549        [path1]=fileparts(filebase);
     2550        if isunix
     2551            [status,path]=system(['readlink ' path]);
     2552            [status,path1]=system(['readlink ' path1]);% look for the true path in case of symbolic paths
     2553        end
     2554        if ~strcmp(path1,path)
     2555            msgbox_uvmat('ERROR','The second image or series must be in the same directory as the first one')
     2556            return
     2557        end
     2558        if strcmp(option,'displacement')
     2559            [tild,RootFile_1]=fileparts(name);
     2560        else
     2561            [FilePath,FileName,Ext]=fileparts(fileinput);
     2562            % detect the file type, get the movie object if relevant, and look for the corresponding file series:
     2563            % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
     2564            [RootPath,SubDir,RootFile_1,i1_series,i2_series,j1_series,j2_series,nom_type_1,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName Ext]);
     2565           
     2566            %check image nom type
     2567            if ~strcmp(nom_type_1,get(handles.NomType,'String'))
     2568                msgbox_uvmat('ERROR','The second image series must have the same indexing type as the first one, or use the option displacement for a fixed image')
     2569                return
     2570            end
     2571        end
     2572        %check image  extension
     2573        if ~strcmp(ext,get(handles.ImaExt,'String'))
     2574            msgbox_uvmat('ERROR','The second image series must have the same extension name as the first one')
     2575            return
     2576        end
     2577        set(handles.RootFile_1,'String',RootFile_1);
     2578       
    25662579end
    25672580ListPairMode_Callback(hObject, eventdata, handles)
Note: See TracChangeset for help on using the changeset viewer.