Changeset 456 for trunk/src/uvmat.m
- Timestamp:
- Jun 17, 2012, 10:50:20 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.