Changeset 470 for trunk/src


Ignore:
Timestamp:
Jun 22, 2012, 3:45:50 PM (12 years ago)
Author:
sommeria
Message:

functions upadated in series

Location:
trunk/src/series
Files:
4 edited

Legend:

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

    r464 r470  
    130130
    131131%% calibration data and timing: read the ImaDoc files
    132 mode=''; %default
    133 timecell={};
    134 itime=0;
    135 NbSlice_calib={};
    136 XmlData=cell(1,nbview);%initiate the structures containing the data from the xml file (calibration and timing)
    137 for iview=1:nbview%Loop on views
    138     SubDirBase=regexprep(SubDir{iview},'\..*','');%take the root part of SubDir, before the first dot '.'
    139     filexml=[fullfile(RootPath{iview},SubDirBase) '.xml'];%new convention: xml at the level of the image folder
    140     if ~exist(filexml,'file')
    141         filexml=[fullfile(RootPath{iview},SubDir{iview},RootFile{iview}) '.xml']; % old convention: xml inside the image folder
    142         if ~exist(filexml,'file')
    143             filexml=[fullfile(RootPath{iview},SubDir{iview},RootFile{iview}) '.civ']; % very old convention: .civ file
    144             if ~exist(filexml,'file')
    145                 filexml='';
    146             end
    147         end
    148     end
    149     if ~isempty(filexml)
    150         [XmlData{iview},error]=imadoc2struct(filexml);
    151     end
    152     if isfield(XmlData{iview},'Time')
    153         itime=itime+1;
    154         timecell{itime}=XmlData{iview}.Time;
    155     end
    156     if isfield(XmlData{iview},'GeometryCalib') && isfield(XmlData{iview}.GeometryCalib,'SliceCoord')
    157         NbSlice_calib{iview}=size(XmlData{iview}.GeometryCalib.SliceCoord,1);%nbre of slices for Zindex in phys transform
    158         if ~isequal(NbSlice_calib{iview},NbSlice_calib{1})
    159             msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series');
    160         end
    161     end
    162 end
    163 
    164 %% check coincidence in time for several input file series
    165 multitime=0;
    166 if isempty(timecell)
    167     time=[];
    168 elseif length(timecell)==1
    169     time=timecell{1};
    170 elseif length(timecell)>1
    171     multitime=1;
    172     for icell=1:length(timecell)
    173         if ~isequal(size(timecell{icell}),size(timecell{1}))
    174             msgbox_uvmat('WARNING','inconsistent time array dimensions in ImaDoc fields, the time for the first series is used')
    175             time=timecell{1};
    176             multitime=0;
    177             break
    178         end
    179     end
    180 end
    181 if multitime
    182     for icell=1:length(timecell)
    183         time(icell,:,:)=timecell{icell};
    184     end
     132[XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series);
     133if size(time,1)>1
    185134    diff_time=max(max(diff(time)));
    186135    if diff_time>0
    187136        msgbox_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)])
    188137    end   
    189 end
    190 if size(time,2) < i2_series{1}(end) ||( ~isempty(j2_series{1}) && size(time,3) < j2_series{1}(end))% time array absent or too short in ImaDoc xml file'
    191     time=[];
    192138end
    193139
  • trunk/src/series/check_data_files.m

    r457 r470  
    106106for iview=1:nbview
    107107    if isequal(FileType{iview},'mmreader')||isequal(FileType{iview},'video')||isequal(FileType{iview},'multimage')
    108         [tild,FileInfo]=get_file_type(filecell{iview,1})
    109       %  info=aviinfo(filecell{iview,1});
    110         message{1}=filecell{iview,1};%info.Filename;
    111         message{2}=FileInfo.FileModDate;
    112         message{3}=[num2str(FileInfo.FramesPerSecond) ' frames/s '];
    113         message{4}=FileInfo.ImageType;
    114         message{5}=['  compression' FileInfo.VideoCompression];
    115         message{6}=[ 'quality ' num2str(FileInfo.Quality)];   
    116         Tabchar=message;
     108        [tild,FileInfo]=get_file_type(filecell{iview,1});
     109        Tabchar{1}=filecell{iview,1};%info.Filename;
     110        Tabchar{2}=FileInfo.FileModDate;
     111        Tabchar{3}=[num2str(FileInfo.FramesPerSecond) ' frames/s '];
     112        Tabchar{4}=FileInfo.ImageType;
     113        Tabchar{5}=['  compression' FileInfo.VideoCompression];
     114        Tabchar{6}=[ 'quality ' num2str(FileInfo.Quality)];   
    117115    else
    118116        Tabchar={};
     
    130128                    detect=exist(file,'file'); % check the existence of the file
    131129                    if detect==0
    132 %                         count=count+1;
    133130                        lastfield='not found';
    134131                    else
     
    139136                        end                     
    140137                        lastfield='';
    141                         [FileType,FileInfo,Object]=get_file_type(file);
    142                         if strcmp(FileType,'civx')||strcmp(FileType,'civdata')
     138                        [FileType{iview},FileInfo,Object]=get_file_type(file);
     139                        if strcmp(FileType{iview},'civx')||strcmp(FileType{iview},'civdata')
    143140                            if isfield(FileInfo,'CivStage')
    144141                            liststage={'civ1','fix1','patch1','civ2','fix2','patch2'};
     
    146143                            end
    147144                        end
    148                         lastfield=[FileType ', ' lastfield];                   
     145                        lastfield=[FileType{iview} ', ' lastfield];                   
    149146                    end
    150147                    Tabchar(1,i_slice)={['slice #' num2str(i_slice)]};
  • trunk/src/series/merge_proj.m

    r464 r470  
    130130end
    131131
     132
    132133%% calibration data and timing: read the ImaDoc files
    133 mode=''; %default
    134 timecell={};
    135 itime=0;
    136 NbSlice_calib={};
    137 XmlData=cell(1,nbview);%initiate the structures containing the data from the xml file (calibration and timing)
    138 
    139 for iview=1:nbview%Loop on views
    140     SubDirBase=regexprep(SubDir{iview},'\..*','');%take the root part of SubDir, before the first dot '.'
    141     filexml=[fullfile(RootPath{iview},SubDirBase) '.xml'];%new convention: xml at the level of the image folder
    142     if ~exist(filexml,'file')
    143         filexml=[fullfile(RootPath{iview},SubDir{iview},RootFile{iview}) '.xml']; % old convention: xml inside the image folder
    144         if ~exist(filexml,'file')
    145             filexml=[fullfile(RootPath{iview},SubDir{iview},RootFile{iview}) '.civ']; % very old convention: .civ file
    146             if ~exist(filexml,'file')
    147                 filexml='';
    148             end
    149         end
    150     end
    151     if ~isempty(filexml)
    152         [XmlData{iview},error]=imadoc2struct(filexml);
    153     end
    154     if isfield(XmlData{iview},'Time')
    155         itime=itime+1;
    156         timecell{itime}=XmlData{iview}.Time;
    157     end
    158     if isfield(XmlData{iview},'GeometryCalib') && isfield(XmlData{iview}.GeometryCalib,'SliceCoord')
    159         NbSlice_calib{iview}=size(XmlData{iview}.GeometryCalib.SliceCoord,1);%nbre of slices for Zindex in phys transform
    160         if ~isequal(NbSlice_calib{iview},NbSlice_calib{1})
    161             msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series');
    162         end
    163     end
    164 end
    165 
    166 
    167 %% check coincidence in time for several input file series
    168 multitime=0;
    169 if isempty(timecell)
    170     time=[];
    171 elseif length(timecell)==1
    172     time=timecell{1};
    173 elseif length(timecell)>1
    174     multitime=1;
    175     for icell=1:length(timecell)
    176         if ~isequal(size(timecell{icell}),size(timecell{1}))
    177             msgbox_uvmat('WARNING','inconsistent time array dimensions in ImaDoc fields, the time for the first series is used')
    178             time=timecell{1};
    179             multitime=0;
    180             break
    181         end
    182     end
    183 end
    184 if multitime
    185     for icell=1:length(timecell)
    186         time(icell,:,:)=timecell{icell};
    187     end
     134[XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series);
     135if size(time,1)>1
    188136    diff_time=max(max(diff(time)));
    189137    if diff_time>0
     
    191139    end   
    192140end
    193 if size(time,2) < i2_series{1}(end) ||( ~isempty(j2_series{1}) && size(time,3) < j2_series{1}(end))% time array absent or too short in ImaDoc xml file'
    194     time=[];
    195 end
     141
    196142
    197143%% coordinate transform or other user defined transform
     
    266212    %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
    267213    for index=index_slice
     214 
    268215        if checkrun
    269216            update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield))
     
    285232            timeread(iview)=0;
    286233            if isfield(Data{iview},'Time')
    287                     timeread(iview)=Field{iview}.Time;
     234                    timeread(iview)=Data{iview}.Time;
    288235                    nbtime=nbtime+1;
    289236                end
     
    317264            return
    318265        end
    319              % time of the merged field:
    320         time_i=0;%default
    321         if isempty(time)% time from ImaDoc prevails
    322             time_i=sum(timeread)/nbtime;
    323         else
    324             time_i=(time(i1,j1)+time(i2,j2))/2; %TODO: upgrade
    325         end
     266       
     267        % time of the merged field:
     268        if ~isempty(time)% time defined from ImaDoc
     269            timeread=time(:,index);
     270        end
     271        timeread=mean(timeread);
     272       
    326273        % generating the name of the merged field
    327274        i1=i1_series{iview}(index);
     
    342289        end
    343290        OutputFile=fullfile_uvmat(RootPath{1},Param.OutputSubDir,RootFile{1},FileExtOut,NomType{1},i1,i2,j1,j2);
    344        
    345         % time of the merged field:
    346         time_i=0;%default
    347         if isempty(time)% time from ImaDoc prevails
    348             time_i=sum(timeread)/nbtime;
    349         else
    350             % time_i=i1;
    351             time_i=(time(i1,j1)+time(i2,j2))/2; %TODO: upgrade
    352         end
    353291       
    354292        % recording the merged field
     
    405343                MergeData.dt=dt;
    406344            end
    407             MergeData.Time=time_i;
     345            MergeData.Time=timeread;
    408346            error=struct2nc(OutputFile,MergeData);%save result file
    409347            if isempty(error)
  • trunk/src/series/time_series.m

    r464 r470  
    130130
    131131%% calibration data and timing: read the ImaDoc files
    132 mode=''; %default
    133 timecell={};
    134 itime=0;
    135 NbSlice_calib={};
    136 XmlData=cell(1,nbview);%initiate the structures containing the data from the xml file (calibration and timing)
    137 for iview=1:nbview%Loop on views
    138     SubDirBase=regexprep(SubDir{iview},'\..*','');%take the root part of SubDir, before the first dot '.'
    139     filexml=[fullfile(RootPath{iview},SubDirBase) '.xml'];%new convention: xml at the level of the image folder
    140     if ~exist(filexml,'file')
    141         filexml=[fullfile(RootPath{iview},SubDir{iview},RootFile{iview}) '.xml']; % old convention: xml inside the image folder
    142         if ~exist(filexml,'file')
    143             filexml=[fullfile(RootPath{iview},SubDir{iview},RootFile{iview}) '.civ']; % very old convention: .civ file
    144             if ~exist(filexml,'file')
    145                 filexml='';
    146             end
    147         end
    148     end
    149     if ~isempty(filexml)
    150         [XmlData{iview},error]=imadoc2struct(filexml);
    151     end
    152     if isfield(XmlData{iview},'Time')
    153         itime=itime+1;
    154         timecell{itime}=XmlData{iview}.Time;
    155     end
    156     if isfield(XmlData{iview},'GeometryCalib') && isfield(XmlData{iview}.GeometryCalib,'SliceCoord')
    157         NbSlice_calib{iview}=size(XmlData{iview}.GeometryCalib.SliceCoord,1);%nbre of slices for Zindex in phys transform
    158         if ~isequal(NbSlice_calib{iview},NbSlice_calib{1})
    159             msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series');
    160         end
    161     end
    162 end
    163 
    164 %% check coincidence in time for several input file series
    165 multitime=0;
    166 if isempty(timecell)
    167     time=[];
    168 elseif length(timecell)==1
    169     time=timecell{1};
    170 elseif length(timecell)>1
    171     multitime=1;
    172     for icell=1:length(timecell)
    173         if ~isequal(size(timecell{icell}),size(timecell{1}))
    174             msgbox_uvmat('WARNING','inconsistent time array dimensions in ImaDoc fields, the time for the first series is used')
    175             time=timecell{1};
    176             multitime=0;
    177             break
    178         end
    179     end
    180 end
    181 if multitime
    182     for icell=1:length(timecell)
    183         time(icell,:,:)=timecell{icell};
    184     end
     132[XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series);
     133if size(time,1)>1
    185134    diff_time=max(max(diff(time)));
    186135    if diff_time>0
    187136        msgbox_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)])
    188137    end   
    189 end
    190 if size(time,2) < i2_series{1}(end) ||( ~isempty(j2_series{1}) && size(time,3) < j2_series{1}(end))% time array absent or too short in ImaDoc xml file'
    191     time=[];
    192138end
    193139
Note: See TracChangeset for help on using the changeset viewer.