Changeset 470 for trunk/src/series/merge_proj.m
- Timestamp:
- Jun 22, 2012, 3:45:50 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/merge_proj.m
r464 r470 130 130 end 131 131 132 132 133 %% 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); 135 if size(time,1)>1 188 136 diff_time=max(max(diff(time))); 189 137 if diff_time>0 … … 191 139 end 192 140 end 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 196 142 197 143 %% coordinate transform or other user defined transform … … 266 212 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%% 267 213 for index=index_slice 214 268 215 if checkrun 269 216 update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield)) … … 285 232 timeread(iview)=0; 286 233 if isfield(Data{iview},'Time') 287 timeread(iview)= Field{iview}.Time;234 timeread(iview)=Data{iview}.Time; 288 235 nbtime=nbtime+1; 289 236 end … … 317 264 return 318 265 end 319 % time of the merged field:320 time_i=0;%default321 if isempty(time)% time from ImaDoc prevails322 time _i=sum(timeread)/nbtime;323 e lse324 time_i=(time(i1,j1)+time(i2,j2))/2; %TODO: upgrade325 end266 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 326 273 % generating the name of the merged field 327 274 i1=i1_series{iview}(index); … … 342 289 end 343 290 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;%default347 if isempty(time)% time from ImaDoc prevails348 time_i=sum(timeread)/nbtime;349 else350 % time_i=i1;351 time_i=(time(i1,j1)+time(i2,j2))/2; %TODO: upgrade352 end353 291 354 292 % recording the merged field … … 405 343 MergeData.dt=dt; 406 344 end 407 MergeData.Time=time _i;345 MergeData.Time=timeread; 408 346 error=struct2nc(OutputFile,MergeData);%save result file 409 347 if isempty(error)
Note: See TracChangeset
for help on using the changeset viewer.