Changeset 555 for trunk/src/series
- Timestamp:
- Oct 17, 2012, 10:37:15 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/relabel_i_j.m
r478 r555 1 1 %'relabel_i_j': relabel an image series with two indices, and correct errors from the RDvision transfer program 2 2 %------------------------------------------------------------------------ 3 % function GUI_config=relabel_i_j(Param)3 % function ParamOut=relabel_i_j(Param) 4 4 %------------------------------------------------------------------------ 5 5 … … 46 46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 47 47 48 function GUI_config=relabel_i_j(Param)48 function ParamOut=relabel_i_j(Param) %default output=relabel_i_j(Param) 49 49 50 50 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName 51 51 if ~exist('Param','var') % case with no input parameter 52 GUI_config={'NbViewMax';1;...% max nbre of input file series (default='' , no limitation)52 ParamOut={'NbViewMax';1;...% max nbre of input file series (default='' , no limitation) 53 53 'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default) 54 54 'WholeIndexRange';'on';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) … … 182 182 return 183 183 end 184 NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series185 if NbSlice~=nbfield_j186 answer=msgbox_uvmat('INPUT_Y-N',['will not average slice by slice: for so cancel and set NbSlice= ' num2str(nbfield_j)]);187 if ~strcmp(answer,'Yes')188 return189 end190 end184 % NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series 185 % if NbSlice~=nbfield_j 186 % answer=msgbox_uvmat('INPUT_Y-N',['will not average slice by slice: for so cancel and set NbSlice= ' num2str(nbfield_j)]); 187 % if ~strcmp(answer,'Yes') 188 % return 189 % end 190 % end 191 191 192 192 %% Set field names and velocity types … … 209 209 end 210 210 211 %% read imadoc212 % RootPath=get(hseries.RootPath,'String');213 % RootFile=get(hseries.RootFile,'String');214 % if ~iscell(RootFile)215 % msgbox_uvmat('ERROR','please enter an input image series from RDVision system')%error message for xml file reading216 % return217 % end218 % basename=fullfile(RootPath{1},RootFile{1});219 % [XmlData,warntext]=imadoc2struct_special([basename '.xml']);% read the xml file appended to the present function (containing bug corrections)220 % if ~isempty(warntext)221 % msgbox_uvmat('ERROR',warntext)%error message for xml file reading222 % end223 % nbfield1=size(XmlData.Time,1);224 % nbfield2=size(XmlData.Time,2);225 % set(hseries.first_i,'String',num2str(first_label))% display the first image in the process226 % set(hseries.last_i,'String',num2str(nbfield1*nbfield2-1+first_label))% display the last image in the process227 % set(hseries.nb_field,'String',{num2str(nbfield1*nbfield2-1+first_label)})% display the total nbre of images228 % SeriesData=get(hGUI,'UserData');229 230 231 %% stop program there when it is selected in the menu (no run action)232 % if ~exist('num_i1','var')233 % return234 % end235 % if nbfield2>=2236 % answer=msgbox_uvmat('',[num2str(nbfield1) ' bursts containing ' num2str(nbfield2) ' images each']);%error message for directory creation237 % nomtype='_i_j';238 % else239 % answer=msgbox_uvmat('',['image series with ' num2str(nbfield1) ' images']);%error message for directory creation240 % nomtype='_i';241 % end242 % if ~strcmp(answer,'Yes')243 % return244 % end245 246 211 %% copy and adapt the xml file 212 NomTypeNew='_1_1'; 247 213 if ~isempty(XmlData{1}) 248 249 % if exist([basename '.xml'],'file')250 % try251 % copyfile([basename '.xml'],[basename '.xml~']);% backup the xml file252 % catch ME253 % msgbox_uvmat('ERROR',ME.message);254 % return255 % end256 % filexml=[filebase{1} '.xml']257 214 t=xmltree(filexml); 258 215 … … 267 224 j1=j1_series{1}; 268 225 end 269 ImageName=fullfile_uvmat(RootPath{1},SubDir{1},RootFile{1},FileExt{1},'_1_1',i1_series{1}(1),[],j); 270 % ImageName=name_generator(basename,1,1,'.png','_i_j'); 226 ImageName=fullfile_uvmat(RootPath{1},SubDir{1},RootFile{1},FileExt{1},'_1_1',i1_series{1}(1),[],j1); 271 227 [pth,ImageName]=fileparts(ImageName); 272 228 ImageName=[ImageName '.png']; … … 282 238 283 239 %%%% correction RDvision %%%% 284 if isfield(XmlData ,'NbDtj')240 if isfield(XmlData{1},'NbDtj') 285 241 uid_NbDtj=find(t,'ImaDoc/Camera/BurstTiming/NbDtj'); 286 242 uid_value=children(t,uid_NbDtj); 287 243 if ~isempty(uid_value) 288 t=set(t,uid_value(1),'value',num2str(XmlData .NbDtj));289 end 290 end 291 if isfield(XmlData ,'NbDtk')244 t=set(t,uid_value(1),'value',num2str(XmlData{1}.NbDtj)); 245 end 246 end 247 if isfield(XmlData{1},'NbDtk') 292 248 uid_NbDtk=find(t,'ImaDoc/Camera/BurstTiming/NbDtk'); 293 249 uid_value=children(t,uid_NbDtk); 294 250 if ~isempty(uid_value) 295 t=set(t,uid_value(1),'value',num2str(XmlData .NbDtk));296 end 297 end 298 if isempty(j1_series{1}) && isfield(XmlData ,'NbDti')251 t=set(t,uid_value(1),'value',num2str(XmlData{1}.NbDtk)); 252 end 253 end 254 if isempty(j1_series{1}) && isfield(XmlData{1},'NbDti') 299 255 uid_Dti=find(t,'ImaDoc/Camera/BurstTiming/Dti'); 300 t=add(t,uid_Dti,'chardata',num2str(XmlData .Dti));256 t=add(t,uid_Dti,'chardata',num2str(XmlData{1}.Dti)); 301 257 uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti'); 302 t=add(t,uid_NbDti,'chardata',num2str(XmlData .NbDti));258 t=add(t,uid_NbDti,'chardata',num2str(XmlData{1}.NbDti)); 303 259 uid_NbDtj=find(t,'ImaDoc/Camera/BurstTiming/NbDtj'); 304 260 uid_NbDtk=find(t,'ImaDoc/Camera/BurstTiming/NbDtk'); … … 309 265 t=delete(t,uid_Dtj); 310 266 t=delete(t,uid_Dtk); 267 NomTypeNew='_1'; 311 268 end 312 269 SubDirBase=regexprep(SubDir{1},'\..*','');%take the root part of SubDir, before the first dot '.' 313 270 filexml_new=[fullfile(RootPath{1},SubDirBase) '.xml']; 314 271 save(t,filexml_new) 315 % end316 272 end 317 273 … … 330 286 j1=mod(ifile-1+first_label,nbfield2)+1; 331 287 i1=floor((ifile-1+first_label)/nbfield2)+1; 332 % filename_new=name_generator(basename,num_i,num_j,'.png',nomtype); 333 filename_new=fullfile_uvmat(RootPath{1},SubDir{1},RootFile{1},FileExt{1},'_1_1',i1,[],j1); 288 filename_new=fullfile_uvmat(RootPath{1},SubDir{1},RootFile{1},FileExt{1},NomTypeNew,i1,[],j1); 334 289 try 335 290 movefile(filename,filename_new); … … 443 398 Dtj=[]; 444 399 s.Dti=Dti; 400 s.NbDti=NbDti; 445 401 else 446 402 % NbDtj=NbDtj/numel(Dtj);%bursts 447 s.NbDtj=NbDtj ;403 s.NbDtj=NbDtj/numel(Dtj);%bursts; 448 404 end 449 405 %%%% %%%% … … 456 412 end 457 413 if ~isempty(Dtj) 458 Dtj=reshape(Dtj'*ones(1, NbDtj),1,NbDtj*numel(Dtj)); %concatene Dtj vector NbDtj times414 Dtj=reshape(Dtj'*ones(1,s.NbDtj),1,s.NbDtj*numel(Dtj)); %concatene Dtj vector NbDtj times 459 415 Dtj=[0 Dtj]; 460 416 Time_val=Time_val*ones(1,numel(Dtj))+ones(numel(Time_val),1)*cumsum(Dtj);% produce a time matrix with Dtj
Note: See TracChangeset
for help on using the changeset viewer.