Ignore:
Timestamp:
Feb 6, 2017, 11:29:01 AM (7 years ago)
Author:
sommeria
Message:

various updates

File:
1 edited

Legend:

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

    r991 r993  
    9595        return
    9696    end
    97     xmlinput=uigetfile_uvmat('pick xml file for timing',fileparts(fileparts(FirstFileName)),'.xml');
    98     [tild,ParamOut.ActionInput.XmlFile]=fileparts(xmlinput);
    99     ParamOut.ActionInput.XmlFile
    100    
     97    ParamOut.ActionInput.XmlFile=uigetfile_uvmat('pick xml file for timing',fileparts(fileparts(FirstFileName)),'.xml'); 
    10198    return
    10299end
     
    140137
    141138%% Timing
    142 XmlInputFile=fullfile(Param.InputTable{1,1},[Param.ActionInput.XmlFile '.xml'])
    143 XmlInput=imadoc2struct(XmlInputFile,'Camera');
    144 
    145 %% create the xml file of PCO camera
     139XmlInputFile=Param.ActionInput.XmlFile;
     140[XmlInput,errormsg]=imadoc2struct(XmlInputFile,'Camera');
     141if ~isempty(errormsg)
     142    disp(['bad xml input file: ' errormsg])
     143    return
     144end
     145ImagesPerLevel=size(XmlInput.Time,2)-1;%100;%use the xmlinformation to get the nbre of j indices
     146
     147%% create the xml file of PCO camera if it does not exist
     148Newxml=fullfile(Param.InputTable{1,1},[Param.InputTable{1,2} '.xml']);
     149if ~exist(Newxml,'file')
    146150XmlInput.Camera.CameraName='PCO';
    147 t=struct2xml(XmlInput.Camera);
     151XmlInput=rmfield(XmlInput,'Time');
     152XmlInput=rmfield(XmlInput,'TimeUnit');
     153t=struct2xml(XmlInput);
    148154t=set(t,1,'name','ImaDoc');
    149 save(t,fullfile(Param.InputTable{1,1},[Param.InputTable{1,2} '.xml']))
     155save(t,Newxml);
     156end
    150157
    151158%% Main loop
    152159
    153 ImagesPerLevel=size(XmlInput.Time,2)-1;%100;
     160
    154161% count=0;
    155162%count=316;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP08: 4684 images -> start at 316 start 67->_11_1
    156163%count=1934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP07: 3066 images
    157164%% loop on the files
    158 %for ifile=1:numel(ListFile)
    159 %     update_waitbar(WaitbarHandle,ifile/numel(ListFile))
    160 %     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    161 %         disp('program stopped by user')
    162 %         break
    163 %     end
    164 %    ImageName=fullfile(DirImages,ListFile{ifile});
    165 %   NbFrames=numel(imfinfo(ImageName));
    166 % loop on the frames within the tiff file
     165% include the first tiff file with no index in the first iteration
    167166if Param.IndexRange.first_i==1% first slice of processing
    168167    firstindex=0;
    169168   count=0;
    170 %     count=3;
    171169else
    172170    firstindex=Param.IndexRange.first_i;
     
    174172    NbFrames=numel(imfinfo(ImageName));
    175173   count=Param.IndexRange.first_i*NbFrames;
    176  %   count=Param.IndexRange.first_i*NbFrames+3;
    177174end
    178175for ifile=firstindex:Param.IndexRange.last_i
    179176    if firstindex==0 && ifile==0% first slice of processing
    180             ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},'im.tif')
     177        ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},'im.tif')
    181178    else
    182179        ImageName=fullfile(Param.InputTable{1,1},Param.InputTable{1,2},['im@' num2str(ifile,'%04d') '.tif'])
     
    202199    end
    203200end
    204     %end
    205 
    206 % for ifile=1:numel(ListFile)
    207 %     update_waitbar(WaitbarHandle,ifile/numel(ListFile))
    208 %     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
    209 %         disp('program stopped by user')
    210 %         break
    211 %     end
    212 %     ImageName=fullfile(DirImages,ListFile{ifile});
    213 %     NbFrames=numel(imfinfo(ImageName));
    214 %     % loop on the frames within the tiff file
    215 %     for iframe=1:NbFrames     
    216 %         A=imread(ImageName,iframe);
    217 %
    218 %         if isequal(ImagesPerLevel,1)% mode series
    219 %             i_index=count+1;
    220 %             OutputFile=fullfile(OutputDir,['img_' num2str(count+1) '.png']);
    221 %         else % indices i and j
    222 %             i_index=fix(count/ImagesPerLevel)+1;
    223 %             j_index=mod(count,ImagesPerLevel)+1;
    224 %             OutputFile=fullfile(OutputDir,['img_' num2str(i_index) '_' num2str(j_index) '.png']);
    225 %         end
    226 %         imwrite(A,OutputFile,'BitDepth',16)
    227 %         count=count+1;
    228 %     end
    229 % end
    230 
    231 %% create the xml file of PCO camera
    232 % XmlInput.Camera.CameraName='PCO';
    233 % t=struct2xml(XmlInput.Camera);
    234 % t=set(t,1,'name','ImaDoc');
    235 % save(t,fullfile(Param.InputTable{1,1},'PCO.xml'))
    236 
    237 %% remove initial files if transfer OK
    238 %     if i_index== (size(XmlInput.Time,1)-1)
    239 %
    240 %         [SUCCESS,MESSAGE]=rmdir(DirImages,'s')
    241 %       
    242 %     end
     201
     202
     203
Note: See TracChangeset for help on using the changeset viewer.