Changeset 1076
- Timestamp:
- Jan 24, 2020, 8:26:09 PM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/browse_data.m
r1071 r1076 76 76 set(hObject, 'Position', FigPos); 77 77 set(hObject, 'Units', OldUnits); 78 % if exist('MultiDevices','var') && strcmp(MultiDevices,'on')79 % set(handles.DataSeries,'Max',2)80 % else81 % set(handles.DataSeries,'Max',1)82 % end83 78 if exist('EnableMirror','var') && strcmp(EnableMirror,'on') 84 79 set(handles.CreateMirror,'Visible','on') … … 113 108 end 114 109 s=[]; 115 % if exist(RootXml,'file')116 % [s,Heading]=xml2struct(RootXml);%read the xml file117 % if isfield(s,'SourceDir')118 % set(handles.SourceDir,'String',s.SourceDir);%display the source dir if a mirror has been opened119 % set(handles.MirrorDir,'Visible','on');% mirror dir display120 % set(handles.MirrorDir,'String',Campaign);%display the opened mirror dir121 % set(handles.CreateMirror,'String','update_mirror')122 % end123 % end124 110 if isempty(s) %a source dir has been opened 125 111 set(handles.SourceDir,'String',SourceDir{1}); … … 355 341 ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray 356 342 ListFiles=ListCells(1,:); 357 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 343 index_isdir=find(strcmp('isdir',fieldnames(ListStruct))); 344 check_dir=cell2mat(ListCells(index_isdir,:));% =1 for directories, =0 for files 358 345 ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+','+/$0');% put '+/' in front of dir name display 359 346 cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . ) … … 383 370 ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray 384 371 ListFiles=ListCells(1,:); 385 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 372 index_isdir=find(strcmp('isdir',fieldnames(ListStruct))); 373 check_dir=cell2mat(ListCells(index_isdir,:));% =1 for directories, =0 for files 386 374 ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+','+/$0');% put '+/' in front of dir name display 387 375 cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . ) … … 430 418 ListFiles=ListCells(1,:); 431 419 check_xml=~cellfun('isempty',regexp(ListFiles,'(\.xml|~)$'));% detect non xml files and files not marked by ~ 432 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 420 index_isdir=find(strcmp('isdir',fieldnames(ListStruct))); 421 check_dir=cell2mat(ListCells(index_isdir,:));% =1 for directories, =0 for files 433 422 nbfiles=numel(find(~check_xml & ~check_dir));% number of non xml files 434 423 check_dir=check_dir & cellfun('isempty', regexp(ListFiles,'^(-|\.|\+/\.)'));% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . ) … … 481 470 cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . ) 482 471 check_keep=cellfun('isempty', cell_remove); 483 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 472 index_isdir=find(strcmp('isdir',fieldnames(ListStruct))); 473 check_dir=cell2mat(ListCells(index_isdir,:));% =1 for directories, =0 for files 484 474 for ilist=1:numel(ListFiles) 485 475 if check_keep(ilist)% loop on eligible DataSeries folders -
trunk/src/geometry_calib.m
r1071 r1076 269 269 %%%%% use of the option 'replicate' 270 270 if get(handles.Replicate,'Value')% if the option replicate is activated 271 nbcalib=0;271 %nbcalib=0; 272 272 %% open the GUI browse_data 273 273 hbrowse=findobj(allchild(0),'Tag','browse_data'); 274 if ~isempty(hbrowse)% look for the GUI 'replicate'274 if ~isempty(hbrowse)% look for the GUI browse_data 275 275 BrowseData=guidata(hbrowse); 276 276 SourceDir=get(BrowseData.SourceDir,'String'); … … 322 322 display([XmlName ' created with calibration parameters']) 323 323 end 324 nbcalib=nbcalib+1;324 %nbcalib=nbcalib+1; 325 325 end 326 326 end -
trunk/src/update_imadoc.m
r1071 r1076 31 31 testappend=0; 32 32 %% backup the output file if it already exist, and read it 33 if exist(outputfile,'file') ;%=1 if the output file already exists, 0 else33 if exist(outputfile,'file')%=1 if the output file already exists, 0 else 34 34 testappend=1; 35 35 backupfile=outputfile; -
trunk/src/uvmat.m
r1075 r1076 1288 1288 'TEST' 1289 1289 else 1290 1291 %% store the result in the xml file used for calibration1292 errormsg=update_imadoc(GeometryCalib,XmlFile,'GeometryCalib');% introduce the calibration data in the xml file1293 if strcmp(errormsg,'')1294 msgbox_uvmat('CONFIRMATION',['slice positions saved in ' XmlFile]);1295 else1296 msgbox_uvmat('ERROR',errormsg);1297 end1298 1299 %% display image with new calibration in the currently opened uvmat interface1300 %set(hhuvmat.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' to plot the whole image1301 uvmat('InputFileREFRESH_Callback',huvmat,[],hhuvmat); %file input with xml reading in uvmat, show the image in phys coordinates1302 set(hObject,'BackgroundColor',[1 0 0]);% paint button back to red1290 1291 %% store the result in the xml file used for calibration 1292 errormsg=update_imadoc(GeometryCalib,XmlFile,'GeometryCalib');% introduce the calibration data in the xml file 1293 if strcmp(errormsg,'') 1294 msgbox_uvmat('CONFIRMATION',['slice positions saved in ' XmlFile]); 1295 else 1296 msgbox_uvmat('ERROR',errormsg); 1297 end 1298 1299 %% display image with new calibration in the currently opened uvmat interface 1300 %set(hhuvmat.CheckFixLimits,'Value',0)% put FixedLimits option to 'off' to plot the whole image 1301 uvmat('InputFileREFRESH_Callback',huvmat,[],hhuvmat); %file input with xml reading in uvmat, show the image in phys coordinates 1302 set(hObject,'BackgroundColor',[1 0 0]);% paint button back to red 1303 1303 end 1304 1304 … … 1323 1323 end 1324 1324 1325 %1326 % set(hObject,'BackgroundColor',[1 1 0])1327 % drawnow1328 %1329 % %% read the GUI set_slice1330 % SliceData=read_GUI(get(hObject,'parent'));1331 %1332 % %% get info on the GUI uvmat1333 % huvmat=findobj(allchild(0),'Tag','uvmat');1334 % hhuvmat=guidata(huvmat);1335 % RootPath=read_file_boxes(hhuvmat);1336 %1337 % OutPutDir=uigetfile_uvmat('choose an image folder to document with slice position?',fileparts(RootPath),'uigetdir');1338 % OutPut=browse_data(OutPutDir,'off','on');1339 % nbcalib=0;1340 % for ilist=1:numel(OutPut.Experiment)1341 % for idevice=1:numel(OutPut.DataSeries)1342 % SubDirBase=regexprep(OutPut.DataSeries{idevice},'\..+$','');1343 % XmlFile=fullfile(OutPut.Campaign,OutPut.Experiment{ilist},[SubDirBase '.xml']);1344 %1345 % % read the current xml file1346 % if exist(XmlFile,'file')1347 % [s,errormsg]=imadoc2struct(XmlFile,'GeometryCalib');1348 % if ~isempty(errormsg)1349 % msgbox_uvmat('ERROR',['error in reading ' XmlFile ': ' errormsg])1350 % return1351 % end1352 % GeometryCalib=s.GeometryCalib;1353 % GeometryCalib.NbSlice=SliceData.NbSlice;1354 % GeometryCalib.CheckVolumeScan=SliceData.CheckVolumeScan;1355 % Z_plane=linspace(SliceData.Z(1),SliceData.Z(2),SliceData.NbSlice);1356 % GeometryCalib.SliceCoord=Z_plane'*[0 0 1];1357 % GeometryCalib.SliceAngle=zeros(GeometryCalib.NbSlice,3);1358 % Angle_1=linspace(SliceData.SliceAngle_1(1),SliceData.SliceAngle_1(2),SliceData.NbSlice);1359 % Angle_2=linspace(SliceData.SliceAngle_2(1),SliceData.SliceAngle_2(2),SliceData.NbSlice);1360 % GeometryCalib.SliceAngle(:,1)=Angle_1';%rotation around x axis (to generalise)1361 % GeometryCalib.SliceAngle(:,2)=Angle_2';%rotation around y axis (to generalise)1362 % GeometryCalib.SliceAngle(:,3)=0;1363 % if SliceData.CheckRefraction1364 % GeometryCalib.InterfaceCoord=[0 0 SliceData.H];1365 % GeometryCalib.RefractionIndex=SliceData.RefractionIndex;1366 % elseif isfield(GeometryCalib,'RefractionIndex')1367 % GeometryCalib=rmfield(GeometryCalib,'RefractionIndex');1368 % GeometryCalib=rmfield(GeometryCalib,'InterfaceCoord');1369 % end1370 %1371 % % update the current xml file1372 % errormsg=update_imadoc(GeometryCalib,XmlFile,'GeometryCalib');% introduce the calibration data in the xml file1373 % if ~strcmp(errormsg,'')1374 % msgbox_uvmat('ERROR',errormsg);1375 % else1376 % display([XmlFile ' updated with slice positions'])1377 % nbcalib=nbcalib+1;1378 % end1379 % end1380 % end1381 % end1382 % set(hObject,'BackgroundColor',[1 0 0])1383 % msgbox_uvmat('CONFIMATION',[SubDirBase ' calibrated with slice positions for ' num2str(nbcalib) ' experiments']);1384 %1385 1325 1386 1326 %------------------------------------------------------------------------ … … 1431 1371 UvData.ProjObject{5}=data; 1432 1372 UvData.ProjObject{5}.DisplayHandle.uvmat=plot_object(UvData.ProjObject{5},UvData.ProjObject{1},handles.PlotAxes,'b'); 1433 end 1434 end 1435 set(handles.ListObject,'String',ListObjectName) 1436 set(handles.ListObject,'Value',1) 1437 set(handles.uvmat,'UserData',UvData); 1438 1373 end 1374 set(handles.ListObject,'String',ListObjectName) 1375 set(handles.ListObject,'Value',1) 1376 set(handles.uvmat,'UserData',UvData); 1377 answer=msgbox_uvmat('INPUT_Y-N', 'keep calibration lines'); 1378 if ~strcmp(answer,'Yes') 1379 return 1380 end 1381 end 1439 1382 %% read lines currently drawn 1440 1383 ListObj=UvData.ProjObject;% get the current list of projection objects … … 1442 1385 select_mask=zeros(1,numel(ListObj)); 1443 1386 for iobj=1:numel(ListObj) 1444 if isfield(ListObj{iobj},'Type') && strcmp(ListObj{iobj}.Type,'line') && ~strcmp(ListObj{iobj}.Name,'MaskPolygon')1387 if isfield(ListObj{iobj},'Type') && strcmp(ListObj{iobj}.Type,'line') 1445 1388 select_line(iobj)=1;% select the lines among the projection objects 1446 1389 end … … 1455 1398 else 1456 1399 LineData=UvData.ProjObject(find(select_line)); 1457 for iobj=1: length(LineData)1400 for iobj=1:2 1458 1401 xA(iobj)=LineData{iobj}.Coord(1,1); 1459 1402 yA(iobj)=LineData{iobj}.Coord(1,2); … … 1465 1408 1466 1409 %% set the image offset 1467 blackoffset=0; 1410 BlackOffset=0; 1411 RefLineWidth=20; 1468 1412 if isfield(XmlData,'LIFCalib')&& isfield(XmlData.LIFCalib,'BlackOffset') 1469 blackoffset=XmlData.LIFCalib.BlackOffset ;% image value for black background, to be determined by taking images with a cover on the objective lens 1470 end 1471 1472 prompt = {'offset luminosity value in the absence of illumination';'smoothing length for the reference line (in pixels)'}; 1413 BlackOffset=XmlData.LIFCalib.BlackOffset ;% image value for black background, to be determined by taking images with a cover on the objective lens 1414 RefLineWidth=XmlData.LIFCalib.RefLineWidth; 1415 end 1416 1417 prompt = {'offset luminosity value in the absence of illumination';'smoothing width for the reference line (in pixels)'}; 1473 1418 dlg_title = 'set the parameters for LIF'; 1474 1419 num_lines= 2; 1475 def = { '0';'20'};1420 def = { num2str(BlackOffset);num2str(RefLineWidth)}; 1476 1421 answer = inputdlg(prompt,dlg_title,num_lines,def); 1477 1478 if strcmp(answer,'Cancel') 1422 if isempty(answer) 1479 1423 return 1480 1424 else 1481 XmlData.LIFCalib.BlackOffset=str2 num(answer{1}) ;% image value for black background, to be determined by taking images with a cover on the objective lens1482 XmlData.LIFCalib. SmoothingLength=str2num(answer{2}) ;% smoothing length used for the reference line1425 XmlData.LIFCalib.BlackOffset=str2double(answer{1}) ;% image value for black background, to be determined by taking images with a cover on the objective lens 1426 XmlData.LIFCalib.RefLineWidth=str2double(answer{2}) ;% smoothing width used for the reference line 1483 1427 end 1484 1428 … … 1510 1454 1511 1455 %% use the third line for reference luminosity, renormalize the image intensity along each ray to get a uniform brightness along this line 1512 %UvData.Field.CoordMesh1513 1456 if numel(find(select_line))==3 1514 1457 x_ref=linspace(LineData{3}.Coord(1,1),LineData{3}.Coord(2,1),10); … … 1528 1471 line_nan= isnan(dist_source); 1529 1472 dist_source_pixel(line_nan)=1; 1530 width=XmlData.LIFCalib.SmoothingLength; %number of pixels used for reference1531 1473 DataPol.A=double(DataPol.A)-XmlData.LIFCalib.BlackOffset;% black background substracted 1532 1474 Anorm=zeros(size(DataPol.A)); 1533 1475 for iline=1:size(DataPol.A,1) 1534 lum(iline)=mean(DataPol.A(iline,dist_source_pixel(iline):dist_source_pixel(iline)+ width));% average the luminosity on a band width lying on the reference line1476 lum(iline)=mean(DataPol.A(iline,dist_source_pixel(iline):dist_source_pixel(iline)+XmlData.LIFCalib.RefLineWidth));% average the luminosity on a band width lying on the reference line 1535 1477 Anorm(iline,:)=DataPol.A(iline,:)/lum(iline);% for each ray (iline), renormalise the image by the brightness at the reference line 1536 1478 end … … 1569 1511 end 1570 1512 1571 %loop on lines iY (angle in polar coordiantes) 1572 gamma_coeff=zeros(1,npy); 1573 for iY=1:npy 1574 ALine=A(iY,:); 1575 RLine=R(iY,:); 1513 %% loop on lines iY (angle in polar coordiantes) 1514 gamma_coeff=NaN(1,npy); 1515 fitlength=NaN(1,npy); 1516 for iY=1:npy% loop on the y index of the image in polar coordinate 1517 ALine=A(iY,:);%profile of image luminosity log (vs radial index) 1518 RLine=R(iY,:);%radius of the reference line (vs radial index) 1576 1519 ThetaLine=Theta(iY,:)*pi/180; 1577 1520 [XLine,YLine] = pol2cart(ThetaLine,RLine); … … 1579 1522 YLine=YLine+y0; 1580 1523 if ~isempty(index_mask) 1581 ind_good=inpolygon(XLine,YLine,MaskData.Coord(:,1),MaskData.Coord(:,2));1582 if numel(find( ind_good))>1001583 ALine=ALine( ind_good);1584 RLine=RLine( ind_good);1524 check_good=inpolygon(XLine,YLine,MaskData.Coord(:,1),MaskData.Coord(:,2)); 1525 if numel(find(check_good))>npx/4;% keep only lines with reasonable length 1526 ALine=ALine(check_good); 1527 RLine=RLine(check_good); 1585 1528 else 1586 1529 continue … … 1589 1532 p = polyfit(RLine,ALine,1); 1590 1533 gamma_coeff(iY)=-p(1); 1534 fitlength(iY)=numel(find(check_good)); 1591 1535 end 1592 1536 … … 1605 1549 1606 1550 %% record the calibration data in the xml file 1607 XmlFileName=find_imadoc(get(handles.RootPath,'String'),get(handles.SubDir,'String'),get(handles.RootFile,'String'),get(handles.FileExt,'String')); 1608 answer=msgbox_uvmat('INPUT_Y-N','save the LIF parameters in the current xml file?'); 1609 if strcmp(answer,'Yes') 1610 t=xmltree(XmlFileName); %read the file 1611 title_str=get(t,1,'name'); 1612 if ~strcmp(title_str,'ImaDoc') 1613 msgbox_uvmat('ERROR','wrong xml file'); 1614 return 1615 end 1616 % backup the output file if it already exist, and read it 1617 backupfile=XmlFileName; 1618 testexist=2; 1619 while testexist==2 1620 backupfile=[backupfile '~']; 1621 testexist=exist(backupfile,'file'); 1622 end 1623 [success,message]=copyfile(XmlFileName,backupfile);%make backup 1624 if success~=1 1625 errormsg=['errror in xml file backup: ' message]; 1626 return 1627 end 1628 uid_illumination=find(t,'ImaDoc/LIFCalib'); 1629 if isempty(uid_illumination) %if GeometryCalib does not already exists, create it 1630 [t,uid_illumination]=add(t,1,'element','LIFCalib'); 1631 end 1632 uid_origin=find(t,'ImaDoc/LIFCalib/LightOrigin'); 1633 if ~isempty(uid_origin) %if LightOrigin already exists, delete it 1634 t=delete(t,uid_origin); 1635 end 1636 uid_line=find(t,'ImaDoc/LIFCalib/Ray1Coord'); 1637 if ~isempty(uid_line) %if Ray1Coord already exists, delete it 1638 t=delete(t,uid_line); 1639 end 1640 uid_line=find(t,'ImaDoc/LIFCalib/Ray2Coord'); 1641 if ~isempty(uid_line) %if Ray2Coord already exists, delete it 1642 t=delete(t,uid_line); 1643 end 1644 uid_line=find(t,'ImaDoc/LIFCalib/RefLineCoord'); 1645 if ~isempty(uid_line) %if RefLineCoord already exists, delete it 1646 t=delete(t,uid_line); 1647 end 1648 uid_mask=find(t,'ImaDoc/LIFCalib/MaskPolygonCoord'); 1649 if ~isempty(uid_mask) %if MaskPolygonCoord already exists, delete it 1650 t=delete(t,uid_mask); 1651 end 1652 uid_BlackOffset=find(t,'ImaDoc/LIFCalib/BlackOffset'); 1653 if ~isempty(uid_BlackOffset) %if BlackOffset already exists, delete it 1654 t=delete(t,uid_BlackOffset); 1655 end 1656 uid_DecayRate=find(t,'ImaDoc/LIFCalib/DecayRate'); 1657 if ~isempty(uid_DecayRate) %if DecayRate already exists, delete it 1658 t=delete(t,uid_DecayRate); 1659 end 1660 uid_RefLineRadius=find(t,'ImaDoc/LIFCalib/RefLineRadius'); 1661 if ~isempty(uid_RefLineRadius) %if RefLineLum already exists, delete it 1662 t=delete(t,uid_RefLineRadius); 1663 end 1664 uid_RefLineLum=find(t,'ImaDoc/LIFCalib/RefLineLum'); 1665 if ~isempty(uid_RefLineLum) %if RefLineLum already exists, delete it 1666 t=delete(t,uid_RefLineLum); 1667 end 1668 uid_RefLineAzimuth=find(t,'ImaDoc/LIFCalib/RefLineAzimuth'); 1669 if ~isempty(uid_RefLineAzimuth) %if RefLineLum already exists, delete it 1670 t=delete(t,uid_RefLineAzimuth); 1671 end 1672 1673 % save the LIF calibration data 1674 t=struct2xml(XmlData.LIFCalib,t,uid_illumination); 1675 save(t,XmlFileName); 1676 1551 hbrowse=browse_data(fullfile(get(handles.RootPath,'String'),get(handles.SubDir,'String'))); 1552 answer = questdlg('Where','record the LIF parameters','Current series', 'Replicate', 'Cancel', 'Cancel'); 1553 if strcmp(answer,'Current series') 1554 XmlFileName=find_imadoc(get(handles.RootPath,'String'),get(handles.SubDir,'String'),get(handles.RootFile,'String'),get(handles.FileExt,'String')); 1555 update_imadoc(XmlData.LIFCalib,XmlFileName,'LIFCalib');% introduce the calibration data in the xml file 1677 1556 % display the concentration in uvmat 1678 1557 InputFileREFRESH_Callback(hObject, eventdata, handles);% refresh the current xml file to apply 'ima2concentration' … … 1685 1564 set(handles.TransformName,'Value',ichoice) 1686 1565 TransformName_Callback(hObject, eventdata, handles) 1687 end 1566 elseif strcmp(answer,'Replicate') 1567 1568 BrowseData=guidata(hbrowse); 1569 SourceDir=get(BrowseData.SourceDir,'String'); 1570 ListExp=get(BrowseData.ListExperiments,'String'); 1571 ExpIndices=get(BrowseData.ListExperiments,'Value'); 1572 ListExp=ListExp(ExpIndices); 1573 ListDevices=get(BrowseData.ListDevices,'String'); 1574 DeviceIndices=get(BrowseData.ListDevices,'Value'); 1575 ListDevices=ListDevices(DeviceIndices); 1576 ListDataSeries=get(BrowseData.DataSeries,'String'); 1577 DataSeriesIndices=get(BrowseData.DataSeries,'Value'); 1578 ListDataSeries=ListDataSeries(DataSeriesIndices); 1579 NbExp=0; % counter of the number of experiments set by the GUI browse_data 1580 for iexp=1:numel(ListExp) 1581 if ~isempty(regexp(ListExp{iexp},'^\+/'))% if it is a folder 1582 for idevice=1:numel(ListDevices) 1583 if ~isempty(regexp(ListDevices{idevice},'^\+/'))% if it is a folder 1584 for isubdir=1:numel(ListDataSeries) 1585 if ~isempty(regexp(ListDataSeries{isubdir},'^\+/'))% if it is a folder 1586 lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),... 1587 regexprep(ListDevices{idevice},'^\+/','')); 1588 ldir= regexprep(ListDataSeries{isubdir},'^\+/',''); 1589 if exist(fullfile(lpath,ldir),'dir') 1590 NbExp=NbExp+1; 1591 ListPath{NbExp}=lpath; 1592 ListSubdir{NbExp}=ldir; 1593 ExpIndex{NbExp}=iexp; 1594 end 1595 end 1596 end 1597 end 1598 end 1599 end 1600 end 1601 for iexp=1:NbExp 1602 XmlName=fullfile(ListPath{iexp},[ListSubdir{iexp} '.xml']); 1603 if exist(XmlName,'file') 1604 check_update=1; 1605 else 1606 check_update=0; 1607 end 1608 errormsg=update_imadoc(XmlData.LIFCalib,XmlName,'LIFCalib');% introduce the calibration data in the xml file 1609 if ~strcmp(errormsg,'') 1610 msgbox_uvmat('ERROR',errormsg); 1611 else 1612 if check_update 1613 display([XmlName ' updated with calibration parameters']) 1614 else 1615 display([XmlName ' created with calibration parameters']) 1616 end 1617 end 1618 end 1619 msgbox_uvmat('CONFIMATION',['LIF calibration replicated for ' num2str(NbExp) ' experiments']); 1620 end 1621 1622 1623 1624 % 1625 % 1626 % t=xmltree(XmlFileName); %read the file 1627 % title_str=get(t,1,'name'); 1628 % if ~strcmp(title_str,'ImaDoc') 1629 % msgbox_uvmat('ERROR','wrong xml file'); 1630 % return 1631 % end 1632 % % backup the output file if it already exist, and read it 1633 % backupfile=XmlFileName; 1634 % testexist=2; 1635 % while testexist==2 1636 % backupfile=[backupfile '~']; 1637 % testexist=exist(backupfile,'file'); 1638 % end 1639 % [success,message]=copyfile(XmlFileName,backupfile);%make backup 1640 % if success~=1 1641 % errormsg=['errror in xml file backup: ' message]; 1642 % return 1643 % end 1644 % uid_illumination=find(t,'ImaDoc/LIFCalib'); 1645 % if isempty(uid_illumination) %if GeometryCalib does not already exists, create it 1646 % [t,uid_illumination]=add(t,1,'element','LIFCalib'); 1647 % end 1648 % uid_origin=find(t,'ImaDoc/LIFCalib/LightOrigin'); 1649 % if ~isempty(uid_origin) %if LightOrigin already exists, delete it 1650 % t=delete(t,uid_origin); 1651 % end 1652 % uid_line=find(t,'ImaDoc/LIFCalib/Ray1Coord'); 1653 % if ~isempty(uid_line) %if Ray1Coord already exists, delete it 1654 % t=delete(t,uid_line); 1655 % end 1656 % uid_line=find(t,'ImaDoc/LIFCalib/Ray2Coord'); 1657 % if ~isempty(uid_line) %if Ray2Coord already exists, delete it 1658 % t=delete(t,uid_line); 1659 % end 1660 % uid_line=find(t,'ImaDoc/LIFCalib/RefLineCoord'); 1661 % if ~isempty(uid_line) %if RefLineCoord already exists, delete it 1662 % t=delete(t,uid_line); 1663 % end 1664 % uid_mask=find(t,'ImaDoc/LIFCalib/MaskPolygonCoord'); 1665 % if ~isempty(uid_mask) %if MaskPolygonCoord already exists, delete it 1666 % t=delete(t,uid_mask); 1667 % end 1668 % uid_BlackOffset=find(t,'ImaDoc/LIFCalib/BlackOffset'); 1669 % if ~isempty(uid_BlackOffset) %if BlackOffset already exists, delete it 1670 % t=delete(t,uid_BlackOffset); 1671 % end 1672 % uid_RefLineWidth=find(t,'ImaDoc/LIFCalib/RefLineWidth'); 1673 % if ~isempty(uid_RefLineWidth) %if RefLineWidth already exists, delete it 1674 % t=delete(t,uid_RefLineWidth); 1675 % end 1676 % uid_DecayRate=find(t,'ImaDoc/LIFCalib/DecayRate'); 1677 % if ~isempty(uid_DecayRate) %if DecayRate already exists, delete it 1678 % t=delete(t,uid_DecayRate); 1679 % end 1680 % uid_RefLineRadius=find(t,'ImaDoc/LIFCalib/RefLineRadius'); 1681 % if ~isempty(uid_RefLineRadius) %if RefLineLum already exists, delete it 1682 % t=delete(t,uid_RefLineRadius); 1683 % end 1684 % uid_RefLineLum=find(t,'ImaDoc/LIFCalib/RefLineLum'); 1685 % if ~isempty(uid_RefLineLum) %if RefLineLum already exists, delete it 1686 % t=delete(t,uid_RefLineLum); 1687 % end 1688 % uid_RefLineAzimuth=find(t,'ImaDoc/LIFCalib/RefLineAzimuth'); 1689 % if ~isempty(uid_RefLineAzimuth) %if RefLineLum already exists, delete it 1690 % t=delete(t,uid_RefLineAzimuth); 1691 % end 1692 % 1693 % % save the LIF calibration data 1694 % t=struct2xml(XmlData.LIFCalib,t,uid_illumination); 1695 % save(t,XmlFileName); 1696 1697 1698 1688 1699 1689 1700
Note: See TracChangeset
for help on using the changeset viewer.