- Timestamp:
- Jun 26, 2012, 11:50:19 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r482 r483 60 60 errormsg=[];%default error message 61 61 xmlfile='PARAM.xml'; 62 test_batch=0;%default: ,no batch mode available 63 sparam=[]; 62 64 if exist(xmlfile,'file') 63 65 try … … 66 68 catch ME 67 69 errormsg={' Unable to read the file PARAM.xml defining the civx binaries:';ME.message}; 70 msgbox_uvmat('WARNING',errormsg); 68 71 end 69 72 else 70 errormsg=[xmlfile ' not found: path to civx binaries undefined']; 71 end 72 if ~isempty(errormsg) 73 msgbox_uvmat('WARNING',errormsg); 74 end 75 76 77 test_batch=0;%default: ,no batch mode available 73 %errormsg=[xmlfile ' not found: path to civx binaries undefined']; 74 [s,w]=system('oarstat'); 75 if ~isequal(s,0) 76 [s,w]=system('qstat'); 77 end 78 if isequal(s,0) 79 test_batch=1; 80 end 81 end 78 82 if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode') 79 83 batch_mode=sparam.BatchParam.BatchMode; %sge is currently the only implemented batch mod … … 100 104 % set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated) 101 105 end 102 if isfield(sparam.RunParam,'CivBin')103 if ~exist(sparam.RunParam.CivBin,'file')104 sparam.RunParam.CivBin=fullfile(path_civ,sparam.RunParam.CivBin);105 end106 else107 sparam.RunParam.CivBin='';108 end106 % if isfield(sparam.RunParam,'CivBin') 107 % if ~exist(sparam.RunParam.CivBin,'file') 108 % sparam.RunParam.CivBin=fullfile(path_civ,sparam.RunParam.CivBin); 109 % end 110 % else 111 % sparam.RunParam.CivBin=''; 112 % end 109 113 110 114 %% load the list of previously browsed files in the upper bar menu Open/ … … 888 892 drawnow 889 893 end 890 set(hrefresh,'UserData',option_civ) 891 filepath=fileparts(civ_files{1}); 894 StatusData.time_ref=now;% store the current time 895 StatusData.option_civ=option_civ; 896 set(hrefresh,'UserData',StatusData) 897 filepath=fileparts(civ_files{1}); 892 898 set(hlist,'UserData',fileparts(filepath)) 893 899 refresh_GUI(hrefresh,[]) … … 900 906 BarPosition=[0.05 0.81 0.01 0.05]; 901 907 hfig=get(hObject,'parent'); 908 StatusData=get(hObject,'UserData'); 902 909 civ_files=get(hfig,'UserData'); 903 904 905 906 option_civ= get(hObject,'UserData');910 [filepath,filename,ext]=fileparts(civ_files{1}); 911 [tild,SubDir,extdir]=fileparts(filepath); 912 SubDir=[SubDir extdir]; 913 option_civ=StatusData.option_civ; 907 914 nbfiles=numel(civ_files); 915 testrecent=0; 908 916 count=0; 909 testrecent=0; 910 % while count<nbfiles 911 count=0; 912 datnum=zeros(1,nbfiles); 913 for ifile=1:nbfiles 914 detect=exist(civ_files{ifile},'file'); % check the existence of the file 915 option=0; 916 if detect==0 917 option_str='not created'; 917 datnum=zeros(1,nbfiles); 918 filefound=cell(1,nbfiles); 919 for ifile=1:nbfiles 920 detect=exist(civ_files{ifile},'file'); % check the existence of the file 921 option=0; 922 if detect==0 923 option_str='not created'; 924 else 925 datfile=dir(civ_files{ifile}); 926 if isfield(datfile,'datenum') 927 datnum(ifile)=datfile.datenum;%only available in recent matlab versions 928 testrecent=1; 929 end 930 filefound(ifile)={datfile.name}; 931 932 % check the content netcdf file 933 Data=nc2struct(civ_files{ifile},'ListGlobalAttribute','CivStage','patch2','fix2','civ2','patch','fix'); 934 option_list={'civ1','fix1','patch1','civ2','fix2','patch2'}; 935 if ~isempty(Data.CivStage) 936 option=Data.CivStage;%case of Matlab civ 918 937 else 919 datfile=dir(civ_files{ifile}); 920 if isfield(datfile,'datenum') 921 datnum(ifile)=datfile.datenum;%only available in recent matlab versions 922 testrecent=1; 923 end 924 filefound(ifile)={datfile.name}; 925 lastfield=''; 926 % check the content netcdf file 927 Data=nc2struct(civ_files{ifile},'ListGlobalAttribute','CivStage','patch2','fix2','civ2','patch','fix'); 928 option_list={'civ1','fix1','patch1','civ2','fix2','patch2'}; 929 if ~isempty(Data.CivStage) 930 option=Data.CivStage;%case of Matlab civ 938 if ~isempty(Data.patch2) && isequal(Data.patch2,1) 939 option=6; 940 elseif ~isempty(Data.fix2) && isequal(Data.fix2,1) 941 option=5; 942 elseif ~isempty(Data.civ2) && isequal(Data.civ2,1); 943 option=4; 944 elseif ~isempty(Data.patch) && isequal(Data.patch,1); 945 option=3; 946 elseif ~isempty(Data.fix) && isequal(Data.fix,1); 947 option=2; 931 948 else 932 if ~isempty(Data.patch2) && isequal(Data.patch2,1)933 option=6;934 elseif ~isempty(Data.fix2) && isequal(Data.fix2,1)935 option=5;936 elseif ~isempty(Data.civ2) && isequal(Data.civ2,1);937 option=4;938 elseif ~isempty(Data.patch) && isequal(Data.patch,1);939 option=3;940 elseif ~isempty(Data.fix) && isequal(Data.fix,1);941 option=2;942 else943 option=1;944 end945 946 option_str=option_list{option}; 947 end 948 if option >= option_civ949 count=count+1;950 end951 [filepath,filename,ext]=fileparts(civ_files{ifile});952 Tabchar{ifile,1}=[fullfile(SubDir,filename) ext '...' option_str];953 end 949 option=1; 950 end 951 end 952 option_str=option_list{option}; 953 if datnum(ifile)<StatusData.time_ref 954 option_str=[option_str ' --OLD--']; 955 end 956 end 957 if option >= option_civ 958 count=count+1; 959 end 960 [filepath,filename,ext]=fileparts(civ_files{ifile}); 961 Tabchar{ifile,1}=[fullfile(SubDir,filename) ext '...' option_str]; 962 end 963 datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files 964 if isempty(datnum) 965 if testrecent 966 message='no civ result created yet'; 967 else 968 message=''; 969 end 970 else 954 971 datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files 955 if isempty(datnum) 956 if testrecent 957 message='no civ result created yet'; 958 else 959 message=''; 960 end 961 else 962 datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files 963 [first,ind]=min(datnum); 964 [last,indlast]=max(datnum); 965 % if test_new 966 % message='existing file status, no processing launched yet'; 967 % else 968 message={[num2str(count) ' file(s) done over ' num2str(nbfiles)] ;['oldest modification: ' cell2mat(filefound(ind)) ' : ' datestr(first)];... 969 ['latest modification: ' cell2mat(filefound(indlast)) ' : ' datestr(last)]}; 970 % end 971 end 972 %hfig=findobj(allchild(0),'name','civ_status'); 973 % if isempty(hfig)% the status list has been deleted 974 % return 975 % else 976 hlist=findobj(hfig,'tag','list'); 977 hmsgbox=findobj(hfig,'tag','msgbox'); 978 hwaitbar=findobj(hfig,'tag','waitbar'); 979 set(hlist,'String',Tabchar) 980 set(hmsgbox,'String', message) 981 if count>0 %&& ~test_new 982 BarPosition(3)=0.9*count/nbfiles; 983 set(hwaitbar,'Position',BarPosition) 984 end 985 % end 986 % [root,filename,ext]=fileparts(civ_files{1}); 987 % [rootroot,SubDir,extdir]=fileparts(root); 988 % 989 % set(hlist,'UserData',rootroot) 990 % if count<10||(nbfiles-count)<10 991 % pause(.5)% wait 0.5 seconds for next check 992 % else 993 % pause(10)% wait 10 seconds for next check 994 % end 995 % end 972 [first,ind]=min(datnum); 973 [last,indlast]=max(datnum); 974 message={[num2str(count) ' file(s) done over ' num2str(nbfiles)] ;['oldest modification: ' cell2mat(filefound(ind)) ' : ' datestr(first)];... 975 ['latest modification: ' cell2mat(filefound(indlast)) ' : ' datestr(last)]}; 976 end 977 hlist=findobj(hfig,'tag','list'); 978 hmsgbox=findobj(hfig,'tag','msgbox'); 979 hwaitbar=findobj(hfig,'tag','waitbar'); 980 set(hlist,'String',Tabchar) 981 set(hmsgbox,'String', message) 982 if count>0 %&& ~test_new 983 BarPosition(3)=0.9*count/nbfiles; 984 set(hwaitbar,'Position',BarPosition) 985 end 986 996 987 997 988 %------------------------------------------------------------------------ … … 1072 1063 path_civ=fileparts(which('civ')); %path to the source directory of uvmat 1073 1064 xmlfile='PARAM.xml'; 1065 s=[]; 1074 1066 if exist(xmlfile,'file')% search parameter xml file in the whole matlab path 1075 1067 t=xmltree(xmlfile); 1076 1068 s=convert(t); 1077 else 1078 errormsg=['no file ' xmlfile]; 1079 return 1080 end 1081 % test_interp=0; %eviter les variables test_ (LG) 1069 end% default configuration 1070 if ~isfield(s,'RunParam') 1071 s.RunParam.Civ1Bin='bin/civ1'; 1072 s.RunParam.Civ2Bin='bin/civ2'; 1073 s.RunParam.FixBin='bin/fix_flag'; 1074 s.RunParam.PatchBin='bin/patch_up'; 1075 s.RunParam.CivmBin='bin/civ_matlab'; 1076 end 1082 1077 if strcmp(Param.RunMode,'cluster') %computation dispatched on a cluster 1083 1078 if isfield(s,'BatchParam') … … 1091 1086 end 1092 1087 else 1093 errormsg='no batch civ binaries defined in PARAM.xml'; 1094 return 1088 %standard configuration 1089 Param.xml.Civ1Bin='bin/civ1'; 1090 Param.xml.Civ2Bin='bin/civ2'; 1091 Param.xml.FixBin='bin/fix_flag'; 1092 Param.xml.PatchBin='bin/patch_up'; 1093 s.RunParam.CivmBin='bin/civ_matlab'; 1094 Param.xml.BatchMode='oar';% TODO : allow choice for sge 1095 1095 end 1096 1096 else % run 1097 1097 if isfield(s,'RunParam') 1098 1098 Param.xml=s.RunParam; 1099 else 1100 errormsg='no run civ binaries defined in PARAM.xml'; 1101 return 1102 end 1103 end 1104 1099 else %standard default configuration 1100 s.RunParam.Civ1Bin='bin/civ1'; 1101 s.RunParam.Civ2Bin='bin/civ2'; 1102 s.RunParam.FixBin='bin/fix_flag'; 1103 s.RunParam.PatchBin='bin/patch_up'; 1104 s.RunParam.CivmBin='bin/civ_matlab'; 1105 end 1106 end 1105 1107 1106 1108 %% check if the binaries exist : to move in civ_opening -
trunk/src/find_file_series.m
r472 r483 54 54 return % don't go further if the dir path does not exist 55 55 end 56 % NbFrame=1;57 % switch FileType58 % case 'multimage'59 % NbFrame=FileInfo.NumberOfFrames;60 % case {'video','mmreader'}61 % NomType='*';62 % NbFrame=FileInfo.NumberOfFrames;63 % end64 65 % RootFile_i='';66 56 NomTypePref=''; 67 if strcmp(NomType,'')||strcmp(NomType,'*')57 if isempty(NomType) 68 58 if exist(fullfileinput,'file') 69 59 [tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing), get the filename without its extension … … 71 61 RootFile=''; 72 62 end 73 % i1_input=1;% the index now refer to the frame in the movie, choose 1 at opening74 % i2_input=[];75 % j1_input=[];76 % j2_input=[];77 63 else 78 64 %% possibly include the first index in the root name, if there exists a corresponding xml file … … 224 210 ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i. 225 211 end 226 %[tild,ifile_min]=min(ref_ij(ref_ij>0));227 212 ind_select=find(ref_ij>0); 228 213 if isempty(ind_select) 229 % RootPath='';230 214 RootFile=''; 231 215 NomType=''; … … 252 236 i1_series=(1:FileInfo.NumberOfFrames)'; 253 237 i1_input=1; 254 else 255 j1_series=(1:FileInfo.NumberOfFrames)'; 256 j1_input=1; 238 NomType='*'; 239 else 240 j1_series=(1:FileInfo.NumberOfFrames)'; 241 % include the first index in the root name 242 r=regexp(NomType,'^(?<tiretnum>_?\d+)','names');%look for a number or _1 at the beginning of NomType 243 if ~isempty(r) 244 fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput 245 if isempty(regexp(r.tiretnum,'^_','once'))% if a separator '_' is not detected 246 rr=regexp(fileinput_end,'^(?<i1>\d+)','names'); 247 else% if a separator '_' is detected 248 rr=regexp(fileinput_end,'^(?<i1>_\d+)','names'); 249 end 250 if ~isempty(rr) 251 RootFile=[RootFile rr.i1];% new root file 252 NomTypePref=r.tiretnum; 253 NomType=regexprep(NomType,['^' NomTypePref],''); 254 i1_input=j1_input; 255 i2_input=j2_input; 256 j1_input=1; 257 j2_input=[]; 258 end 259 end 257 260 end 258 261 end -
trunk/src/mouse_up.m
r444 r483 244 244 xlim=get(currentaxes,'XLim'); 245 245 ylim=get(currentaxes,'YLim'); 246 % if left mouse button has been pressed, zoom in by a factor of 2246 % if left mouse button has been pressed, zoom in by a factor of 2 247 247 if isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2 248 xlim(1)=0.5*xy(1,1)+0.5*xlim(1); 249 xlim(2)=0.5*xy(1,1)+0.5*xlim(2);%double the field whith the middle at the selected points 250 set(currentaxes,'XLim',xlim) 251 ylim(2)=0.5*xy(1,2)+0.5*ylim(2); 252 ylim(1)=0.5*xy(1,2)+0.5*ylim(1); 253 set(currentaxes,'YLim',ylim) 254 % if right mouse button has been pressed, zoom out by a factor of 2 248 PlotBoxAspectRatio=get(currentaxes,'PlotBoxAspectRatio'); 249 yoverx=PlotBoxAspectRatio(2)/PlotBoxAspectRatio(1); 250 if yoverx <2 251 xlim(1)=0.5*xy(1,1)+0.5*xlim(1); 252 xlim(2)=0.5*xy(1,1)+0.5*xlim(2);%double the field whith the middle at the selected points 253 set(currentaxes,'XLim',xlim) 254 end 255 if yoverx >0.5 256 ylim(2)=0.5*xy(1,2)+0.5*ylim(2); 257 ylim(1)=0.5*xy(1,2)+0.5*ylim(1); 258 set(currentaxes,'YLim',ylim) 259 end 260 261 % if right mouse button has been pressed, zoom out by a factor of 2 255 262 else 256 263 xlim(1)=2*xlim(1)-xy(1,1);% reverse of the zoom on action … … 267 274 ylim=AxeData.RangeY; 268 275 end 269 % desactivate the zoom if the full field is visible within the axes276 % desactivate the zoom if the full field is visible within the axes 270 277 if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY) 271 278 set(hhuvmat.CheckZoom,'Value',0) … … 323 330 %% finalising ruler 324 331 if test_ruler 325 set(hhuvmat.MenuRuler,'checked','off')%desable the ruler option in uvmat 326 xy=get(currentaxes,'CurrentPoint');% get the current mouse coordinates 327 RulerCoord=[AxeData.RulerCoord ;xy(1,1:2)];% append the recorded ruler origin to the current mouse coordinates 332 set(hhuvmat.MenuRuler,'checked','off')%desable the ruler option in uvmat 333 xy=get(currentaxes,'CurrentPoint');% get the current mouse coordinates 334 RulerCoord=[AxeData.RulerCoord ;xy(1,1:2)];% append the recorded ruler origin to the current mouse coordinates 328 335 RulerCoord=diff(RulerCoord,1);% coordiante difference between segment end and beginning 329 336 RulerCoord=RulerCoord(1)+i*RulerCoord(2); -
trunk/src/uvmat.m
r477 r483 3084 3084 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 3085 3085 [tild,tild,tild,i1,i2,j1,j2,tild,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]); 3086 % NomTypeNew=NomType;%default3087 3086 if isequal(field,'image') 3088 % if isequal(NomType,'_1-2_1')||isequal(NomType,'_1_1-2') 3089 % NomTypeNew='_1_1'; 3090 % elseif isequal(NomType,'#_ab') 3091 % NomTypeNew='#a'; 3092 % elseif isequal(NomType,'_1-2') 3093 % NomTypeNew='_1'; 3094 % end 3095 imagename=fullfile_uvmat(RootPath,SubDir,RootFile,'.png',NomType,i1,[],j1,[]); 3087 SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 3088 imagename=fullfile_uvmat(RootPath,SubDirBase,RootFile,'.png',NomType,i1,[],j1,[]); 3096 3089 if ~exist(imagename,'file') 3097 3090 [FileName,PathName] = uigetfile( ... … … 3197 3190 case 'image' 3198 3191 % guess the image name corresponding to the current netcdf name (no unique correspondance) 3199 imagename=fullfile_uvmat(RootPath_1,'',RootFile_1,'.png',get(handles.NomType,'String'),i1,[],j1); 3192 SubDirBase=regexprep(SubDir_1,'\..*','');%take the root part of SubDir, before the first dot '.' 3193 imagename=fullfile_uvmat(RootPath_1,SubDirBase,RootFile_1,'.png',get(handles.NomType,'String'),i1,[],j1); 3200 3194 if ~exist(imagename,'file') % browse for images if it is not found 3201 3195 [FileName,PathName] = uigetfile( ...
Note: See TracChangeset
for help on using the changeset viewer.