Ignore:
Timestamp:
Nov 15, 2016, 5:22:14 PM (4 years ago)
Author:
sommeria
Message:

multitif updated

File:
1 edited

Legend:

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

    r971 r972  
    5959%=======================================================================
    6060
    61 function ParamOut=ima2netcdf(Param)
     61function ParamOut=extract_multitif(Param)
    6262
    6363%%%%%%%%%%%%%%%%%    INPUT PREPARATION MODE (no RUN)    %%%%%%%%%%%%%%%%%
     
    7373    ParamOut.OutputDirExt='.png';%set the output dir extension
    7474    ParamOut.OutputFileMode='NbSlice';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice
    75    
     75     ParamOut.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1)
    7676    %% root input file(s) and type
    7777    % check the existence of the first file in the series
     
    148148%count=316;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP08: 4684 images -> start at 316 start 67->_11_1
    149149%count=1934%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CORRECTION EXP07: 3066 images
    150 %% loop on the files
     150%% loop on the files  
    151151for ifile=1:numel(ListFile)
    152152    update_waitbar(WaitbarHandle,ifile/numel(ListFile))
     
    158158    NbFrames=numel(imfinfo(ImageName));
    159159    % loop on the frames within the tiff file
    160     for iframe=1:NbFrames     
    161         A=imread(ImageName,iframe);
    162 
    163         if isequal(ImagesPerLevel,1)% mode series
     160    for iframe=1:NbFrames       
     161        if isequal(ImagesPerLevel,1)% mode series
    164162            i_index=count+1;
    165163            OutputFile=fullfile(OutputDir,['img_' num2str(count+1) '.png']);
    166         else % indices i and j 
     164        else % indices i and j
    167165            i_index=fix(count/ImagesPerLevel)+1;
    168166            j_index=mod(count,ImagesPerLevel)+1;
    169167            OutputFile=fullfile(OutputDir,['img_' num2str(i_index) '_' num2str(j_index) '.png']);
    170168        end
    171         imwrite(A,OutputFile,'BitDepth',16)
     169        if Param.CheckOverwrite ||~exist(OutputFile,'file')
     170            A=imread(ImageName,iframe);
     171            imwrite(A,OutputFile,'BitDepth',16);
     172            disp([OutputFile ' written'])
     173        else
     174            disp([OutputFile ' already exists'])
     175        end
    172176        count=count+1;
    173177    end
    174178end
     179
     180% for ifile=1:numel(ListFile)
     181%     update_waitbar(WaitbarHandle,ifile/numel(ListFile))
     182%     if ~isempty(RUNHandle)&& ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     183%         disp('program stopped by user')
     184%         break
     185%     end
     186%     ImageName=fullfile(DirImages,ListFile{ifile});
     187%     NbFrames=numel(imfinfo(ImageName));
     188%     % loop on the frames within the tiff file
     189%     for iframe=1:NbFrames     
     190%         A=imread(ImageName,iframe);
     191%
     192%         if isequal(ImagesPerLevel,1)% mode series
     193%             i_index=count+1;
     194%             OutputFile=fullfile(OutputDir,['img_' num2str(count+1) '.png']);
     195%         else % indices i and j
     196%             i_index=fix(count/ImagesPerLevel)+1;
     197%             j_index=mod(count,ImagesPerLevel)+1;
     198%             OutputFile=fullfile(OutputDir,['img_' num2str(i_index) '_' num2str(j_index) '.png']);
     199%         end
     200%         imwrite(A,OutputFile,'BitDepth',16)
     201%         count=count+1;
     202%     end
     203% end
    175204
    176205%% create the xml file of PCO camera
     
    181210
    182211%% remove initial files if transfer OK
    183     if i_index== (size(XmlInput.Time,1)-1)
    184 
    185         [SUCCESS,MESSAGE]=rmdir(DirImages,'s')
    186        
    187     end
     212%     if i_index== (size(XmlInput.Time,1)-1)
     213%
     214%         [SUCCESS,MESSAGE]=rmdir(DirImages,'s')
     215%        
     216%     end
Note: See TracChangeset for help on using the changeset viewer.