Changeset 795 for trunk


Ignore:
Timestamp:
Jul 7, 2014, 1:51:17 PM (7 years ago)
Author:
sommeria
Message:

read_rdvision corrected

Location:
trunk/src/series
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/civ_input.m

    r784 r795  
    14851485end
    14861486if testmask
    1487     if strcmp(parent_tag,'Civ1')
     1487   % if strcmp(parent_tag,'Civ1')
    14881488        set(handles.Mask,'Visible','on')
    14891489        set(handles.Mask,'String',filemask)
    14901490    set(handles.CheckMask,'Value',1)
    1491     end
     1491   % end
    14921492else
    14931493    set(hObject,'Value',0);
  • trunk/src/series/extract_rdvision.m

    r792 r795  
    7676RootFile=Param.InputTable(:,3);
    7777SubDir=Param.InputTable(:,2);
    78 NomType=Param.InputTable(:,4);
    7978FileExt=Param.InputTable(:,5);
    8079
     
    8281% input file or frame indices i1_series,i2_series,j1_series,j2_series
    8382[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
     83filename=fullfile_uvmat(RootPath{1},SubDir{1},RootFile{1},FileExt{1},'*',1);
     84OutputDir=[Param.OutputSubDir Param.OutputDirExt];
    8485 
    8586% numbers of slices and file indices
    86 
    8787nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
    8888nbfield_i=size(i1_series{1},2); %nb of fields for the i index
     
    9494%     return
    9595% end
    96 FileInfo{1}=get_file_info(filecell{1,1});
    97 if ~strcmp(FileInfo{1}.FileType,'rdvision')
     96FileInfo=get_file_info(filecell{1,1});
     97if ~strcmp(FileInfo.FileType,'rdvision')
    9898    msgbox_uvmat('ERROR','the input is not from rdvision: a .seq or .sqb file must be opened')
    9999    return
     
    124124end
    125125
     126
    126127%% check coincidence in time for several input file series
    127128% not relevant
     
    143144first_label=0; %image numbers start from 0
    144145
    145 %% copy and adapt the xml file
    146 NomTypeNew='_1_1';
    147 if ~isempty(XmlData)
    148         t=xmltree(filexml);
    149        
    150         %update information on the first image name in the series
    151         uid_Heading=find(t,'ImaDoc/Heading');
    152         if isempty(uid_Heading)
    153             [t,uid_Heading]=add(t,1,'element','Heading');
    154         end
    155         uid_ImageName=find(t,'ImaDoc/Heading/ImageName');
    156         j1=[];
    157         if ~isempty(j1_series{1})
    158             j1=j1_series{1};
    159         end
    160         ImageName=fullfile_uvmat(RootPath{1},SubDir{1},RootFile{1},FileExt{1},'_1_1',i1_series{1}(1),[],j1);
    161         [pth,ImageName]=fileparts(ImageName);
    162         ImageName=[ImageName '.png'];
    163         if isempty(uid_ImageName)
    164             [t,uid_ImageName]=add(t,uid_Heading,'element','ImageName');
    165         end
    166         uid_value=children(t,uid_ImageName);
    167         if isempty(uid_value)
    168             t=add(t,uid_ImageName,'chardata',ImageName);%indicate  name of the first image, with ;png extension
    169         else
    170             t=set(t,uid_value(1),'value',ImageName);%indicate  name of the first image, with ;png extension
    171         end
    172        
    173         %%%% correction RDvision %%%%
    174         if isfield(XmlData,'NbDtj')
    175             uid_NbDtj=find(t,'ImaDoc/Camera/BurstTiming/NbDtj');
    176             uid_value=children(t,uid_NbDtj);
    177             if ~isempty(uid_value)
    178                 t=set(t,uid_value(1),'value',num2str(XmlData.NbDtj));
    179             end
    180         end
    181         if isfield(XmlData,'NbDtk')
    182             uid_NbDtk=find(t,'ImaDoc/Camera/BurstTiming/NbDtk');
    183             uid_value=children(t,uid_NbDtk);
    184             if ~isempty(uid_value)
    185                 t=set(t,uid_value(1),'value',num2str(XmlData.NbDtk));
    186             end
    187         end
    188         if isempty(j1_series{1}) && isfield(XmlData,'NbDti')
    189             uid_Dti=find(t,'ImaDoc/Camera/BurstTiming/Dti');
    190             t=add(t,uid_Dti,'chardata',num2str(XmlData.Dti));
    191             uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti');
    192             t=add(t,uid_NbDti,'chardata',num2str(XmlData.NbDti));
    193             uid_NbDtj=find(t,'ImaDoc/Camera/BurstTiming/NbDtj');
    194             uid_NbDtk=find(t,'ImaDoc/Camera/BurstTiming/NbDtk');
    195             t=delete(t,uid_NbDtj);
    196             t=delete(t,uid_NbDtk);
    197             uid_Dtj=find(t,'ImaDoc/Camera/BurstTiming/Dtj');
    198             uid_Dtk=find(t,'ImaDoc/Camera/BurstTiming/Dtk');
    199             t=delete(t,uid_Dtj);
    200             t=delete(t,uid_Dtk);
    201             NomTypeNew='_1';
    202         end
    203             SubDirBase=regexprep(SubDir{1},'\..*','');%take the root part of SubDir, before the first dot '.'
    204    % filexml_new=[fullfile(RootPath{1},SubDirBase) '.xml'];
    205         save(t,filexml)
    206 end
     146%% correction to RDvision xml file
     147t=xmltree(filexml);
     148
     149% correct Dtj and Dtk
     150NomTypeNew='_1_1';% new file nomencalture by default
     151ImageName='img_1_1.png';% first image name
     152if isfield(XmlData,'NbDtj')
     153    uid_NbDtj=find(t,'ImaDoc/Camera/BurstTiming/NbDtj');
     154    uid_value=children(t,uid_NbDtj);
     155    if ~isempty(uid_value)
     156        t=set(t,uid_value(1),'value',num2str(XmlData.NbDtj));
     157    end
     158end
     159if isfield(XmlData,'NbDtk')
     160    uid_NbDtk=find(t,'ImaDoc/Camera/BurstTiming/NbDtk');
     161    uid_value=children(t,uid_NbDtk);
     162    if ~isempty(uid_value)
     163        t=set(t,uid_value(1),'value',num2str(XmlData.NbDtk));
     164    end
     165end
     166if isempty(j1_series{1}) && isfield(XmlData,'NbDti')
     167    uid_Dti=find(t,'ImaDoc/Camera/BurstTiming/Dti');
     168    t=add(t,uid_Dti,'chardata',num2str(XmlData.Dti));
     169    uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti');
     170    t=add(t,uid_NbDti,'chardata',num2str(XmlData.NbDti));
     171    uid_NbDtj=find(t,'ImaDoc/Camera/BurstTiming/NbDtj');
     172    uid_NbDtk=find(t,'ImaDoc/Camera/BurstTiming/NbDtk');
     173    t=delete(t,uid_NbDtj);
     174    t=delete(t,uid_NbDtk);
     175    uid_Dtj=find(t,'ImaDoc/Camera/BurstTiming/Dtj');
     176    uid_Dtk=find(t,'ImaDoc/Camera/BurstTiming/Dtk');
     177    t=delete(t,uid_Dtj);
     178    t=delete(t,uid_Dtk);
     179    NomTypeNew='_1';
     180    ImageName='img_1.png';
     181end
     182
     183%update information of 'Heading'
     184uid_Heading=find(t,'ImaDoc/Heading');
     185if isempty(uid_Heading)
     186    [t,uid_Heading]=add(t,1,'element','Heading');
     187end
     188uid_SubCampaign=find(t,'ImaDoc/Heading/SubCampaign');
     189if ~isempty(uid_SubCampaign), t=delete(t,uid_SubCampaign); end
     190uid_Experiment=find(t,'ImaDoc/Heading/Experiment');
     191if ~isempty(uid_Experiment), t=delete(t,uid_Experiment); end
     192uid_Device=find(t,'ImaDoc/Heading/Device');
     193if ~isempty(uid_Device), t=delete(t,uid_Device); end
     194uid_Record=find(t,'ImaDoc/Heading/Record');
     195if ~isempty(uid_Record), t=delete(t,uid_Record); end
     196uid_DateExp=find(t,'ImaDoc/Heading/DateExp');
     197if ~isempty(uid_DateExp), t=delete(t,uid_DateExp); end
     198
     199%indicate the name of the first image (as a check that the xml file is not moved)
     200uid_ImageName=find(t,'ImaDoc/Heading/ImageName');
     201if isempty(uid_ImageName)
     202    [t,uid_ImageName]=add(t,uid_Heading,'element','ImageName');
     203end
     204uid_value=children(t,uid_ImageName);
     205if isempty(uid_value)
     206    t=add(t,uid_ImageName,'chardata',ImageName);%indicate  name of the first image, with ;png extension
     207else
     208    t=set(t,uid_value(1),'value',ImageName);%indicate  name of the first image, with ;png extension
     209end
     210
     211%indicate the date and time of the image acquisition start
     212if isfield(FileInfo,'binrepertoire') && isfield(FileInfo,'starttime')
     213    sep_pos=regexp(FileInfo.binrepertoire,'T');
     214    DateTime=FileInfo.starttime;
     215    if ~isempty(sep_pos)
     216        DateTime=[FileInfo.binrepertoire(1:sep_pos-1) ' ' DateTime];
     217    end
     218    uid_DateTime=find(t,'ImaDoc/Heading/DateTime');
     219    if isempty(uid_DateTime)
     220        [t,uid_DateTime]=add(t,uid_Heading,'element','DateTime');
     221    end
     222    uid_value=children(t,uid_DateTime);
     223    if isempty(uid_value)
     224        t=add(t,uid_DateTime,'chardata',DateTime);%indicate  name of the first image, with ;png extension
     225    else
     226        t=set(t,uid_value(1),'value',DateTime);%indicate  name of the first image, with ;png extension
     227    end
     228end
     229 
     230%% backup the previous xml file and save the corrected one
     231[success,message]=copyfile(filexml,[filexml '~']);%make backup
     232if success~=1
     233    dips(['errror in xml file backup: ' message]);
     234    return
     235end
     236save(t,filexml)
    207237
    208238%% main loop on images
    209 %j1=[];%default
    210239nbfield2=1;
    211240if isfield(XmlData,'Time')
    212241nbfield2=size(XmlData.Time,2);
    213242end
    214 filename=fullfile_uvmat(RootPath{1},SubDir{1},RootFile{1},FileExt{1},'*',1);
    215 OutputDir=[Param.OutputSubDir Param.OutputDirExt];
    216243for ifile=1:nbfield
    217244            update_waitbar(WaitbarHandle,ifile/nbfield)
Note: See TracChangeset for help on using the changeset viewer.