Changeset 54


Ignore:
Timestamp:
Mar 16, 2010, 7:41:52 AM (11 years ago)
Author:
sommeria
Message:

sub_background modified to accept various movie and image inputs
geometry_calib, editxml, civ modified to read a unique PARAM.xml parameter file (instead of PARAM_LINUX...)

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r45 r54  
    114114if isunix
    115115    syst='LINUX';
    116     xmlfile=fullfile(path_UVMAT,'PARAM_LINUX.xml');
    117     if exist(xmlfile,'file')
    118         try
    119         t=xmltree(xmlfile);
    120         sparam=convert(t);
    121         catch
    122              errormsg={[' Problem for reading ' xmlfile]; lasterr};   
    123         end
    124     else
    125         erromsg=[xmlfile ' not found: path to civx binaries undefined'];
    126     end
    127116else
    128117    syst='WIN';
    129     xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml');
    130     if exist(xmlfile,'file')
    131         try
    132         t=xmltree(xmlfile);
    133         sparam=convert(t);
    134         catch
    135              errormsg={[' Problem for reading ' xmlfile]; lasterr};
    136         end
    137     else
    138         erromsg=[xmlfile ' not found: path to civx binaries undefined'];
    139     end
     118end
     119xmlfile=fullfile(path_UVMAT,'PARAM.xml');
     120if exist(xmlfile,'file')
     121    try
     122    t=xmltree(xmlfile);
     123    sparam=convert(t);
     124    catch
     125         errormsg={[' Problem for reading ' xmlfile]; lasterr};   
     126    end
     127else
     128    errormsg=[xmlfile ' not found: path to civx binaries undefined'];
    140129end
    141130display(syst)
     
    160149if ~sge
    161150    if isequal(todo_path,'') || isequal(todo_path,[])
    162         display(['no batch distributed processing available:file path TODO.txt not defined in UVMAT/PARAM_' syst])
     151        display(['no batch distributed processing available:file path TODO.txt not defined in UVMAT/PARAM.xml'])
    163152        test_batch=0;
    164153    end
     
    327316   end
    328317end
    329 [RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput)
     318[RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput);
    330319filebase=fullfile(RootPath,RootFile);
    331 if isequal(nom_type,'*')% all fields in a single file ( movie files)
    332     num_i1=1;num_i2=1;num_j1=1;num_j2=1;
    333 else
    334     num_i1=str2double(str1);
    335     num_i2=str2double(str2);
    336     num_j1=str2double(str_a);
    337     num_j2=str2double(str_b);
    338 end
     320% if isequal(nom_type,'*')% all fields in a single file ( movie files)
     321%     num_i1=1;num_i2=1;num_j1=1;num_j2=1;
     322% else
     323num_i1=stra2num(str1);
     324if isempty(num_i1),num_i1=1;end
     325num_i2=stra2num(str2);
     326if isempty(num_i2),num_i2=1;end
     327num_j1=stra2num(str_a);
     328if isempty(num_j1),num_j1=1;end
     329num_j2=stra2num(str_b);
     330if isempty(num_j2),num_j2=1;end
    339331if isequal(get(handles.compare,'Value'),1)
    340332    browse=[];%initialisation
     
    460452
    461453%------------------------------------------------------------------------
    462 %function activated when a new filebase (image series) is introduced
     454% --- function activated when a new filebase (image series) is introduced
    463455function displ_filebase_Callback(hObject, eventdata, handles)
    464456%------------------------------------------------------------------------
     
    566558    if isfield(XmlData,'Time')
    567559        time=XmlData.Time;
    568         nbfield=size(XmlData.Time,1);
    569         nburst=size(XmlData.Time,2);
     560        nbfield=size(time,1);
     561        nburst=size(time,2);
    570562    end
    571563    ext_ima_read=[];
     
    835827end
    836828displ_num=[];%default
    837 first_i=str2num(get(handles.first_i,'String'));
     829ref_i=str2num(get(handles.ref_i,'String'));
    838830% last_i=str2num(get(handles.last_i,'String'));
    839831time=get(handles.displ_filebase,'UserData'); %get the set of times
     
    857849             numlist_b(index)=numod_b;
    858850             if ~isempty(time)
    859                 dt(numod_a,numod_b)=time(first_i,numod_b)-time(first_i,numod_a);%first time interval dt
     851                dt(numod_a,numod_b)=time(ref_i,numod_b)-time(ref_i,numod_a);%first time interval dt
    860852                displ_dt(index)=dt(numod_a,numod_b);
    861853             else
     
    16341626    path_uvmat=which('uvmat');% check the path detected for source file uvmat
    16351627    path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    1636     if isunix
    1637         %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ binary names
    1638         xmlfile=fullfile(path_UVMAT,'PARAM_LINUX.xml');
    1639         if exist(xmlfile,'file')
    1640             t=xmltree(xmlfile);
    1641             sparam=convert(t);
    1642         end
    1643     else
    1644         %fid = fopen(fullfile(path_UVMAT,'PARAM_WIN.txt'),'r');%open the file with civ binary names
    1645         xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml');
    1646         if exist(xmlfile,'file')
    1647             t=xmltree(xmlfile);
    1648             sparam=convert(t);
    1649         end
    1650     end
     1628    %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ binary names
     1629    xmlfile=fullfile(path_UVMAT,'PARAM.xml');
     1630    if exist(xmlfile,'file')
     1631        t=xmltree(xmlfile);
     1632        sparam=convert(t);
     1633    end
    16511634    if isfield(sparam,'Civ1_exe')
    16521635        civ1_exe=sparam.Civ1_exe;
    1653         if isequal(civ1_exe(1:4),'civx')%the binary is defined in /civx, default setting
     1636        if ~exist(civ1_exe,'file')
    16541637            civ1_exe=fullfile(path_UVMAT,civ1_exe);
    16551638        end
     
    16571640    if isfield(sparam,'Civ2_exe')
    16581641        civ2_exe=sparam.Civ2_exe;
    1659         if isequal(civ2_exe(1:4),'civx')%the binary is defined in /civx, default setting
     1642        if ~exist(civ2_exe,'file')%the binary is defined in /bin, default setting
    16601643            civ2_exe=fullfile(path_UVMAT,civ2_exe);
    16611644        end
     
    16631646    if isfield(sparam,'Patch_exe')
    16641647        patch_exe=sparam.Patch_exe;
    1665         if isequal(patch_exe(1:4),'civx')%the binary is defined in /civx, default setting
     1648        if ~exist(patch_exe,'file')%the binary is defined in /bin, default setting
    16661649            patch_exe=fullfile(path_UVMAT,patch_exe);
    16671650        end
     
    21182101path_uvmat=which('uvmat');% check the path detected for source file uvmat
    21192102path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    2120 if isunix
    2121     xmlfile=fullfile(path_UVMAT,'PARAM_LINUX.xml');
    2122     if exist(xmlfile,'file')
    2123         t=xmltree(xmlfile);
    2124         sparam=convert(t);
    2125     end
    2126 else
    2127     xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml');
    2128     if exist(xmlfile,'file')
    2129         t=xmltree(xmlfile);
    2130         sparam=convert(t);
    2131     end
    2132 end
     2103xmlfile=fullfile(path_UVMAT,'PARAM.xml');
     2104if exist(xmlfile,'file')
     2105    t=xmltree(xmlfile);
     2106    sparam=convert(t);
     2107end
     2108% else
     2109%     xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml');
     2110%     if exist(xmlfile,'file')
     2111%         t=xmltree(xmlfile);
     2112%         sparam=convert(t);
     2113%     end
     2114% end
    21332115sge=0;
    21342116if isfield(sparam,'Civ_exe')
     
    23502332time=get(handles.displ_filebase,'UserData'); %get the set of times
    23512333civAll=get(handles.Experimental,'Value'); % Boolean for new civ excution method
    2352 'TESTbatch'
    2353 size(filecell.nc.civ1)
    2354 nbslice
    2355 nbfield
    23562334for ifile=1:nbfield
    23572335    for j=1:nbslice
     
    24092387            end
    24102388           
    2411             %TESTgrid
    24122389            test_grid=get(handles.browse_gridciv1,'Value');
    24132390            if test_grid
     
    24322409                  par_civ1.gridflag='n';
    24332410            end
    2434             %endTESTgrid
    2435            
     2411            %           
    24362412            i_cmd=i_cmd+1;
    24372413            if isequal(civAll,0)
  • trunk/src/editxml.m

    r42 r54  
    332332    path_uvmat=which('editxml');% check the path detected for source file uvmat
    333333    path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    334     if isunix
    335         xmlparam=fullfile(path_UVMAT,'PARAM_LINUX.xml')
    336         if exist(xmlparam,'file')
    337             tparam=xmltree(xmlparam);
    338             sparam=convert(tparam);
    339             if isfield(sparam,'SchemaPath')
    340                 schemapath=[fullfile(sparam.SchemaPath,head_name) '.xsd']
    341             end
    342         end     
     334%     if isunix
     335xmlparam=fullfile(path_UVMAT,'PARAM.xml');
     336if exist(xmlparam,'file')
     337    tparam=xmltree(xmlparam);
     338    sparam=convert(tparam);
     339    if isfield(sparam,'SchemaPath')
     340        schemapath=[fullfile(sparam.SchemaPath,head_name) '.xsd']
     341    end
     342    if exist(fullfile(path_UVMAT,schemapath)
     343        schemapath=fullfile(path_UVMAT,schemapath);%look for relative path definition
     344    end
     345    schemapath=fullfile(path_UVMAT,schemapath);
    343346%         schemapath=['/coriolis/papillon/data/civbin/XML_SCHEMAS/' head_name '.xsd']%current dir for schema
    344     else
    345         xmlparam=fullfile(path_UVMAT,'PARAM_WIN.xml')
    346         if exist(xmlparam,'file')
    347             tparam=xmltree(xmlparam);
    348             sparam=convert(tparam)
    349             if isfield(sparam,'SchemaPath')
    350                 schemapath=[fullfile(sparam.SchemaPath,head_name) '.xsd']
    351             end
    352         end
     347%     else
     348%         xmlparam=fullfile(path_UVMAT,'PARAM_WIN.xml')
     349%         if exist(xmlparam,'file')
     350%             tparam=xmltree(xmlparam);
     351%             sparam=convert(tparam)
     352%             if isfield(sparam,'SchemaPath')
     353%                 schemapath=[fullfile(sparam.SchemaPath,head_name) '.xsd']
     354%             end
     355%         end
    353356%         schemapath=['\\Papillon\data\civbin\XML_SCHEMAS\' head_name '.xsd']%current dir for schemas
    354     end
     357%     end
    355358    if exist(schemapath,'file')
    356359        xs=xmltree(schemapath);
    357360    else
    358         msgbox_uvmat('ERROR',['The xml schema for ' CurrentFile ' is unknown, check the schema path set in the xml file PARAM'])
     361        msgbox_uvmat('ERROR',['The xml schema for ' CurrentFile ' is unknown, check the schema path set in the file PARAM.xml'])
    359362        [FileName, PathName]=uigetfile( ...
    360363       {'*.xsd', '(*.xsd)';
  • trunk/src/geometry_calib.m

    r42 r54  
    582582path_uvmat=which('uvmat');% check the path detected for source file uvmat
    583583path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    584 if isunix
     584% if isunix
    585585    %fid = fopen(fullfile(path_UVMAT,'PARAM_LINUX.txt'),'r');%open the file with civ binary names
    586     xmlfile=fullfile(path_UVMAT,'PARAM_LINUX.xml');
    587     if exist(xmlfile,'file')
    588         t=xmltree(xmlfile);
    589         sparam=convert(t);
    590     end
    591 else
    592     %fid = fopen(fullfile(path_UVMAT,'PARAM_WIN.txt'),'r');%open the file with civ binary names
    593     xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml');
    594     if exist(xmlfile,'file')
    595         t=xmltree(xmlfile);
    596         sparam=convert(t);
    597     end
    598 end
     586xmlfile=fullfile(path_UVMAT,'PARAM.xml');
     587if exist(xmlfile,'file')
     588    t=xmltree(xmlfile);
     589    sparam=convert(t);
     590end
     591% else
     592%     %fid = fopen(fullfile(path_UVMAT,'PARAM_WIN.txt'),'r');%open the file with civ binary names
     593%     xmlfile=fullfile(path_UVMAT,'PARAM_WIN.xml');
     594%     if exist(xmlfile,'file')
     595%         t=xmltree(xmlfile);
     596%         sparam=convert(t);
     597%     end
     598% end
    599599if ~isfield(sparam,'GeometryCalib_exe')
    600600    msgbox_uvmat('ERROR',['calibration program <GeometryCalib_exe> undefined in parameter file ' xmlfile])
     
    602602end
    603603Tsai_exe=sparam.GeometryCalib_exe;
     604if ~exist(Tsai_exe,'file')%the binary is defined in /bin, default setting
     605     Tsai_exe=fullfile(path_UVMAT,Tsai_exe);
     606end
    604607if ~exist(Tsai_exe,'file')
    605     msgbox_uvmat('ERROR',['calibration program ' Tsai_exe ' does not exist'])
     608    msgbox_uvmat('ERROR',['calibration program ' sparam.GeometryCalib_exe ' defined in PARAM.xml does not exist'])
    606609    return
    607610end
  • trunk/src/series/sub_background.m

    r38 r54  
    5858%-----------------------------------------------------------------
    5959if iscell(Series.RootPath)
    60     wardlg_uvmat('This function use only one input file series','ERROR')
     60    msgbox_uvmat('ERROR','This function use only one input image series')
     61    return
     62end
     63
     64%determine input image type
     65FileType=[];%default
     66MovieObject=[];
     67if isequal(lower(FileExt),'.avi')
     68    hhh=which('mmreader');
     69    if ~isequal(hhh,'')&& mmreader.isPlatformSupported()
     70        MovieObject=mmreader(fullfile(RootPath,[RootFile FileExt]));
     71        FileType='movie';
     72    else
     73        FileType='avi';
     74    end
     75elseif isequal(lower(FileExt),'.vol')
     76    FileType='vol';
     77else
     78   form=imformats(FileExt(2:end));
     79   if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
     80       if isequal(NomType,'*');
     81           FileType='multimage';
     82       else
     83           FileType='image';
     84       end
     85   end
     86end
     87if isempty(FileType)
     88    msgbox_uvmat('ERROR',['invalid file extension ' FileExt ': this function only accepts image or movie input'])
     89    return
    6190end
    6291
     
    206235    %read the first series of nbaver_ima images and sort by luminosity at each pixel
    207236    for ifield = 1:nbaver_ima
    208               ifile=indselect(ifield);
    209                 [filename,idetect]=...
    210            name_generator(filebase,num_i1(ifile),num_j1(ifile),Series.FileExt,Series.NomType);
    211                Aread=imread(filename);
    212                size(Aread)
    213                if size(Aread,3)>1 %(color images)
    214                    Aread=sum(Aread,3); %sum over color components
    215                end
    216                 Ak(:,:,ifield)=Aread;           
     237        ifile=indselect(ifield);
     238        filename=name_generator(filebase,num_i1(ifile),num_j1(ifile),Series.FileExt,Series.NomType);
     239        Aread=read_image(filename,FileType,num_i1(ifile),movieobject);
     240        Ak(:,:,ifield)=Aread;           
    217241    end
    218242    Asort=sort(Ak,3);%sort the luminosity of images at each point
     
    241265            stopstate=get(hseries.RUN,'BusyAction');
    242266            if isequal(stopstate,'queue')% enable STOP command
    243 %                 waitbarpos(4)=((ifield+(islice-1)*nbfield_slice)/(nbfield_slice*nbslice_i))*Series.WaitbarPos(4);
    244 %                 waitbarpos(2)=Series.WaitbarPos(4)+Series.WaitbarPos(2)-waitbarpos(4);
    245 %                 set(hwaitbar,'Position',waitbarpos)
    246 %                 drawnow
    247267                update_waitbar(hseries.waitbar,WaitbarPos,(ifield+(islice-1)*nbfield_slice)/(nbfield_slice*nbslice_i))
    248268                (ifield+(islice-1)*nbfield_slice)/(nbfield_slice*nbslice_i)
     
    251271                for iburst=1:step
    252272                    ifile=indselect(ifield+step*floor(nbaver/2)+iburst-1);
    253                     [filename,idetect]=...
    254                        name_generator(filebase,num_i1(ifile),num_j1(ifile),Series.FileExt,Series.NomType);
    255                     Aread=imread(filename);
    256                     if size(Aread,3)>1 %(color images)
    257                        Aread=sum(Aread,3); %sum over color components
    258                     end
     273                    filename=name_generator(filebase,num_i1(ifile),num_j1(ifile),Series.FileExt,Series.NomType);
     274                    Aread=read_image(filename,FileType,num_i1(ifile),movieobject);
    259275                    Ak(:,:,nbaver_ima-step+iburst)=Aread;
    260276                end
     
    298314
    299315
     316%------------------------------------------------------------------------
     317%--read images and convert them to the uint16 format used for PIV
     318function A=read_image(filename,type_ima,num,movieobject)
     319%------------------------------------------------------------------------
     320%num is the view number needed for an avi movie
     321switch type_ima
     322    case 'movie'
     323        A=read(movieobject,num);
     324    case 'avi'
     325        mov=aviread(filename,num);
     326        A=frame2im(mov(1));
     327    case 'multimage'
     328        A=imread(filename,num);
     329    case 'image'   
     330        A=imread(filename);
     331end
     332siz=size(A);
     333if length(siz)==3;%color images
     334    A=sum(double(A),3);
     335end
    300336   
    301    
Note: See TracChangeset for help on using the changeset viewer.