Changeset 603 for trunk/src


Ignore:
Timestamp:
Apr 4, 2013, 12:08:47 PM (11 years ago)
Author:
sommeria
Message:

bugs corrected, improvement of civ_input GUI

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/fill_GUI.m

    r598 r603  
    1616%handles=guidata(GUI_handle);
    1717            children=get(GUI_handle,'children');
     18             handles=[];
    1819            for ichild=1:numel(children)
    1920                handles.(get(children(ichild),'tag'))=children(ichild);
  • trunk/src/proj_field.m

    r595 r603  
    891891if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX)
    892892     DX=abs(ObjectData.DX);%mesh of interpolation points
    893 else
     893elseif isfield(FieldData,'CoordMesh')
    894894     DX=FieldData.CoordMesh;
    895895end
    896896if isfield(ObjectData,'DY') && ~isempty(ObjectData.DY)
    897897     DY=abs(ObjectData.DY);%mesh of interpolation points
    898 else
     898elseif isfield(FieldData,'CoordMesh')
    899899     DY=FieldData.CoordMesh;
    900900end
  • trunk/src/series.m

    r602 r603  
    542542
    543543%% determine the selected reference field indices for pair display
    544 ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV
    545 if ~isempty(i1)
    546     ref_i=i1;
    547     if ~isempty(i2)
    548         ref_i=floor((ref_i+i2)/2);% reference image number corresponding to the file
    549     end
    550 end
     544if isempty(i1)
     545    i1=1;
     546end
     547if isempty(i2)
     548    i2=i1;
     549end
     550ref_i=floor((i1+i2)/2);% reference image number corresponding to the file
    551551set(handles.num_ref_i,'String',num2str(ref_i));
    552 ref_j=1; %default  ref_j is a reference frame index used to find existing pairs from PIV
    553 if ~isempty(j1)
    554     ref_j=j1;
    555     if ~isempty(j2)
    556         ref_j=floor((j1+j2)/2);
    557     end         
    558 end
     552set(handles.num_ref_i,'UserData',[i1 i2])
     553if isempty(j1)
     554    j1=1;
     555end
     556if isempty(j2)
     557    j2=j1;
     558end
     559ref_j=floor((j1+j2)/2);% reference image number corresponding to the file
    559560set(handles.num_ref_j,'String',num2str(ref_j));
     561set(handles.num_ref_j,'UserData',[j1 j2])
    560562
    561563%% update the list of recent files in the menubar and save it for future opening
     
    793795%% update the series info in 'UserData'
    794796SeriesData=get(handles.series,'UserData');
     797SeriesData.Ref_i{iview}=get(handles.num_ref_i,'UserData');
     798SeriesData.Ref_j{iview}=get(handles.num_ref_j,'UserData');
    795799SeriesData.i1_series{iview}=i1_series;
    796800SeriesData.i2_series{iview}=i2_series;
     
    23672371commandwindow; %brings the Matlab command window to the front
    23682372
     2373
     2374% --------------------------------------------------------------------
     2375function MenuImportConfig_Callback(hObject, eventdata, handles)
     2376% --------------------------------------------------------------------
     2377InputTable=get(handles.InputTable,'Data');
     2378[FileName, PathName] = uigetfile( ...
     2379       {'*.xml', ' (*.xml)';
     2380       '*.xml',  '.xml files '; ...
     2381        '*.*',  'All Files (*.*)'}, ...
     2382        'Pick a file',InputTable{1,1});
     2383filexml=[PathName FileName];%complete file name
     2384if isempty(filexml),return;end %abandon if no file is introduced by the browser
     2385Param=xml2struct(filexml);
     2386fill_GUI(Param,handles.series)
    23692387
    23702388% --- Executes on selection change in RunMode.
  • trunk/src/series/civ_input.m

    r599 r603  
    2525
    2626
    27 % Last Modified by GUIDE v2.5 01-Apr-2013 10:00:57
     27% Last Modified by GUIDE v2.5 04-Apr-2013 09:14:14
    2828% Begin initialization code - DO NOT EDIT
    2929gui_Singleton = 1;
     
    6363%% set visibility options: case civ_matlab
    6464if strcmp(Param.Action.ActionName,'civ_series')
     65        set(handles.Program,'String','civ_series')
    6566        set(handles.num_MaxDiff,'Visible','on')
    6667        set(handles.num_MaxVel,'Visible','on')
     
    8788FileType=SeriesData.FileType{1};
    8889FileInfo=SeriesData.FileInfo{1};
     90Ref_i=SeriesData.Ref_i{1};
     91Ref_j=SeriesData.Ref_j{1};
     92FileInput=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomTypeInput,Ref_i(1),Ref_i(2),Ref_j(1),Ref_j(2));
    8993
    9094%% case of netcdf file as input, get the processing stage and look for corresponding images
     
    9498NomTypeNc='';
    9599switch FileType
     100         case {'image','multimage','video','mmreader'}
     101          NomTypeIma=NomTypeInput;
    96102    case 'civdata'
     103        if ~strcmp(Param.Action.ActionName,'civ_series')
     104            msgbox_uvmat('ERROR','bad input data file: open an image or a nc file from civ_series')
     105            return
     106        end
    97107        NomTypeNc=NomTypeInput;
    98108        ind_opening=FileInfo.CivStage;
     
    105115        end
    106116        imageinput='';
    107         set(handles.Program,'Value',1) %select civ/Matlab by default
     117        Data=nc2struct(FileInput,'ListGlobalAttribute','Civ2_ImageA','Civ1_ImageA','Civ2_ImageB','Civ1_ImageB');
     118    if isfield(Data,'Txt')
     119        errormsg=Data.Txt;
     120        return
     121        %TODO: introduce the image in the input table of series
     122    end
    108123        %         if  ~isempty(Data.Civ2_ImageB)%get the corresponding input image in the netcdf file
    109124        %             imageinput=Data.Civ2_ImageB;
     
    131146            end
    132147        end
    133         if ~exist(imageinput,'file')
    134             imageinput=fullfile_uvmat(RootPath,regexprep(SubDir,'.civ(_?)(\d*)$',''),RootFile,'.png',NomTypeIma,i1,[],j1);
    135         end
     148%         if ~exist(imageinput,'file')
     149%             imageinput=fullfile_uvmat(RootPath,regexprep(SubDir,'.civ(_?)(\d*)$',''),RootFile,'.png',NomTypeIma,i1,[],j1);
     150%         end
    136151    case 'civxdata'% case of  civx data,
    137152        NomTypeNc=NomTypeInput;
     
    140155        msgbox_uvmat('ERROR','old civX convention, use the GUI civ')
    141156        return
    142      case {'image','multimage','video','mmreader'}
    143           NomTypeIma=NomTypeInput;     
     157     
    144158end
    145159
     
    160174
    161175%display the parameters stored on the GUI series
    162 set(handles.first_i,'String',num2str(Param.IndexRange.first_i))
    163 set(handles.incr_i,'String',num2str(Param.IndexRange.incr_i))
    164 set(handles.last_i,'String',num2str(Param.IndexRange.last_i))
     176% set(handles.first_i,'String',num2str(Param.IndexRange.first_i))
     177% set(handles.incr_i,'String',num2str(Param.IndexRange.incr_i))
     178% set(handles.last_i,'String',num2str(Param.IndexRange.last_i))
    165179set(handles.ref_i,'String',num2str(Param.IndexRange.first_i))
    166180if isfield(Param.IndexRange,'first_j')
    167     set(handles.first_j,'String',num2str(Param.IndexRange.first_j))
    168     set(handles.incr_j,'String',num2str(Param.IndexRange.incr_j))
    169     set(handles.last_j,'String',num2str(Param.IndexRange.last_j))
    170     set(handles.ref_i,'String',num2str(Param.IndexRange.first_j))
     181%     set(handles.first_j,'String',num2str(Param.IndexRange.first_j))
     182%     set(handles.incr_j,'String',num2str(Param.IndexRange.incr_j))
     183%     set(handles.last_j,'String',num2str(Param.IndexRange.last_j))
     184    set(handles.ref_j,'String',num2str(Param.IndexRange.first_j))
    171185end
    172186
     
    195209
    196210%set(handles.(ListOptions{min(ind_opening+1,6)}),'value',1)
    197 update_CivOptions(handles,ind_opening)
     211
    198212
    199213%%  set the menus of image pairs and default selection for civ_input   %%%%%%%%%%%%%%%%%%%
     
    286300time=[zeros(1,size(time,2)); time]; %insert a horizontal line of zeros
    287301CivInputData.Time=time;
     302CivInputData.NomTypeIma=NomTypeIma;
    288303set(handles.civ_input,'UserData',CivInputData)
    289304%set(handles.ImaDoc,'UserData',time); %store the matrix of times
    290 set(handles.NomType,'String',NomTypeIma)
    291305set(handles.dt_unit,'String',['dt in m' TimeUnit]);%display dt in unit 10-3 of the time (e.g ms)
    292306set(handles.TimeUnit,'String',TimeUnit);
     
    303317num_ref_j=str2num(get(handles.ref_j,'String'));
    304318
     319update_CivOptions(handles,ind_opening)
    305320
    306321%% list the possible index pairs, depending on the option set in ListPairMode
     
    401416% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    402417% the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
    403 %[RootPath,SubDirImages,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,MovieObject]=find_file_series(FilePath,[FileName ImaExt]);
     418%[RootPath,ImageACiv1,RootFile,i1_series,tild,j1_series,tild,NomTypeIma,FileType,MovieObject]=find_file_series(FilePath,[FileName ImaExt]);
    404419switch Param.FileType{1}
    405420    case {'image','multimage','video','mmreader'}
     
    409424end
    410425set(handles.RootPath,'String',RootPath)
    411 set(handles.SubDirImages,'String',SubDirImages)
     426set(handles.ImageACiv1,'String',SubDirImages)
    412427set(handles.RootFile,'String',RootFile)
    413428if strcmp(ExtInput,'.nc')
     
    416431    SubDirCiv= '.civ';
    417432end
    418 set(handles.SubdirCiv1,'String',SubDirCiv)
    419 set(handles.SubdirCiv2,'String',SubDirCiv)
     433set(handles.ImageBCiv1,'String',SubDirCiv)
     434set(handles.ImageACiv2,'String',SubDirCiv)
    420435browse=get(handles.RootPath,'UserData');
    421436browse.incr_pair=[0 0];%default
     
    496511%------------------------------------------------------------------------
    497512% --- Executes on carriage return on the subdir checkciv1 edit window
    498 function SubdirCiv1_Callback(hObject, eventdata, handles)
    499 %------------------------------------------------------------------------
    500 SubDir=get(handles.SubdirCiv1,'String');
     513function ImageBCiv1_Callback(hObject, eventdata, handles)
     514%------------------------------------------------------------------------
     515SubDir=get(handles.ImageBCiv1,'String');
    501516menu_str=get(handles.ListSubdirCiv1,'String');% read the list of subdirectories for update
    502517ichoice=find(strcmp(SubDir,menu_str),1);
     
    508523set(handles.ListSubdirCiv1,'Value',ilist)% select the selected subdir in the menu
    509524if get(handles.CheckCiv1,'Value')% if Civ1 is performed
    510     set(handles.SubdirCiv2,'String',SubDir);% set by default civ2 directory the same as civ1
     525    set(handles.ImageACiv2,'String',SubDir);% set by default civ2 directory the same as civ1
    511526%     set(handles.ListSubdirCiv2,'Value',ilist)
    512527else % if Civ1 data already exist
     
    519534%------------------------------------------------------------------------
    520535% --- Executes on carriage return on the SubDir checkciv1 edit window
    521 function SubdirCiv2_Callback(hObject, eventdata, handles)
    522 %------------------------------------------------------------------------
    523 SubDir=get(handles.SubdirCiv1,'String');
     536function ImageACiv2_Callback(hObject, eventdata, handles)
     537%------------------------------------------------------------------------
     538SubDir=get(handles.ImageBCiv1,'String');
    524539menu_str=get(handles.ListSubdirCiv2,'String');% read the list of subdirectories for update
    525540ichoice=find(strcmp(SubDir,menu_str),1);
     
    594609% end
    595610set(handles.PairIndices,'Visible','on')
    596 set(handles.SubdirCiv1,'Visible','on')
     611set(handles.ImageBCiv1,'Visible','on')
    597612set(handles.TitleSubdirCiv1,'Visible','on')
    598613if opening==0
     
    605620    set(handles.TitlePairCiv2,'Visible','on')
    606621    set(handles.TitleSubdirCiv2,'Visible','on')
    607     set(handles.SubdirCiv2,'Visible','on')
     622    set(handles.ImageACiv2,'Visible','on')
    608623    %set(handles.ListSubdirCiv2,'Visible','on')
    609624    set(handles.ListPairCiv2,'Visible','on')
     
    616631else
    617632    set(handles.TitleSubdirCiv2,'Visible','off')
    618     set(handles.SubdirCiv2,'Visible','off')
     633    set(handles.ImageACiv2,'Visible','off')
    619634    set(handles.ListPairCiv2,'Visible','off')
    620635end
     
    953968function enable_i(handles, state)
    954969set(handles.itext,'Visible',state)
    955 set(handles.first_i,'Visible',state)
    956 set(handles.last_i,'Visible',state)
    957 set(handles.incr_i,'Visible',state)
     970% set(handles.first_i,'Visible',state)
     971% set(handles.last_i,'Visible',state)
     972% set(handles.incr_i,'Visible',state)
    958973set(handles.nb_field,'Visible',state)
    959974set(handles.ref_i,'Visible',state)
     
    961976function enable_j(handles, state)
    962977set(handles.jtext,'Visible',state)
    963 set(handles.first_j,'Visible',state)
    964 set(handles.last_j,'Visible',state)
    965 set(handles.incr_j,'Visible',state)
     978% set(handles.first_j,'Visible',state)
     979% set(handles.last_j,'Visible',state)
     980% set(handles.incr_j,'Visible',state)
    966981set(handles.nb_field2,'Visible',state)
    967982set(handles.ref_j,'Visible',state)
     
    10941109%% initialisation
    10951110errormsg='';
     1111CivInputData=get(handles.civ_input,'UserData');
    10961112%browse=get(handles.RootPath,'UserData');
    10971113compare_list=get(handles.ListCompareMode,'String');
     
    11081124    mode=mode_list{mode_value};
    11091125end
    1110 nom_type_ima=get(handles.NomType,'String');
     1126nom_type_ima=CivInputData.NomTypeIma;
    11111127
    11121128%% determine nom_type_nc, nomenclature type of the .nc files:
     
    11141130
    11151131%% reads .nc subdirectoy and image numbers from the interface
    1116 SubDirImages=get(handles.SubDirImages,'String');
    1117 subdir_civ1=[SubDirImages get(handles.SubdirCiv1,'String')];%subdirectory subdir_civ1 for the netcdf data
    1118 subdir_civ2=[SubDirImages get(handles.SubdirCiv2,'String')];%subdirectory subdir_civ2 for the netcdf data
     1132SubDirImages=get(handles.ImageACiv1,'String');
     1133subdir_civ1=[SubDirImages get(handles.ImageBCiv1,'String')];%subdirectory subdir_civ1 for the netcdf data
     1134subdir_civ2=[SubDirImages get(handles.ImageACiv2,'String')];%subdirectory subdir_civ2 for the netcdf data
    11191135ref_i=str2double(get(handles.ref_i,'String'));
    11201136ref_j=[];
     
    15761592nbslice=1;
    15771593
    1578 % subdir=get(handles.SubdirCiv1,'String');
     1594% subdir=get(handles.ImageBCiv1,'String');
    15791595[Path,Name]=fileparts(filebase);
    15801596if ~isdir(Path)
     
    16721688%     end   
    16731689% end
    1674 % set(handles.SubdirCiv1,'String',SubDir);
     1690% set(handles.ImageBCiv1,'String',SubDir);
    16751691% errormsg=find_netcpair_civ(handles,1);
    16761692% if ~isempty(errormsg)
     
    16931709%     end
    16941710% end
    1695 % set(handles.SubdirCiv2,'String',SubDir);
     1711% set(handles.ImageACiv2,'String',SubDir);
    16961712
    16971713%------------------------------------------------------------------------
     
    21362152end
    21372153
    2138 function NomType_Callback(hObject, eventdata, handles)
    2139 set(handles.RootPath,'BackgroundColor',[1 1 0])%paint RootName edit box in yellow to indicate that the file input is proceeding
    2140 RootPath=get(handles.RootPath,'String');
    2141 RootFile=get(handles.RootFile,'String');
    2142 SubDirImages=get(handles.SubDirImages,'String');
    2143 ref_i=str2num(get(handles.ref_i,'String'));
    2144 ref_j=str2num(get(handles.ref_j,'String'));
    2145 NomType=get(handles.NomType,'String');
    2146 ImaExt=get(handles.ImaExt,'String');
    2147 fileinput=fullfile_uvmat(RootPath,SubDirImages,RootFile,ImaExt,NomType,ref_i,[],ref_j);
    2148 errormsg=display_file_name(handles,fileinput);
    2149 if ~isempty(errormsg)
    2150     msgbox_uvmat('ERROR',errormsg)
    2151 end
    2152 set(handles.RootPath,'BackgroundColor',[1 1 1])%paint RootName back to white to indicate that the file input is finished
    2153 
    2154 % --- Executes on selection change in Program.
    2155 function Program_Callback(hObject, eventdata, handles)
    2156 ListProgram=get(handles.Program,'String');
    2157 Program=ListProgram{get(handles.Program,'value')};
    2158 switch Program
    2159     case 'CivX'
    2160         set(handles.num_MaxDiff,'Visible','off')
    2161         set(handles.num_MaxVel,'Visible','off')
    2162         set(handles.title_MaxVel,'Visible','off')
    2163         set(handles.num_Nx,'Visible','on')
    2164         set(handles.num_Ny,'Visible','on')
    2165         set(handles.title_Nx,'Visible','on')
    2166         set(handles.title_Ny,'Visible','on')
    2167         set(handles.title_MaxDiff,'Visible','off')
    2168         set(handles.num_CorrSmooth,'Style','edit')
    2169         set(handles.num_CorrSmooth,'String','1')
    2170         set(handles.BATCH,'Enable','on')
    2171         set(handles.CheckThreshold,'Visible','off')
    2172         set(handles.CheckDeformation,'Value',1)
    2173         set(handles.CheckDecimal,'Value',1)
    2174     case {'civ_matlab','civ_matlab.sh'}
    2175         set(handles.num_MaxDiff,'Visible','on')
    2176         set(handles.num_MaxVel,'Visible','on')
    2177         set(handles.title_MaxVel,'Visible','on')
    2178         set(handles.title_MaxDiff,'Visible','on')
    2179         set(handles.num_Nx,'Visible','off')
    2180         set(handles.num_Ny,'Visible','off')
    2181         set(handles.title_Nx,'Visible','off')
    2182         set(handles.title_Ny,'Visible','off')
    2183         set(handles.num_CorrSmooth,'Style','popupmenu')
    2184         set(handles.num_CorrSmooth,'Value',1)
    2185         set(handles.num_CorrSmooth,'String',{'1';'2'})
    2186         set(handles.CheckThreshold,'Visible','on')
    2187         set(handles.CheckDeformation,'Value',0)% desactivate (work in progress)
    2188         set(handles.CheckDecimal,'Value',0)% desactivate (work in progress)
    2189 end
    2190 
    21912154% --- Executes on button press in TestPatch1.
    21922155function TestPatch1_Callback(hObject, eventdata, handles)
     
    22362199% --- Executes on button press in TestCiv2.
    22372200function TestCiv2_Callback(hObject, eventdata, handles)
     2201
     2202
     2203
     2204function NcFileCiv2_Callback(hObject, eventdata, handles)
     2205% hObject    handle to NcFileCiv2 (see GCBO)
     2206% eventdata  reserved - to be defined in a future version of MATLAB
     2207% handles    structure with handles and user data (see GUIDATA)
     2208
     2209% Hints: get(hObject,'String') returns contents of NcFileCiv2 as text
     2210%        str2double(get(hObject,'String')) returns contents of NcFileCiv2 as a double
     2211
     2212
     2213% --- Executes during object creation, after setting all properties.
     2214function NcFileCiv2_CreateFcn(hObject, eventdata, handles)
     2215% hObject    handle to NcFileCiv2 (see GCBO)
     2216% eventdata  reserved - to be defined in a future version of MATLAB
     2217% handles    empty - handles not created until after all CreateFcns called
     2218
     2219% Hint: edit controls usually have a white background on Windows.
     2220%       See ISPC and COMPUTER.
     2221if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
     2222    set(hObject,'BackgroundColor','white');
     2223end
     2224
     2225
     2226
     2227function ImageACiv1_Callback(hObject, eventdata, handles)
     2228% hObject    handle to ImageACiv1 (see GCBO)
     2229% eventdata  reserved - to be defined in a future version of MATLAB
     2230% handles    structure with handles and user data (see GUIDATA)
     2231
     2232% Hints: get(hObject,'String') returns contents of ImageACiv1 as text
     2233%        str2double(get(hObject,'String')) returns contents of ImageACiv1 as a double
Note: See TracChangeset for help on using the changeset viewer.