Changeset 456
- Timestamp:
- Jun 17, 2012, 10:50:20 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_file_series.m
r445 r456 235 235 end 236 236 %[tild,ifile_min]=min(ref_ij(ref_ij>0)); 237 i file_min=find(ref_ij>0 , 1);238 if isempty(i file_min)237 ind_select=find(ref_ij>0); 238 if isempty(ind_select) 239 239 % RootPath=''; 240 240 RootFile=''; 241 241 NomType=''; 242 242 else 243 [tild,ifile_min]=min(ref_ij(ind_select)); 243 244 [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) 244 245 NomType=regexprep(NomType,['^' NomTypePref],''); -
trunk/src/imadoc2struct.m
r215 r456 28 28 29 29 %% opening the xml file 30 if exist(ImaDoc,'file')~=2, errormsg=[ ImaDoc ' does not exist']; return;end;%input file does not exist 30 [tild,tild,FileExt]=fileparts(ImaDoc); 31 if strcmp(FileExt,'.civ') 32 [errormsg,time,TimeUnit,mode,npx,npy,XmlData{iview}.GeometryCalib]=read_imatext(ImaDoc); 33 return 34 end 31 35 try 32 36 t=xmltree(ImaDoc); 33 catch 34 errormsg={[ ImaDoc ' is not a valid xml file']; lasterr};37 catch ME 38 errormsg={['error reading ' ImaDoc ': ']; ME.message}; 35 39 display(errormsg); 36 40 return 37 41 end 38 42 uid_root=find(t,'/ImaDoc'); 39 if isempty(uid_root), errormsg=[ImaDoc ' is not an image documentation file ImaDoc']; return; end;%not an ImaDoc .xml file 40 43 if isempty(uid_root), return; end;%not an ImaDoc .xml file 41 44 42 45 %% Heading … … 283 286 end 284 287 end 288 289 %------------------------------------------------------------------------ 290 %'read_imatext': reads the .civ file for image documentation (obsolete) 291 % fileinput: name of the documentation file 292 % time: matrix of times for the set of images 293 %pxcmx: scale along x in pixels/cm 294 %pxcmy: scale along y in pixels/cm 295 function [error,time,TimeUnit,mode,npx,npy,GeometryCalib]=read_imatext(fileinput) 296 %------------------------------------------------------------------------ 297 error=0;%default 298 time=[]; %default 299 TimeUnit='s'; 300 mode='pairs'; 301 npx=[]; %default 302 npy=[]; %default 303 pxcmx=1;%default 304 pxcmy=1;%default 305 if exist(fileinput,'file')~=2, error=2, return;end;%input file does not exist 306 dotciv=textread(fileinput); 307 sizdot=size(dotciv); 308 if ~isequal(sizdot(1)-8,dotciv(1,1)); 309 error=1; %inconsistent number of bursts 310 end 311 nbfield=sizdot(1)-8; 312 npx=(dotciv(2,1)); 313 npy=(dotciv(2,2)); 314 pxcmx=(dotciv(6,1));% pixels/cm in the .civ file 315 pxcmy=(dotciv(6,2)); 316 % nburst=dotciv(3,1); % nbre of bursts 317 abs_time1=dotciv([9:nbfield+8],2); 318 dtime=dotciv(5,1)*(dotciv([9:nbfield+8],[3:end-1])+1); 319 timeshift=[abs_time1 dtime]; 320 time=cumsum(timeshift,2); 321 322 GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0]; 323 GeometryCalib.Tx=0; 324 GeometryCalib.Ty=0; 325 GeometryCalib.Tz=1; 326 GeometryCalib.dpx=1; 327 GeometryCalib.dpy=1; 328 GeometryCalib.sx=1; 329 GeometryCalib.Cx=0; 330 GeometryCalib.Cy=0; 331 GeometryCalib.f=1; 332 GeometryCalib.kappa1=0; 333 GeometryCalib.CoordUnit='cm'; -
trunk/src/mouse_down.m
r432 r456 132 132 if isequal(get(hObject,'SelectionType'),'alt') && isequal(get(hchild,'Visible'),'on') && ~isequal(get(hchild,'tag'),'frame_object')&&... 133 133 ~isequal(get(hchild,'tag'),'ListObject') 134 % if strcmp(get(hchild,'Visible'),'on')135 134 if ~strcmp(get(hchild,'Style'),'frame')%do not visualisaze frames 136 135 msg_pos(1:2)=GUI_pos(1:2)+obj_pos(1:2).*GUI_pos(3:4); … … 159 158 end 160 159 end 160 if ~isempty(output_str) 161 break %leave the current loop if a uicontrol has been selected 162 end 161 163 end 162 164 end -
trunk/src/series.m
r453 r456 539 539 MinIndex=get(handles.MinIndex,'Data');%retrieve the min indices in the table MinIndex 540 540 MaxIndex=get(handles.MaxIndex,'Data');%retrieve the max indices in the table MaxIndex 541 i_sum=sum(sum(i1_series,2),3); 541 i_sum=sum(sum(i1_series,2),3);%sum of i1_series on the last index 542 542 MaxIndex_i=max(find(i_sum>0))-1; 543 MinIndex_i=min(find(i_sum>0))-1; 544 j_sum=sum(sum(i1_series,1),3); 543 if isequal(i1_series(1),0) 544 MinIndex_i=0; 545 else 546 MinIndex_i=min(find(i_sum>0))-1; 547 end 548 j_sum=sum(sum(j1_series,1),3); 545 549 MaxIndex_j=max(find(j_sum>0))-1; 546 550 MinIndex_j=min(find(j_sum>0))-1; … … 650 654 651 655 %% update time table 656 if ~isempty(time) 652 657 TimeTable=get(handles.TimeTable,'Data'); 653 658 if isempty(MinIndex_j) 659 if MinIndex_i>0 654 660 TimeTable{iview,1}=time(MinIndex_i); 661 end 655 662 TimeTable{iview,2}=time(first_i); 656 663 TimeTable{iview,3}=time(last_i); 657 664 TimeTable{iview,4}=time(MaxIndex_i); 658 665 elseif ~isempty(time) 666 if MinIndex_i>0 659 667 TimeTable{iview,1}=time(MinIndex_i,MinIndex_j); 668 end 660 669 TimeTable{iview,2}=time(first_i,first_j); 661 670 TimeTable{iview,3}=time(last_i,last_j); … … 663 672 end 664 673 set(handles.TimeTable,'Data',TimeTable) 674 end 665 675 666 676 %% number of slices … … 1108 1118 else 1109 1119 enable_i(handles,'On') 1110 enable_j(handles,'On') 1120 if isempty(j1_series) 1121 enable_j(handles,'Off') 1122 else 1123 enable_j(handles,'On') 1124 end 1111 1125 end 1112 1126 fill_ListPair(handles,i1_series,i2_series,j1_series,j2_series,time) … … 1259 1273 set(handles.RUN, 'Enable','Off') 1260 1274 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 1275 drawnow 1261 1276 [h_fun,Series,filexml,errormsg]=prepare_jobs(handles); 1262 1277 if ~isempty(errormsg) 1263 1278 msgbox_uvmat('ERROR',errormsg) 1264 1279 else 1265 Series.Specific=h_fun(Series,0); 1280 %Series.Specific=h_fun(Series); 1281 Series=h_fun(Series); 1266 1282 t=struct2xml(Series); 1267 1283 t=set(t,1,'name','Series'); 1268 1284 save(t,filexml); 1269 h_fun(Series);1285 % h_fun(Series); 1270 1286 end 1271 1287 set(handles.RUN, 'Enable','On') … … 1293 1309 end 1294 1310 % update the xml file after interactive input with the function 1295 Series.Specific=h_fun( Series,0);1311 Series.Specific=h_fun('input?'); 1296 1312 t=struct2xml(Series); 1297 1313 t=set(t,1,'name','Series'); … … 1305 1321 return 1306 1322 end 1307 fctpath=get(handles.ActionPath,'String');1323 path_fct=get(handles.ActionPath,'String'); 1308 1324 text_matlabscript=[... 1309 1325 '#!/bin/bash \n'... … … 1311 1327 'matlab -nodisplay -nosplash -nojvm <<END_MATLAB \n'... 1312 1328 'cd(''' path_series '''); \n'... 1313 'addpath(''' fctpath'''); \n'...1329 'addpath(''' path_fct '''); \n'... 1314 1330 '' Series.Action '( ''' filename_xml '''); \n'... 1315 1331 'exit \n'... … … 1318 1334 fclose(fid); 1319 1335 if isunix 1320 system(['chmod +x ' filename_bat]); 1336 system(['chmod +x ' filename_bat]);% set the file to executable 1337 system(['. ' filename_bat]);%execute fct 1321 1338 end 1322 1339 set(handles.BATCH, 'Enable','On') 1323 1340 set(handles.BATCH,'BackgroundColor',[1 0 0]) 1341 1324 1342 %------------------------------------------------------------------------ 1325 1343 % --- Executes on button press in BIN. … … 1333 1351 1334 1352 %------------------------------------------------------------------------ 1335 % --- Main lau ch command, called by RUN and BATCH1353 % --- Main launch command, called by RUN and BATCH 1336 1354 function [h_fun,Series,filexml,errormsg]=prepare_jobs(handles) 1337 1355 %------------------------------------------------------------------------ 1356 filexml=''; 1338 1357 errormsg=''; 1339 1358 %% Read parameters from series … … 1343 1362 end 1344 1363 1345 %% read root name and field type1364 %% read index ranges 1346 1365 first_i=1; 1347 1366 last_i=1; … … 1463 1482 end 1464 1483 filexml=fullfile(Series.OutputDir,[Series.InputTable{1,3} '.xml']);% name of the parameter xml file set in this directory 1465 t=struct2xml(Series);1466 t=set(t,1,'name','Series');1467 save(t,filexml);1484 % t=struct2xml(Series); 1485 % t=set(t,1,'name','Series'); 1486 % save(t,filexml); 1468 1487 end 1469 1488 … … 1573 1592 InputText=textscan(fid,'%s',1,'delimiter','\n'); 1574 1593 fclose(fid) 1575 set(handles.ActionName,'ToolTipString',InputText{1}{1}) 1594 set(handles.ActionName,'ToolTipString',InputText{1}{1})% put the first line of the selected function as tooltip help 1576 1595 end 1577 1596 if ~isequal(path_series,PathName) … … 1617 1636 SeriesData.AllowInputSort=1; 1618 1637 set(handles.series,'UserData',SeriesData) 1619 end 1638 end 1639 case 'WholeIndexRange' 1640 if isequal(lower(varargout{ilist+1}),'on')% sort the input table by alphabetical order of the SubDir 1641 MinIndex=get(handles.MinIndex,'Data'); 1642 MaxIndex=get(handles.MaxIndex,'Data'); 1643 if ~isempty(MinIndex) 1644 set(handles.num_first_i,'String',num2str(MinIndex{1})) 1645 set(handles.num_last_i,'String',num2str(MaxIndex{1})) 1646 set(handles.num_incr_i,'String','1') 1647 if size(MinIndex,2)>=2 1648 set(handles.num_first_j,'String',num2str(MinIndex{1,2})) 1649 set(handles.num_last_j,'String',num2str(MaxIndex{1,2})) 1650 set(handles.num_incr_j,'String','1') 1651 end 1652 end 1653 end 1620 1654 case 'NbSlice' %hidden by default 1621 1655 if isequal(lower(varargout{ilist+1}),'on') -
trunk/src/uvmat.m
r452 r456 597 597 % read the current input file name: 598 598 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 599 if ~exist(fullfile(RootPath,SubDir),'dir') 600 msgbox_uvmat('ERROR',['directory ' fullfile(RootPath,SubDir) ' does not exist']) 601 return 602 end 599 603 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 600 604 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]); … … 608 612 % update_rootinfo_1(hObject,eventdata,handles) 609 613 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles); 614 if ~exist(fullfile(RootPath,SubDir),'dir') 615 msgbox_uvmat('ERROR',['directory ' fullfile(RootPath,SubDir) ' does not exist']) 616 return 617 end 610 618 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 611 619 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]); … … 908 916 SubDirBase=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 909 917 filexml=fullfile(RootPath,[SubDirBase '.xml']);% new convention: xml above the image dir 918 DocExt='.xml'; 910 919 if ~exist(filexml,'file') 911 920 filexml=fullfile(RootPath,SubDir,[RootFile '.xml']);%old convention: xml within the image directroy 921 if ~exist(filexml,'file') 922 filexml=fullfile(RootPath,SubDir,[RootFile '.civ']); % very old convention: .civ file 923 if ~exist(filexml,'file') 924 DocExt='.civ'; 925 else 926 filexml=''; 927 end 928 end 912 929 end 913 930 warntext='';%default warning message 914 931 NbSlice=1;%default 915 932 set(handles.RootPath,'BackgroundColor',[1 1 1]) 916 if exist(filexml,'file')933 if ~isempty(filexml) 917 934 set(handles.view_xml,'Visible','on') 918 935 set(handles.view_xml,'BackgroundColor',[1 1 0]) 919 936 set(handles.view_xml,'String','view .xml') 920 937 drawnow 921 [XmlData ,warntext]=imadoc2struct(filexml);938 [XmlDataRead,warntext]=imadoc2struct(filexml); 922 939 if ~isempty(warntext) 923 display(warntext) 924 % msgbox_uvmat('WARNING',warntext) 925 end 926 if isfield(XmlData,'TimeUnit') 927 if isfield(XmlData,'TimeUnit')&& ~isempty(XmlData.TimeUnit) 928 TimeUnit=XmlData.TimeUnit; 929 end 930 end 931 set(handles.view_xml,'BackgroundColor',[1 1 1]) 932 drawnow 933 if isfield(XmlData, 'GeometryCalib') && ~isempty(XmlData.GeometryCalib) 934 if isfield(XmlData.GeometryCalib,'VolumeScan') && isequal(XmlData.GeometryCalib.VolumeScan,'y') 935 set (handles.nb_slice,'String','volume') 936 end 937 hgeometry_calib=findobj('tag','geometry_calib'); 938 if ~isempty(hgeometry_calib) 939 GUserData=get(hgeometry_calib,'UserData'); 940 if ~(isfield(GUserData,'XmlInputFile') && strcmp(GUserData.XmlInputFile,filexml)) 941 answer=msgbox_uvmat('INPUT_Y-N','replace the display of geometry_calib with the new input data?'); 942 if strcmp(answer,'Yes') 943 geometry_calib(filexml);%diplay the new calibration points and parameters in geometry_calib 940 msgbox_uvmat('WARNING',warntext) 941 end 942 if isempty(XmlDataRead) 943 set(handles.view_xml,'Visible','off') 944 else 945 set(handles.view_xml,'String',['view ' DocExt]) 946 XmlData=XmlDataRead; 947 if isfield(XmlData,'TimeUnit') 948 if isfield(XmlData,'TimeUnit')&& ~isempty(XmlData.TimeUnit) 949 TimeUnit=XmlData.TimeUnit; 950 end 951 end 952 set(handles.view_xml,'BackgroundColor',[1 1 1]) 953 drawnow 954 if isfield(XmlData, 'GeometryCalib') && ~isempty(XmlData.GeometryCalib) 955 if isfield(XmlData.GeometryCalib,'VolumeScan') && isequal(XmlData.GeometryCalib.VolumeScan,'y') 956 set (handles.nb_slice,'String','volume') 957 end 958 hgeometry_calib=findobj('tag','geometry_calib'); 959 if ~isempty(hgeometry_calib) 960 GUserData=get(hgeometry_calib,'UserData'); 961 if ~(isfield(GUserData,'XmlInputFile') && strcmp(GUserData.XmlInputFile,filexml)) 962 answer=msgbox_uvmat('INPUT_Y-N','replace the display of geometry_calib with the new input data?'); 963 if strcmp(answer,'Yes') 964 geometry_calib(filexml);%diplay the new calibration points and parameters in geometry_calib 965 end 944 966 end 945 967 end 946 968 end 947 end948 else949 fileciv=fullfile(RootPath,SubDir,[RootFile '.civ']);950 if exist(fileciv,'file')% if .civ file found (very old convention)951 [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext(fileciv);952 GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0];953 GeometryCalib.Tx=0;954 GeometryCalib.Ty=0;955 GeometryCalib.Tz=1;956 GeometryCalib.dpx=1;957 GeometryCalib.dpy=1;958 GeometryCalib.sx=1;959 GeometryCalib.Cx=0;960 GeometryCalib.Cy=0;961 GeometryCalib.f=1;962 GeometryCalib.kappa1=0;963 GeometryCalib.CoordUnit='cm';964 XmlData.GeometryCalib=GeometryCalib;965 if error==2, warntext=['no file ' fileciv];966 elseif error==1, warntext='inconsistent number of fields in the .civ file';967 end968 set(handles.num_Npx,'String',num2str(npx));%fills nbre of pixels x box969 set(handles.num_Npy,'String',num2str(npy));%fills nbre of pixels y box970 set(handles.pxcm,'String',num2str(pxcmx));%fills scale x (pixel/cm) box971 set(handles.pycm,'String',num2str(pxcmy));%fills scale y (pixel/cm) box972 set(handles.pxcm,'Visible','on');%fills scale x (pixel/cm) box973 set(handles.pycm,'Visible','on');%fills scale y (pixel/cm) box974 set(handles.view_xml,'Visible','on')975 set(handles.view_xml,'String','view .civ')976 else977 set(handles.view_xml,'Visible','off')978 969 end 979 970 end … … 991 982 %transform .Time to a column vector if it is a line vector the nomenclature uses a single index 992 983 if isequal(size(XmlData.Time,1),1) 993 % if isequal(nbfield,1) && ~isequal(nbfield_j,1)% .Time is a line vector994 984 NomType=get(handles.NomType,'String'); 995 % if isempty(nbfield_j) 996 % if numel(NomType)>=2 &&(strcmp(NomType,'_i')||strcmp(NomType(1:2),'%0')||strcmp(NomType(1:2),'_%')) 997 XmlData.Time=(XmlData.Time)'; 985 XmlData.Time=(XmlData.Time)'; 998 986 end 999 987 end … … 2327 2315 abstime_1=[]; 2328 2316 end 2329 set(handles.abs_time,'String',num2str(abstime, 4))2330 set(handles.abs_time_1,'String',num2str(abstime_1, 4))2317 set(handles.abs_time,'String',num2str(abstime,5)) 2318 set(handles.abs_time_1,'String',num2str(abstime_1,5)) 2331 2319 % if testimedoc && isfield(UvData,'dt') 2332 2320 % dt=UvData.dt;
Note: See TracChangeset
for help on using the changeset viewer.