Changeset 1065 for trunk/src


Ignore:
Timestamp:
Jun 10, 2019, 4:44:18 PM (5 years ago)
Author:
sommeria
Message:

extract rdvision made parallel

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plot_object.m

    r1061 r1065  
    120120        end
    121121end
     122if isfield(ObjectData,'RangeInterp')&&~isempty(ObjectData.RangeInterp)
     123    YMax=ObjectData.RangeInterp;
     124end
    122125if isfield(ObjectData,'RangeZ')&&~isempty(ObjectData.RangeZ)
    123126    ZMax=max(ObjectData.RangeZ);
     
    144147    nbpoints=numel(xline);
    145148    switch ObjectData.Type
    146         case 'line_x'
    147             xline=[xline; ObjectData.RangeX(2)];%creating the line
    148             yline=[yline; ObjectData.RangeY(2)];%creating the line
    149149        case 'polygon'
    150150            xline=[xline; ObjectData.Coord(1,1)];%closing the line
  • trunk/src/proj_field.m

    r1062 r1065  
    538538if isfield(ObjectData,'RangeY')
    539539    width=max(ObjectData.RangeY);%Rangey needed bfor mode 'projection'
     540end
     541if isfield(ObjectData,'RangeInterp')
     542    width=ObjectData.RangeInterp;%Rangey needed bfor mode 'projection'
    540543end
    541544% default output
  • trunk/src/series.m

    r1061 r1065  
    25762576end
    25772577set(handles.CheckMask,'Visible',MaskVisible);
     2578%% Setting of expected iteration time
     2579if isfield(ParamOut,'CPUTime')
     2580    set(handles.num_CPUTime,'String',num2str(ParamOut.CPUTime));
     2581end
    25782582
    25792583%% definition of the directory containing the output files
  • trunk/src/series/civ_series.m

    r1062 r1065  
    8888        end
    8989    end
     90    % estimated CPUTime
     91Data.CPUTime=1; % 1 minute per field pair
    9092    return
    9193end
  • trunk/src/series/extract_rdvision.m

    r1061 r1065  
    2626%             .ActionExt: fct extension ('.m', Matlab fct, '.sh', compiled   Matlab fct
    2727%             .RUN =0 for GUI input, =1 for function activation
    28 %             .RunMode='local','background', 'cluster': type of function  use
     28%             .RunMode='local','background', 'cluster': type of function  extract_rdvision.muse
    2929%             
    3030%    .IndexRange: set the file or frame indices on which the action must be performed
     
    4444% Copyright 2008-2019, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
    4545%   http://www.legi.grenoble-inp.fr
    46 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
     46%   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.frextract_rdvision.m
    4747%
    4848%     This file is part of the toolbox UVMAT.
     
    5656%     but WITHOUT ANY WARRANTY; without even the implied warranty of
    5757%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    58 %     GNU General Public License (see LICENSE.txt) for more details.
     58%     GNU General Public License (see LICENSE.txt) for more details.extract_rdvision.m
    5959%=======================================================================
    6060
     
    6565    ParamOut.AllowInputSort='off';...% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
    6666        ParamOut.WholeIndexRange='on';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
    67         ParamOut.NbSlice=1; ...%nbre of slices, 1 prevents splitting in several processes, ('off' by default)
     67        ParamOut.NbSlice='off';%1; ...%nbre of slices, 1 prevents splitting in several processes, ('off' by default)
    6868        ParamOut.VelType='off';...% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
    6969        ParamOut.FieldName='off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
     
    7171        ParamOut.ProjObject='off';...%can use projection object(option 'off'/'on',
    7272        ParamOut.Mask='off';...%can use mask option   (option 'off'/'on', 'off' by default)
    73         ParamOut.OutputDirExt='.extract';%set the output dir extension
     73        ParamOut.CPUTime=0.1;% expected time for writting one image ( in minute)
     74        ParamOut.OutputDirExt='.extract';%set the output dir extensionextract_rdvision.m
    7475    ParamOut.OutputSubDirMode='one'; %output folder given by the folder name of the first input line
    7576    % detect the set of image folder
     
    8081    check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files
    8182    ListDir=ListCells(1,find(check_dir & ~check_bad));
    82     %     InputTable=cell(numel(ListDir),5);
    83     %     InputTable(:,2)=ListDir';
    8483    isel=0;
    8584    InputTable=Param.InputTable;
     
    9089        seq_index=find(~cellfun('isempty',detect_seq),1);
    9190        if ~isempty(seq_index)
    92             %             msgbox_uvmat('ERROR',['not seq file in ' ListDir{ilist} ': please check the input folders'])
    93             %         else
    9491            isel=isel+1;
    9592            InputTable{isel,1}=RootPath;
     
    9895            InputTable{isel,3}=RootFile;
    9996            InputTable{isel,4}='*';
    100             InputTable{isel,5}='.seq';
     97            InputTable{isel,5}='.seq';extract_rdvision.m
    10198        end
    10299    end
     
    114111if ischar(Param)
    115112    Param=xml2struct(Param);% read Param as input file (batch case)
    116 %     checkrun=0;
    117113end
    118114disp(Param)
     
    144140FileInfo=get_file_info(filecell{1,1});
    145141if strcmp(FileInfo.FileType,'rdvision')
    146     if ~isequal(FileInfo.NumberOfFrames,nbfield)
    147         disp_uvmat('WARNING',['the whole series of ' num2str(FileInfo.NumberOfFrames) ' images must be extracted at once'],checkrun)
    148         %rmfield(OutputDir)
    149 %         return
    150     end
     142%     if ~isequal(FileInfo.NumberOfFrames,nbfield)
     143%         disp_uvmat('WARNING',['the whole series of ' num2str(FileInfo.NumberOfextract_rdvision.mFrames) ' images must be extracted at once'],checkrun)
     144%         %rmfield(OutputDir)
     145% %         return
     146%     end
    151147    %% interactive input of specific parameters (for RDvision system)
    152148    display('converting images from RDvision system...')
     
    196192        end
    197193    end
    198     %     if ~exist(filexml,'file')
    199     %         disp_uvmat('ERROR',[filexml ' missing'],checkrun)
    200     %         return
    201     %     end
    202    
    203194    newxml=fullfile(RootPath,Param.InputTable{iview,3});
    204195    newxml=regexprep(newxml,'_Master_Dalsa_4M180$','');%suppress '_Master_Dalsa_4M180'
     
    210201            filename_seq=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.seq']);
    211202            filename_sqb=fullfile(RootPath,Param.InputTable{iview,2},[Param.InputTable{iview,3} '.sqb']);
    212            
    213             logdir=[Param.OutputSubDir Param.OutputDirExt];
    214             [success,errormsg] = copyfile(filename_seq,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.seq']); %copy the seq file in the upper folder
    215             [success,errormsg] = copyfile(filename_sqb,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.sqb']); %copy the sqb file in the upper folder
    216             if check_xml
    217             [success,errormsg] = copyfile(filexml,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.xml']); %copy the original xml file in the upper folder
     203            errormsg='';
     204            if isequal(Param.IndexRange.first_i,1)
     205               
     206                logdir=[Param.OutputSubDir Param.OutputDirExt];
     207                [success,errormsg] = copyfile(filename_seq,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.seq']); %copy the seq file in the upper folder
     208                [success,errormsg] = copyfile(filename_sqb,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.sqb']); %copy the sqb file in the upper folder
     209                if check_xml
     210                    [success,errormsg] = copyfile(filexml,[fullfile(RootPath,logdir,Param.InputTable{iview,3}) '.xml']); %copy the original xml file in the upper folder
     211                end
    218212            end
    219213        otherwise
     
    267261%             m.Data=data;
    268262    %%%%%%%
    269     timestamp=zeros(1,numel(m.Data));
    270     for ii=1: numel(m.Data)
    271         timestamp(ii)=m.Data(ii).timestamp;
    272     end
    273     [nbfield1,nbfield2,msg]=copyfile_modif(filexml,timestamp,newxml); %copy the xml file in the upper folder
    274     [XmlData,errormsg]=imadoc2struct(newxml);% check reading of the new xml file
    275     if ~isempty(errormsg)
    276         disp(errormsg)
    277         return
    278     end
    279     timestamp=timestamp(1:nbfield1*nbfield2);
    280     timestamp=reshape(timestamp,nbfield2,nbfield1);
    281     difftime=XmlData.Time(2:end,2:end)'-timestamp;
    282     disp(['time from xml and timestamp differ by ' num2str(max(max(abs(difftime))))])
    283     if max(abs(difftime))>0.01
    284         checkpreserve=1;% will not erase the initial files, possibility of error
    285     end
    286    
    287         %% checking consistency with the xml file
    288 %     if ~isequal(SeqData.nb_frames,numel(timestamp))
    289 %         disp_uvmat('ERRROR',['inconsistent number of images ' num2str(SeqData.nb_frames) ' with respect to the xml file: ' num2str(numel(timestamp))] ,checkrun);
    290 %         return
    291 %     end   
    292    
     263        timestamp=zeros(1,numel(m.Data));
     264        for ii=1: numel(m.Data)
     265            timestamp(ii)=m.Data(ii).timestamp;
     266        end
     267        if isequal(Param.IndexRange.first_i,1)
     268        [nbfield1,nbfield2,msg]=copyfile_modif(filexml,timestamp,newxml); %copy the xml file in the upper folder
     269        [XmlData,errormsg]=imadoc2struct(newxml);% check reading of the new xml file
     270        if ~isempty(errormsg)
     271            disp(errormsg)
     272            return
     273        end
     274        timestamp=timestamp(1:nbfield1*nbfield2);
     275        timestamp=reshape(timestamp,nbfield2,nbfield1);
     276        difftime=XmlData.Time(2:end,2:end)'-timestamp;
     277        disp(['time from xml and timestamp differ by ' num2str(max(max(abs(difftime))))])
     278        if max(abs(difftime))>0.01
     279            checkpreserve=1;% will not erase the initial files, possibility of error
     280        end     
     281        % checking consistency with the xml file
     282        %     if ~isequal(SeqData.nb_frames,numel(timestamp))
     283        %         disp_uvmat('ERRROR',['inconsistent number of images ' num2str(SeqData.nb_frames) ' with respect to the xml file: ' num2str(numel(timestamp))] ,checkrun);
     284        %         return
     285        %     end
     286    else
     287       [nbfield1,nbfield2,msg]=copyfile_modif(filexml,timestamp,'');
     288    end
    293289    if nbfield2>1
    294290        NomTypeNew='_1_1';
     
    297293    end
    298294
    299     [BinList,errormsg]=binread_rdv_series(RootPath,SeqData,m.Data,nbfield2,NomTypeNew);
     295    [BinList,errormsg]=binread_rdv_series(RootPath,SeqData,m.Data,nbfield2,NomTypeNew,Param.IndexRange.first_i,Param.IndexRange.last_i);
    300296    if ~isempty(errormsg)
    301297        disp_uvmat('ERROR',errormsg,checkrun)
     
    304300   
    305301    % check the existence of the expected output image files (from the xml)
     302   
    306303    FileDir=SeqData.sequencename;
    307304     FileDir=regexprep(FileDir,'_Master_Dalsa_4M180$','');%suppress '_Master_Dalsa_4M180'
    308     for i1=1:numel(timestamp)/nbfield2
    309         for j1=1:nbfield2
    310             OutputFile=fullfile_uvmat(RootPath,FileDir,'img','.png',NomTypeNew,i1,[],j1);% TODO: set NomTypeNew from SeqData.mode
    311             try
    312             A=imread(OutputFile);% check image reading (stop if error)
    313             catch ME
    314                 disp(['checking ' OutputFile])
    315                 disp(ME.message)
    316             end
    317         end
    318     end
     305%     for i1=1:numel(timestamp)/nbfield2
     306%         for j1=1:nbfield2
     307%             OutputFile=fullfile_uvmat(RootPath,FileDir,'img','.png',NomTypeNew,i1,[],j1);% TODO: set NomTypeNew from SeqData.mode
     308%             try
     309%             A=imread(OutputFile);% check image reading (stop if error)
     310%             catch ME
     311%                 disp(['checking ' OutputFile])
     312%                 disp(ME.message)
     313%             end
     314%         end
     315%     end
    319316end
    320317
     
    333330
    334331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    335 function [BinList,errormsg]=binread_rdv_series(PathDir,SeqData,SqbData,nbfield2,NomTypeNew)
     332function [BinList,errormsg]=binread_rdv_series(PathDir,SeqData,SqbData,nbfield2,NomTypeNew,first,last)
    336333% BINREAD_RDV Permet de lire les fichiers bin g???n???r???s par Hiris ??? partir du
    337334% fichier seq associ???.
     
    387384end
    388385bin_file_counter=0;
    389 for ii=1:SeqData.nb_frames
     386%for ii=1:SeqData.nb_frames
     387for ii=first:last
    390388    j1=[];
    391389    if ~isequal(nbfield2,1)
     
    422420        BinSize(NbBinFile)=BinSize(NbBinFile)+SeqData.width*SeqData.height*SeqData.bytesperpixel*8; %record bits read
    423421        try
     422            tic
    424423            imwrite(A,OutputFile,'BitDepth',BitDepth) % case of 16 bit images
    425424            disp([OutputFile ' written']);
     425            toc
    426426            % [s,errormsg] = fileattrib(OutputFile,'-w','a'); %set images to read only '-w' for all users ('a')
    427427            %         if ~s
     
    559559
    560560%% save the new xml file
    561 save(t,newxml)
    562 [success,errormsg] = fileattrib(newxml,'+w','g');% allow writing access for the group of users
    563 if success==0
    564     disp({['warning: unable to set group write access to ' newxml ':']; errormsg});%error message for directory creation
    565     msg=errormsg;
    566 end
    567 
    568 
    569 
     561if ~isempty(newxml)
     562    save(t,newxml)
     563    [success,errormsg] = fileattrib(newxml,'+w','g');% allow writing access for the group of users
     564    if success==0
     565        disp({['warning: unable to set group write access to ' newxml ':']; errormsg});%error message for directory creation
     566        msg=errormsg;
     567    end
     568end
     569
     570
  • trunk/src/set_object.m

    r1063 r1065  
    388388        UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface
    389389        if isempty(str2num(get(handles.num_DX,'String')))||isempty(str2num(get(handles.num_DY,'String')));
    390             %         Field=UvData.Field;
    391390            if  isfield(UvData.Field,'CoordMesh')&&~isempty(UvData.Field.CoordMesh)
    392391                set(handles.num_DX,'String',num2str(UvData.Field.CoordMesh))
  • trunk/src/uvmat.m

    r1061 r1065  
    976976            case {'line','polyline','points'}
    977977                data.RangeY=UvData.Field.CoordMesh;
     978                data.RangeInterp=3*UvData.Field.CoordMesh;
    978979            case 'line_x'
    979980                check_plot=1; %plot the line directly when set_object is opened
     
    981982                data.RangeX=UvData.Field.XMin ;
    982983                data.RangeY=UvData.Field.CoordMesh;
     984                data.RangeInterp=3*UvData.Field.CoordMesh;
    983985                if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
    984986                    Coord_z=(UvData.Field.ZMin +UvData.Field.ZMax)/2;
     
    993995                data.RangeX=UvData.Field.YMin ;
    994996                data.RangeY=UvData.Field.CoordMesh;
     997                data.RangeInterp=3*UvData.Field.CoordMesh;
    995998                if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
    996999                    Coord_z=(UvData.Field.ZMin +UvData.Field.ZMax)/2;
Note: See TracChangeset for help on using the changeset viewer.