Changeset 65 for trunk/src/uvmat.m


Ignore:
Timestamp:
Mar 24, 2010, 8:47:23 PM (11 years ago)
Author:
sommeria
Message:

name_generator: remove unneeded indices at output
civ.m: & introduced at the end of system command lines (beginning by !) to allow matlab operations during civ in run mode
uvmat.m: debugging in dealing with projections
prove image pair movies superposed to velocity vectors
mouse: put circles along detected vectors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r62 r65  
    626626update_rootinfo(hObject,eventdata,handles)
    627627
    628 %-------------------------------------------------------------------
    629 %-- called by action in FileIndex edit box
    630 %-------------------------------------------------------------------
    631 function FileIndex_Callback(hObject, eventdata, handles)
    632 NomType_str=get(handles.FileIndex,'String') ;
    633 [P,F,str1,str2,str_a,str_b]=name2display(['xx' NomType_str get(handles.FileExt,'String')]);
    634 % display the new index values on the counters
    635 set(handles.i1,'String',str1);
    636 set(handles.i2,'String',str2);
    637 set(handles.j1,'String',str_a);
    638 set(handles.j2,'String',str_b);
     628
     629
     630
     631
    639632
    640633%-------------------------------------------------------------------
     
    16701663     num1=num1+increment;
    16711664     num2=num2+increment;
    1672      [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir);
     1665     [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir)
    16731666     if sub_value% set the second field name and indices
    16741667        num1_1=num1_1+increment;
     
    16911684%         end
    16921685    end
    1693     filename=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir);
     1686    [filename,num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir);
    16941687end
    16951688
     
    17451738index_fields=get(handles.Fields,'Value');% selected string index
    17461739FieldName=list_fields{index_fields}; % selected field
     1740UvData=get(handles.uvmat,'UserData');
    17471741if isequal(FieldName,'image')
    1748 %     run0_Callback(hObject, eventdata, handles)%display the first image
    1749     UvData=get(handles.uvmat,'UserData');
    1750 else
    1751     msgbox_uvmat('ERROR','an image or movie must be first introduced as input')
    1752     return
    1753 end
    1754 [ff,rr,filebase,xx,Ext,SubDir]=read_file_boxes(handles);
    1755 NomType=get(handles.FileIndex,'UserData');
     1742    test_1=0;
     1743    [ff,rr,filebase,xx,Ext,SubDir]=read_file_boxes(handles);
     1744    NomType=get(handles.FileIndex,'UserData');
     1745else
     1746    list_fields=get(handles.Fields_1,'String');% list menu fields
     1747    index_fields=get(handles.Fields_1,'Value');% selected string index
     1748    FieldName=list_fields{index_fields}; % selected field
     1749    if isequal(FieldName,'image')
     1750        test_1=1;
     1751        [ff,rr,filebase,xx,Ext,SubDir]=read_file_boxes_1(handles);
     1752        NomType=get(handles.FileIndex_1,'UserData');
     1753    else
     1754        msgbox_uvmat('ERROR','an image or movie must be first introduced as input')
     1755        return
     1756    end
     1757end
     1758
    17561759num_i1=stra2num(get(handles.i1,'String'));
    17571760num_j1=stra2num(get(handles.j1,'String'));
     
    17791782%read the second image
    17801783Field.AName='image';
    1781 Field.AX=UvData.Field.AX;
    1782 Field.AY=UvData.Field.AY;
     1784if test_1
     1785    Field_a=UvData.Field_1;
     1786else
     1787    Field_a=UvData.Field;
     1788end
     1789Field_b.AX=Field_a.AX;
     1790Field_b.AY=Field_a.AY;
    17831791% z index
    17841792nbslice=str2double(get(handles.nb_slice,'String'));
    17851793if ~isempty(nbslice)
    1786     Field.ZIndex=mod(num_i2-1,nbslice)+1;
    1787 end
    1788 Field.CoordType='px';
     1794    Field_b.ZIndex=mod(num_i2-1,nbslice)+1;
     1795end
     1796Field_b.CoordType='px';
    17891797%determine the input file type
    1790 if isfield(UvData,'MovieObject')
     1798if (test_1 && isfield(UvData,'MovieObject_1'))||(~test_1 && isfield(UvData,'MovieObject'))
    17911799    FileType='movie';
    17921800elseif isequal(lower(Ext),'.avi')
     
    18061814switch FileType
    18071815        case 'movie'
    1808             Field.A=read(UvData.MovieObject,num_i2);
     1816            if test_1
     1817                Field_b.A=read(UvData.MovieObject_1,num_i2);
     1818            else
     1819                Field_b.A=read(UvData.MovieObject,num_i2);
     1820            end
    18091821        case 'avi'
    18101822            mov=aviread(imaname_1,num_i2);
    1811             Field.A=frame2im(mov(1));
     1823            Field_b.A=frame2im(mov(1));
    18121824        case 'vol'
    1813             Field.A=imread(imaname_1);
     1825            Field_b.A=imread(imaname_1);
    18141826        case 'multimage'
    1815             Field.A=imread(imaname_1,num_i2);
     1827            Field_b.A=imread(imaname_1,num_i2);
    18161828        case 'image'
    1817             Field.A=imread(imaname_1);
     1829            Field_b.A=imread(imaname_1);
    18181830end
    18191831if get(handles.slices,'Value')
     
    18281840transform=transform_list{choice_value};
    18291841if  ~isequal(transform_name,'') && ~isequal(transform_name,'px')
    1830     if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
    1831         Field=transform(Field,UvData.XmlData);
     1842    if test_1 && isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
     1843        Field_b=transform(Field_b,UvData.XmlData_1);
     1844    elseif ~test_1 && isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')%use geometry calib
     1845        Field_b=transform(Field_b,UvData.XmlData);
    18321846    end
    18331847end
     
    18401854while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue')%isequal(get(handles.run0,'BusyAction'),'queue'); % enable STOP command
    18411855    % read and plot the series of images in non erase mode
    1842     set(hima,'CData',Field.A);
     1856    set(hima,'CData',Field_b.A);
    18431857    pause(1.02-get(handles.speed,'Value'));% wait for next image
    1844     set(hima,'CData',UvData.Field.A);
     1858    set(hima,'CData',Field_a.A);
    18451859    pause(1.02-get(handles.speed,'Value'));% wait for next image
    18461860end
     
    19661980sub_value=get(handles.SubField,'Value');
    19671981FileType_1='none';%default
    1968 %if sub_value==1
     1982%if sub_value==
     1983filename_1
    19691984if ~isempty(filename_1)
    19701985    % test for a constant second field (comparison with a fixed field)
    19711986    NomType_1=get(handles.FileIndex_1,'UserData');
    1972     Ext_1=get(handles.FileExt_1,'String');
     1987    Ext_1=get(handles.FileExt_1,'String')
    19731988    % determine the input file type
    19741989    if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf')
     
    19841999        FieldName_1='image';
    19852000    else
    1986        form=imformats(Ext([2:end]));
     2001       form=imformats(Ext_1([2:end]));
    19872002       if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
    19882003           if isequal(NomType_1,'*');
     
    20642079            A=read(UvData.MovieObject_1,num_i1);
    20652080        case 'avi'
    2066             mov=aviread(filename,num_i1);
     2081            mov=aviread(filename_1,num_i1);
    20672082            A=frame2im(mov(1));
    20682083        case 'vol'
    2069             A=imread(filename);
     2084            A=imread(filename_1);
    20702085        case 'multimage'
    2071             A=imread(filename,num_i1);
     2086            A=imread(filename_1,num_i1);
    20722087        case 'image'
    2073             A=imread(filename);
     2088            A=imread(filename_1);
     2089        case 'netcdf'
     2090        otherwise
     2091            errormsg=['unknown input file type ' filename_1];
    20742092    end
    20752093    npxy=size(A);
     
    24982516    set(handles.MaxA,'String','255')
    24992517end
    2500 IndexObj=get(handles.list_object_1,'Value');
    2501 Object=UvData.Object;
    2502 IndexObj=min(IndexObj,numel(Object));
    2503 for iobj=[1 IndexObj]
    2504     if ~isempty(Object{iobj})%& isfield(Object{iobj},'plotaxes')& ishandle(Object{iobj}.plotaxes)
     2518IndexObj(1)=get(handles.list_object_1,'Value');
     2519if IndexObj(1)> numel(UvData.Object)
     2520    IndexObj(1)=1;
     2521end
     2522IndexObj_2=get(handles.list_object_2,'Value');
     2523if IndexObj_2 <= numel(UvData.Object)
     2524    IndexObj(2)=IndexObj_2;
     2525end
     2526for iobj=IndexObj
     2527    if ~isempty(UvData.Object{iobj})%& isfield(Object{iobj},'plotaxes')& ishandle(Object{iobj}.plotaxes)
    25052528        %Projeter les champs sur l'objet:*
    2506         ObjectData=proj_field(UvData.Field,Object{iobj},iobj);
     2529        ObjectData=proj_field(UvData.Field,UvData.Object{iobj},iobj);
    25072530   
    25082531        %use of mask
     
    25542577        if ~isempty(ObjectData)
    25552578            haxes=[];%default
    2556             if isfield(Object{iobj},'plotaxes')
    2557                 haxes=Object{iobj}.plotaxes;%axes used for representing the projection on the object
     2579            if isfield(UvData.Object{iobj},'plotaxes')
     2580                haxes=UvData.Object{iobj}.plotaxes;%axes used for representing the projection on the object
    25582581            end
    25592582            PosColorbar=[];%default: no colorbar
     
    41694192IndexObj=get(handles.list_object_1,'Value');
    41704193str_1=list_str{IndexObj};
    4171 % set(handles.list_object_1,'BackgroundColor',[1 1 0])
    4172 % set(handles.list_object_2,'BackgroundColor',[1 1 1])
    41734194val_2=get(handles.list_object_2,'Value');
    41744195str_2=get(handles.list_object_2,'String');
Note: See TracChangeset for help on using the changeset viewer.