Changeset 555 for trunk


Ignore:
Timestamp:
Oct 17, 2012, 10:37:15 PM (11 years ago)
Author:
sommeria
Message:

relabel_i_j corrected

File:
1 edited

Legend:

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

    r478 r555  
    11%'relabel_i_j': relabel an image series with two indices, and correct errors from the RDvision transfer program
    22%------------------------------------------------------------------------
    3 % function GUI_config=relabel_i_j(Param)
     3% function ParamOut=relabel_i_j(Param)
    44%------------------------------------------------------------------------
    55
     
    4646%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    4747
    48 function GUI_config=relabel_i_j(Param)
     48function ParamOut=relabel_i_j(Param) %default output=relabel_i_j(Param)
    4949
    5050%% set the input elements needed on the GUI series when the action is selected in the menu ActionName
    5151if ~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)
    5353        'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default)
    5454        'WholeIndexRange';'on';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
     
    182182    return
    183183end
    184 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
     184% 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
    191191
    192192%% Set field names and velocity types
     
    209209end
    210210
    211 %% read imadoc
    212 % 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 reading
    216 %     return
    217 % end
    218 % 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 reading
    222 % end
    223 % 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 process
    226 % set(hseries.last_i,'String',num2str(nbfield1*nbfield2-1+first_label))% display the last image in the process
    227 % set(hseries.nb_field,'String',{num2str(nbfield1*nbfield2-1+first_label)})% display the total nbre of images
    228 % 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 %     return
    234 % end
    235 % if nbfield2>=2
    236 % answer=msgbox_uvmat('',[num2str(nbfield1) ' bursts containing ' num2str(nbfield2) ' images each']);%error message for directory creation
    237 % nomtype='_i_j';
    238 % else
    239 %     answer=msgbox_uvmat('',['image series with ' num2str(nbfield1) ' images']);%error message for directory creation
    240 %     nomtype='_i';
    241 % end
    242 % if ~strcmp(answer,'Yes')
    243 %     return
    244 % end
    245 
    246211%% copy and adapt the xml file
     212NomTypeNew='_1_1';
    247213if ~isempty(XmlData{1})
    248 
    249 %     if exist([basename '.xml'],'file')
    250 %         try
    251 %             copyfile([basename '.xml'],[basename '.xml~']);% backup the xml file
    252 %         catch ME
    253 %             msgbox_uvmat('ERROR',ME.message);
    254 %             return
    255 %         end
    256 %         filexml=[filebase{1} '.xml']
    257214        t=xmltree(filexml);
    258215       
     
    267224            j1=j1_series{1};
    268225        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);
    271227        [pth,ImageName]=fileparts(ImageName);
    272228        ImageName=[ImageName '.png'];
     
    282238       
    283239        %%%% correction RDvision %%%%
    284         if isfield(XmlData,'NbDtj')
     240        if isfield(XmlData{1},'NbDtj')
    285241            uid_NbDtj=find(t,'ImaDoc/Camera/BurstTiming/NbDtj');
    286242            uid_value=children(t,uid_NbDtj);
    287243            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')
    292248            uid_NbDtk=find(t,'ImaDoc/Camera/BurstTiming/NbDtk');
    293249            uid_value=children(t,uid_NbDtk);
    294250            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')
    299255            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));
    301257            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));
    303259            uid_NbDtj=find(t,'ImaDoc/Camera/BurstTiming/NbDtj');
    304260            uid_NbDtk=find(t,'ImaDoc/Camera/BurstTiming/NbDtk');
     
    309265            t=delete(t,uid_Dtj);
    310266            t=delete(t,uid_Dtk);
     267            NomTypeNew='_1';
    311268        end
    312269            SubDirBase=regexprep(SubDir{1},'\..*','');%take the root part of SubDir, before the first dot '.'
    313270    filexml_new=[fullfile(RootPath{1},SubDirBase) '.xml'];
    314271        save(t,filexml_new)
    315 %     end
    316272end
    317273
     
    330286        j1=mod(ifile-1+first_label,nbfield2)+1;
    331287        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);
    334289        try
    335290            movefile(filename,filename_new);
     
    443398                     Dtj=[];
    444399                     s.Dti=Dti;
     400                     s.NbDti=NbDti;
    445401                else
    446402                    % NbDtj=NbDtj/numel(Dtj);%bursts
    447                     s.NbDtj=NbDtj;
     403                    s.NbDtj=NbDtj/numel(Dtj);%bursts;
    448404                end
    449405                %%%% %%%%
     
    456412                end
    457413                if ~isempty(Dtj)
    458                     Dtj=reshape(Dtj'*ones(1,NbDtj),1,NbDtj*numel(Dtj)); %concatene Dtj vector NbDtj times
     414                    Dtj=reshape(Dtj'*ones(1,s.NbDtj),1,s.NbDtj*numel(Dtj)); %concatene Dtj vector NbDtj times
    459415                    Dtj=[0 Dtj];
    460416                    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.