Changeset 445


Ignore:
Timestamp:
Jun 8, 2012, 4:30:52 PM (9 years ago)
Author:
sommeria
Message:

possibility of dealing with series of multiple images eg tiff- introduced
bugs corrected in object creation.

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ_matlab.m

    r444 r445  
    105105            par_civ1.ImageA=Field.A;%= image matrix A in the first input field
    106106        end
    107         if isfield(par_civ1,'ImageB')&& (ischar(par_civ1.ImageB)||strcmp(class(par_civ1.ImageA),'VideoReader'))
     107        if isfield(par_civ1,'ImageB')&& (ischar(par_civ1.ImageB)||strcmp(class(par_civ1.ImageB),'VideoReader'))
    108108            [Field,ParamOut,errormsg] = read_field(par_civ1.ImageB,par_civ1.FileTypeB,[],par_civ1.FrameIndexB);
    109109            if ~isempty(errormsg)
  • trunk/src/find_file_series.m

    r441 r445  
    5252% ifile_min=1;%default
    5353[FileType,FileInfo,Object]=get_file_type(fullfileinput);
     54NbFrame=1;
     55
    5456switch FileType
    5557    case 'multimage'
    56     NomType='*';
    57     i1_series=(1:FileInfo.NbFrame)';
     58%    NomType='*';
     59%    i1_series=(1:FileInfo.NbFrame)';
     60    NbFrame=FileInfo.NbFrame;
    5861    case {'video','mmreader'}
    5962    NomType='*';
    60     i1_series=(1:FileInfo.NumberOfFrames)';
     63    NbFrame=FileInfo.NumberOfFrames;
     64%     i1_series=(1:FileInfo.NumberOfFrames)';
    6165end
    6266% if strcmp( FileType,'multimage')||strcmp( FileType,'video')||strcmp( FileType,'mmreader')
     
    6468%     i1_series=(1:FileInfo.NumberOfFrames)';
    6569% end
    66 
     70RootFile_i='';
     71NomTypePref='';
    6772if strcmp(NomType,'')||strcmp(NomType,'*')
    6873    if exist(fullfileinput,'file')
     
    7782else
    7883    %% possibly include the first index in the root name, if there exists a corresponding xml file
    79     NomTypePref='';
    8084    r=regexp(NomType,'^(?<tiretnum>_?\d+)','names');%look for a number or _1 at the beginning of NomType
    8185    if ~isempty(r)
     
    8791        end
    8892        if ~isempty(rr)
    89             RootFileNew=[RootFile rr.i1];
    90             checkpair=~isempty(regexp(NomType,'-','once'))||~isempty(regexp(NomType,'ab$','once'))||~isempty(regexp(NomType,'AB$','once'));%case of PIV results
    91             if exist(fullfile(RootPath,SubDir,[RootFileNew '.xml']),'file') %|| (checkpair && exist(fullfile(fileparts(RootPath),[RootFileNew '.xml']),'file'))
    92                 RootFile=RootFileNew;
     93            RootFile_i=[RootFile rr.i1];
     94           % checkpair=~isempty(regexp(NomType,'-','once'))||~isempty(regexp(NomType,'ab$','once'))||~isempty(regexp(NomType,'AB$','once'));%case of PIV results
     95            if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') %|| (checkpair && exist(fullfile(fileparts(RootPath),[RootFile_i '.xml']),'file'))
     96                RootFile=RootFile_i;
    9397                NomTypePref=r.tiretnum;
    9498                NomType=regexprep(NomType,['^'  NomTypePref],'');
     
    252256if isequal(j2_series,0), j2_series=[]; end
    253257
     258%% introduce the frame index in case of movies or multimage type
     259if NbFrame>1
     260    if isempty(i1_series)
     261        i1_series=(1:NbFrame)';
     262        i1_input=1;
     263    else
     264       j1_series=(1:NbFrame)';
     265       j1_input=1;
     266    end
     267end
     268
    254269%% sort pairs by decreasing index differences in case of multiple pairs at the same reference index
    255270if size(i2_series,3)>1 %pairs i1 -i2
     
    280295end
    281296
     297% %% deals with frame index in movies
     298% switch FileType
     299%     case 'multimage'
     300%    NomType='*';
     301%    i1_series=(1:FileInfo.NbFrame)';
     302%     case {'video','mmreader'}
     303%     NomType='*';
     304%     i1_series=(1:FileInfo.NumberOfFrames)';
     305% end
     306
  • trunk/src/open_uvmat.m

    r356 r445  
    2020    uvmat(filename)
    2121    set(gcbo,'Value',1)
    22     delete(get(hObject,'parent'))%delete the display figure to stop the check process
     22%    delete(get(hObject,'parent'))%delete the display figure to stop the check process
    2323end
  • trunk/src/proj_field.m

    r421 r445  
    11591159                for ivar=VarIndex
    11601160                    VarName=FieldData.ListVarName{ivar};
    1161                     if ~( ivar==ivar_X || ivar==ivar_Y || ivar==ivar_Z || ivar==ivar_F || ivar==ivar_FF || test_anc(ivar)==1)
     1161                    if ~( ivar==ivar_X || ivar==ivar_Y || ivar==ivar_Z || ivar==ivar_F || ivar==ivar_FF ||...
     1162                           ( numel(test_anc)>=ivar && test_anc(ivar)==1))
    11621163                        ivar_new=ivar_new+1;
    11631164                        ProjData.ListVarName=[ProjData.ListVarName {VarName}];
  • trunk/src/read_field.m

    r441 r445  
    2424%     = vol: images representing scanned volume (images concatened in the y direction)
    2525% ParamIn: Matlab structure of input parameters
    26 %     .FieldName: name of the input field (for Civx data)
    27 %     .VelType: type of velocity data ('civ1', 'filter1', 'civ2'...)
     26%     .FieldName: name (char string) of the input field (for Civx data)
     27%     .VelType: char string giving the type of velocity data ('civ1', 'filter1', 'civ2'...)
    2828%     .ColorVar: variable used for vector color
    2929%     .Npx, .Npy: nbre of pixels along x and y (used for .vol input files)
     
    4343A=[];
    4444%% distingush different input file types
    45 switch FileType
    46     case {'civx','civdata','netcdf'}  %read the first nc field
    47 %         ParamOut.FieldName=ParamIn.FieldName;
    48         GUIName='get_field'; %default name of the GUI get_field
    49         if isfield(ParamIn,'GUIName')
    50             GUIName=ParamIn.GUIName;
    51         end
    52         CivStage=0;
    53         if ~strcmp(ParamIn.FieldName,'get_field...')% if get_field is not requested, look for Civx data
    54             FieldList=calc_field;%list of possible fields for Civx data
    55             ParamOut.ColorVar='';%default
    56             field_index=strcmp(ParamIn.FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data
    57             if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist
    58                 Data=nc2struct(ObjectName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage');
    59                 % case of new civdata conventions
    60                 if isequal(Data.Conventions,'uvmat/civdata')
    61                     ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default
    62                     ParamOut.ColorVar='ima_cor';
    63                     InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}];
    64                     [Field,ParamOut.VelType,errormsg]=read_civdata(ObjectName,InputField,ParamIn.VelType,Data.CivStage);
     45try
     46    switch FileType
     47        case {'civx','civdata','netcdf'}  %read the first nc field
     48            %         ParamOut.FieldName=ParamIn.FieldName;
     49            GUIName='get_field'; %default name of the GUI get_field
     50            if isfield(ParamIn,'GUIName')
     51                GUIName=ParamIn.GUIName;
     52            end
     53            CivStage=0;
     54            if ~strcmp(ParamIn.FieldName,'get_field...')% if get_field is not requested, look for Civx data
     55                FieldList=calc_field;%list of possible fields for Civx data
     56                ParamOut.ColorVar='';%default
     57                field_index=strcmp(ParamIn.FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data
     58                if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist
     59                    Data=nc2struct(ObjectName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage');
     60                    % case of new civdata conventions
     61                    if isequal(Data.Conventions,'uvmat/civdata')
     62                        ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default
     63                        ParamOut.ColorVar='ima_cor';
     64                        InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}];
     65                        [Field,ParamOut.VelType,errormsg]=read_civdata(ObjectName,InputField,ParamIn.VelType,Data.CivStage);
     66                        CivStage=Field.CivStage;
     67                        ParamOut.CivStage=Field.CivStage;
     68                        %case of old civx conventions
     69                    elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)
     70                        ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default
     71                        ParamOut.ColorVar='ima_cor';
     72                        InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}];
     73                        [Field,ParamOut.VelType]=read_civxdata(ObjectName,InputField,ParamIn.VelType);
     74                        CivStage=Field.CivStage;
     75                        ParamOut.CivStage=Field.CivStage;
     76                        % not cvix file, fields will be chosen through the GUI get_field
     77                    else
     78                        ParamOut.FieldName='get_field...';
     79                        hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI
     80                        if ~isempty(hget_field)
     81                            delete(hget_field)%delete  get_field for reinitialisation
     82                        end
     83                    end
     84                else
     85                    InputField={ParamOut.FieldName};
     86                    if isfield(ParamIn,'ColorVar')
     87                        ParamOut.ColorVar=ParamIn.ColorVar;
     88                        InputField=[InputField {ParamOut.ColorVar}];
     89                    end
     90                    [Field,ParamOut.VelType,errormsg]=read_civxdata(ObjectName,InputField,ParamIn.VelType);
     91                    if ~isempty(errormsg)
     92                        return
     93                    end
    6594                    CivStage=Field.CivStage;
    6695                    ParamOut.CivStage=Field.CivStage;
    67                     %case of old civx conventions
    68                 elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)
    69                     ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default
    70                     ParamOut.ColorVar='ima_cor';
    71                     InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}];
    72                     [Field,ParamOut.VelType]=read_civxdata(ObjectName,InputField,ParamIn.VelType);
    73                     CivStage=Field.CivStage;
    74                     ParamOut.CivStage=Field.CivStage;
    75                     % not cvix file, fields will be chosen through the GUI get_field
    76                 else
    77                     ParamOut.FieldName='get_field...';
    78                     hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI
    79                     if ~isempty(hget_field)
    80                         delete(hget_field)%delete  get_field for reinitialisation
    81                     end
    82                 end
    83             else
    84                 InputField={ParamOut.FieldName};
    85                 if isfield(ParamIn,'ColorVar')
    86                     ParamOut.ColorVar=ParamIn.ColorVar;
    87                     InputField=[InputField {ParamOut.ColorVar}];
    88                 end
    89                 [Field,ParamOut.VelType,errormsg]=read_civxdata(ObjectName,InputField,ParamIn.VelType);
    90                 if ~isempty(errormsg)
    91                     return
    92                 end
    93                 CivStage=Field.CivStage;
    94                 ParamOut.CivStage=Field.CivStage;
     96                end
     97                ParamOut.FieldList=[{'image'};FieldList;{'get_field...'}];
    9598            end
    96             ParamOut.FieldList=[{'image'};FieldList;{'get_field...'}];
    97         end
    98 %         ParamOut.FieldList=[{'image'};FieldList;{'get_field...'}];
    99         if CivStage==0% read the field names on the interface get_field.
    100             hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI
    101             if isempty(hget_field)% open the GUI get_field if it is not found
    102                 hget_field= get_field(ObjectName);%open the get_field GUI
    103                 set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1)
     99            if CivStage==0% read the field names on the interface get_field.
     100                hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI
     101                if isempty(hget_field)% open the GUI get_field if it is not found
     102                    hget_field= get_field(ObjectName);%open the get_field GUI
     103                    set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1)
     104                end
     105                hhget_field=guidata(hget_field);
     106                %% update  the get_field GUI
     107                set(hhget_field.inputfile,'String',ObjectName)
     108                set(hhget_field.list_fig,'Value',1)
     109                if exist('num','var')&&~isnan(num)
     110                    set(hhget_field.TimeIndexValue,'String',num2str(num))
     111                end
     112                funct_list=get(hhget_field.ACTION,'UserData');
     113                funct_index=get(hhget_field.ACTION,'Value');
     114                funct=funct_list{funct_index};%select  the current action in get_field, e;g. PLOT
     115                Field=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot
     116                Tabchar={''};%default
     117                Tabcell=[];
     118                set(hhget_field.inputfile,'String',ObjectName)
     119                if isfield(Field,'ListGlobalAttribute')&& ~isempty(Field.ListGlobalAttribute)
     120                    for iline=1:length(Field.ListGlobalAttribute)
     121                        Tabcell{iline,1}=Field.ListGlobalAttribute{iline};
     122                        if isfield(Field, Field.ListGlobalAttribute{iline})
     123                            eval(['val=Field.' Field.ListGlobalAttribute{iline} ';'])
     124                            if ischar(val);
     125                                Tabcell{iline,2}=val;
     126                            else
     127                                Tabcell{iline,2}=num2str(val);
     128                            end
     129                        end
     130                    end
     131                    if ~isempty(Tabcell)
     132                        Tabchar=cell2tab(Tabcell,'=');
     133                        Tabchar=[{''};Tabchar];
     134                    end
     135                end
     136                ParamOut.CivStage=0;
     137                ParamOut.VelType=[];
     138                if isfield(Field,'TimeIndex')
     139                    ParamOut.TimeIndex=Field.TimeIndex;
     140                end
     141                if isfield(Field,'TimeValue')
     142                    ParamOut.TimeValue=Field.TimeValue;
     143                end
     144                ParamOut.FieldList={'get_field...'};
    104145            end
    105             hhget_field=guidata(hget_field);
    106             %% update  the get_field GUI
    107             set(hhget_field.inputfile,'String',ObjectName)
    108             set(hhget_field.list_fig,'Value',1)
    109             if exist('num','var')&&~isnan(num)
    110                 set(hhget_field.TimeIndexValue,'String',num2str(num))
    111             end
    112             funct_list=get(hhget_field.ACTION,'UserData');
    113             funct_index=get(hhget_field.ACTION,'Value');
    114             funct=funct_list{funct_index};%select  the current action in get_field, e;g. PLOT
    115             Field=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot
    116             Tabchar={''};%default
    117             Tabcell=[];
    118             set(hhget_field.inputfile,'String',ObjectName)
    119             if isfield(Field,'ListGlobalAttribute')&& ~isempty(Field.ListGlobalAttribute)
    120                 for iline=1:length(Field.ListGlobalAttribute)
    121                     Tabcell{iline,1}=Field.ListGlobalAttribute{iline};
    122                     if isfield(Field, Field.ListGlobalAttribute{iline})
    123                         eval(['val=Field.' Field.ListGlobalAttribute{iline} ';'])
    124                         if ischar(val);
    125                             Tabcell{iline,2}=val;
    126                         else
    127                             Tabcell{iline,2}=num2str(val);
    128                         end
    129                     end
    130                 end
    131                 if ~isempty(Tabcell)
    132                     Tabchar=cell2tab(Tabcell,'=');
    133                     Tabchar=[{''};Tabchar];
    134                 end
    135             end
    136             %set(hhget_field.attributes,'String',Tabchar);%update list of global attributes in get_field
    137             ParamOut.CivStage=0;
    138             ParamOut.VelType=[];
    139             if isfield(Field,'TimeIndex')
    140                 ParamOut.TimeIndex=Field.TimeIndex;
    141             end
    142             if isfield(Field,'TimeValue')
    143                 ParamOut.TimeValue=Field.TimeValue;
    144             end
    145             ParamOut.FieldList={'get_field...'};
    146         end
    147 %         if CivStage~=0
    148 %             ParamOut.FieldList=[{'image'};FieldList;{'get_field...'}];
    149 %         else
    150 % %             ParamOut.FieldList={'get_field...'};
    151 %         end   
    152     case {'video','mmreader'}
    153         try
     146        case {'video','mmreader'}
    154147            A=read(ObjectName,num);
    155         catch ME
    156             errormsg=ME.message;
    157             return
    158         end
    159         FieldName='image';
    160     case 'vol'
    161         A=imread(ObjectName);
    162         Npz=size(A,1)/ParamIn.Npy;
    163         A=reshape(A',ParamIn.Npx,ParamIn.Npy,Npz);
    164         A=permute(A,[3 2 1]);
    165         FieldName='image';
    166     case 'multimage'
    167         A=imread(ObjectName,num);
    168         FieldName='image';
    169     case 'image'
    170         A=imread(ObjectName);
    171         FieldName='image';
    172 end
     148        case 'vol'
     149            A=imread(ObjectName);
     150            Npz=size(A,1)/ParamIn.Npy;
     151            A=reshape(A',ParamIn.Npx,ParamIn.Npy,Npz);
     152            A=permute(A,[3 2 1]);
     153        case 'multimage'
     154            warning 'off'
     155            A=imread(ObjectName,num);
     156        case 'image'
     157            A=imread(ObjectName);
     158    end
     159catch ME
     160    errormsg=ME.message;
     161    return
     162end
     163
    173164%% case of image
    174165if ~isempty(A)
  • trunk/src/set_object.m

    r432 r445  
    77% hset_object: handle of the GUI figure
    88%
    9 % INPUT:
     9% INPUT:u
    1010% data: structure describing the object properties
    1111%    .Style=...
     
    439439ListObject=get(hhuvmat.ListObject,'String');% list of objects displayed in uvmat
    440440IndexObj=get(hhuvmat.ListObject,'Value');% index of the selected object for display in uvmat
    441 if ~get(hhuvmat.edit_object,'Value') %new object is being created
    442     detectname=1;
    443     ObjectNameNew=ObjectName;
    444     vers=0;% index of the name
    445     while ~isempty(detectname)
    446         detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list
    447         if detectname% if the object name already exists
    448             indstr=regexp(ObjectNameNew,'\D');%indices of non number characters
    449             if indstr(end)<length(ObjectNameNew) %object name ends by a number
    450                 vers=str2double(ObjectNameNew(indstr(end)+1:end))+1;
    451                 ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)];
    452             else
    453                 vers=vers+1;
    454                 ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)];
    455             end
    456         end
    457     end
    458     ObjectName=ObjectNameNew;
    459     set(handles.Name,'String',ObjectName)% display the default name in set_object
    460     IndexObj=numel(ListObject)+1;% append an object to the list in uvmat
    461     set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list
    462     set(hhuvmat.ListObject_1,'String',[ListObject;{ObjectName}]);%complement the object list
    463     set(hhuvmat.ListObject,'Value',IndexObj)
    464     set(hhuvmat.ViewObject,'Value',1)% indicate that the currently selected objected is viewed on set_object
    465     UvData.Object{IndexObj}=[];%initiate a new object (empty yet)
     441%set or modify(edit mode) the nameof the currently selected object
     442detectname=1;
     443ObjectNameNew=ObjectName;
     444vers=0;% index of the name
     445ListOther=ListObject;
     446ListOther(IndexObj)=[];
     447while ~isempty(detectname)
     448    detectname=find(strcmp(ObjectNameNew,ListOther),1);%test the existence of the proposed name in the list
     449    if detectname% if the object name already exists
     450        indstr=regexp(ObjectNameNew,'\D');%indices of non number characters
     451        if indstr(end)<length(ObjectNameNew) %object name ends by a number
     452            vers=str2double(ObjectNameNew(indstr(end)+1:end))+1;
     453            ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)];
     454        else
     455            vers=vers+1;
     456            ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)];
     457        end
     458    end
     459end
     460ObjectName=ObjectNameNew;
     461set(handles.Name,'String',ObjectName)% display the default name in set_object
     462ListObject{IndexObj}=ObjectName;
     463set(hhuvmat.ListObject,'String',ListObject);%complement the object list
     464set(hhuvmat.ViewObject,'Value',1)% indicate that the currently selected objected is viewed on set_object
     465check_handle=isfield(UvData.Object{IndexObj},'DisplayHandle') && isfield(UvData.Object{IndexObj}.DisplayHandle,'uvmat')...
     466    && ~isempty(UvData.Object{IndexObj}.DisplayHandle.uvmat) && ishandle(UvData.Object{IndexObj}.DisplayHandle.uvmat);
     467if check_handle
     468    obj_handle=UvData.Object{IndexObj}.DisplayHandle.uvmat;
     469end
     470UvData.Object{IndexObj}=ObjectData;
     471if check_handle
     472    UvData.Object{IndexObj}.DisplayHandle.uvmat=obj_handle; %preserve the object plot handle if valid
     473else
    466474    UvData.Object{IndexObj}.DisplayHandle.uvmat=hhuvmat.axes3; %axes taken as object display handle by defualt
    467475end
     476set(hhuvmat.edit_object,'Value',1)% set the current object to edit mode
     477%     %IndexObj=numel(ListObject)+1;% append an object to the list in uvmat
     478%     
     479%     set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list
     480%     set(hhuvmat.ListObject_1,'String',[ListObject;{ObjectName}]);%complement the object list
     481%     set(hhuvmat.ListObject,'Value',IndexObj)
     482%     set(hhuvmat.ViewObject,'Value',1)% indicate that the currently selected objected is viewed on set_object
     483%     UvData.Object{IndexObj}=[];%initiate a new object (empty yet)
     484%     UvData.Object{IndexObj}.DisplayHandle.uvmat=hhuvmat.axes3; %axes taken as object display handle by defualt
     485% end
    468486
    469487%% plot the field projected on the object
    470488hview_field=[];%default
     489IndexObj_1=get(hhuvmat.ListObject_1,'Value');
    471490if strcmp(ObjectData.ProjMode,'mask_inside')||strcmp(ObjectData.ProjMode,'mask_outside')||strcmp(ObjectData.ProjMode,'none')
    472491    PlotType='text';
     
    477496        return
    478497    end   
    479     IndexObj_1=get(hhuvmat.ListObject_1,'Value')
    480     if isequal(IndexObj_1,IndexObj) % if only one object is selected, the projection is in uvmat
     498    if isequal(IndexObj_1,IndexObj) % if  the projection is in uvmat
    481499        PlotType=plot_field(ProjData,hhuvmat.axes3,read_GUI(get(hhuvmat.axes3,'parent')));%update the current uvmat plot
    482     else  % if a second object is selected, the projection is in view_field, and this second object is selected
     500    else  % if the projection is in veiw_field
    483501        hview_field=findobj(allchild(0),'tag','view_field');
    484502        if isempty(hview_field)
     
    501519            set(hview_field,'Position',Data.GUISize)
    502520        end
     521        set(hhuvmat.ViewField,'Value',1)% indicate that the field projection on the current object is plotted in view_field
    503522    end
    504523end
    505524
    506525%% update the object plot
    507 % if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle')% save the previous object graph handles
    508 %     ObjectData.DisplayHandle.uvmat=UvData.Object{IndexObj(end)}.DisplayHandle.uvmat;
    509 % else
    510 %     ObjectData.DisplayHandle.uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input
     526hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat;
     527% if we are editing the object used for projection in uvmat
     528if isequal(IndexObj_1,IndexObj)
     529    %update the representation of the current object for projection field represented in view_field
     530    %     UvData.Object{iobj}.DisplayHandle.view_field=...
     531    %                       plot_object(UvData.Object{IndexObj},UvData.Object{IndexObj_1},UvData.Object{iobj}.DisplayHandle.uvmat,'m');
     532    % update the representation of all objects in uvmat
     533    for iobj=1:numel(UvData.Object)
     534        UvData.Object{iobj}.DisplayHandle.uvmat=...
     535            plot_object(UvData.Object{iobj},UvData.Object{IndexObj_1},UvData.Object{iobj}.DisplayHandle.uvmat,'b');
     536    end
     537else %  we are editing the object used for projection field represented in view_field
     538    %update the representation of the current object in uvmat
     539    UvData.Object{IndexObj}.DisplayHandle.uvmat=...
     540             plot_object(UvData.Object{IndexObj},UvData.Object{IndexObj_1},UvData.Object{IndexObj}.DisplayHandle.uvmat,'m');
     541    %indicate the object index in the user data of the object plot (needed for further mouse editing)
     542    ObjectInfo=get(UvData.Object{IndexObj}.DisplayHandle.uvmat,'UserData');
     543    ObjectInfo.IndexObj=IndexObj;
     544    set(UvData.Object{IndexObj}.DisplayHandle.uvmat,'UserData',ObjectInfo)
     545    % update the representation of all objects in view_field
     546    for iobj=1:numel(UvData.Object)
     547        if isfield(UvData.Object{iobj}.DisplayHandle,'view_field')
     548            UvData.Object{iobj}.DisplayHandle.view_field=...
     549                plot_object(UvData.Object{iobj},UvData.Object{iobj},UvData.Object{iobj}.DisplayHandle.view_field,'b');
     550        end
     551    end
     552end
     553% UvData.Object{IndexObj}.DisplayHandle.uvmat=plot_object(ObjectData,UvData.Object{IndexObj_1},hobject,'m');%draw the object in uvmat
     554% if ~isempty(hview_field)
     555%     if isfield(UvData.Object{IndexObj}.DisplayHandle,'view_field')
     556%         hobject=UvData.Object{IndexObj}.DisplayHandle.view_field;
     557%     end
     558%     if isempty(hobject)
     559%         hobject=haxes;
     560%     end   
     561%     %draw the object in view_field
     562%     if ~isequal(IndexObj_1,IndexObj) % if  the projection is in uvmat
     563%     UvData.Object{IndexObj}.DisplayHandle.view_field=plot_object(ObjectData,UvData.Object{IndexObj},hobject,'m');
     564%     end
    511565% end
    512 % if isfield(UvData.Object{IndexObj},'DisplayHandle')% save the previous object graph handles
    513 %     ObjectData.DisplayHandle.view_field=UvData.Object{IndexObj(end)}.DisplayHandle.view_field;
    514 % else
    515 %     ObjectData.DisplayHandle.view_field=[];
    516 % end
    517 % UvData.Object{IndexObj}=ObjectData;%update the current object properties
    518 % if numel(IndexObj)==2
    519 hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat;
    520 if isempty(hobject)
    521     hobject=hhuvmat.axes3;
    522 end
    523 UvData.Object{IndexObj}.DisplayHandle.uvmat=plot_object(ObjectData,[],hobject,'m');%draw the object in uvmat
    524 if ~isempty(hview_field)
    525     if isfield(UvData.Object{IndexObj}.DisplayHandle,'view_field')
    526     hobject=UvData.Object{IndexObj}.DisplayHandle.view_field;
    527     end
    528     if isempty(hobject)
    529         hobject=haxes;
    530     end
    531     UvData.Object{IndexObj}.DisplayHandle.view_field=plot_object(ObjectData,[],hobject,'m');%draw the object in view_field
    532     %     UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));
    533 end
    534566set(huvmat,'UserData',UvData)
    535567
  • trunk/src/uvmat.m

    r444 r445  
    20092009%% read the first input field if a filename has been introduced
    20102010ParamIn.ColorVar='';%default variable name for vector color
     2011frame_index=1;%default
    20112012if ~isempty(filename)
    20122013    ObjectName=filename;
     
    20352036            end
    20362037        case {'video','mmreader'}
    2037             ObjectName=UvData.MovieObject{1};         
     2038            ObjectName=UvData.MovieObject{1};     
     2039            if ~strcmp(NomType,'*')
     2040                frame_index=num_j1;%frame index for movies or multimage
     2041            else
     2042                frame_index=num_i1;
     2043            end
     2044        case 'multimage'
     2045            if ~strcmp(NomType,'*')
     2046                frame_index=num_j1;%frame index for movies or multimage
     2047            else
     2048                frame_index=num_i1;
     2049            end
    20382050        case 'vol' %TODO: update
    20392051            if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx')
     
    20482060    ParamIn.VelType=VelType;
    20492061    ParamIn.GUIName='get_field';
    2050     [Field{1},ParamOut,errormsg] = read_field(ObjectName,UvData.FileType{1},ParamIn,num_i1);
     2062    [Field{1},ParamOut,errormsg] = read_field(ObjectName,UvData.FileType{1},ParamIn,frame_index);
    20512063    if ~isempty(errormsg)
    20522064        errormsg=['error in reading ' filename ': ' errormsg];
     
    20692081FieldName_1=[];
    20702082ParamOut_1=[];
     2083frame_index_1=1;
    20712084if ~isempty(filename_1)
    20722085    if ~exist(filename_1,'file')
     
    20962109        case {'video','mmreader'}
    20972110            Name=UvData.MovieObject{2};
     2111                        if ~strcmp(NomType_1,'*')
     2112                frame_index_1=num_j1;%frame index for movies or multimage
     2113            else
     2114                frame_index_1=num_i1;
     2115            end 
     2116         case 'multimage'
     2117            if ~strcmp(NomType_1,'*')
     2118                frame_index_1=num_j1;%frame index for movies or multimage
     2119            else
     2120                frame_index_1=num_i1;
     2121            end   
    20982122        case 'vol' %TODO: update
    20992123            if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx')
     
    21232147        ParamIn_1.VelType=VelType_1;
    21242148        ParamIn_1.GUIName='get_field_1';
    2125         [Field{2},ParamOut_1,errormsg] = read_field(Name,UvData.FileType{2},ParamIn_1,num_i1);
     2149        [Field{2},ParamOut_1,errormsg] = read_field(Name,UvData.FileType{2},ParamIn_1,frame_index_1);
    21262150        if ~isempty(errormsg)
    21272151            errormsg=['error in reading ' FieldName_1 ' in ' filename_1 ': ' errormsg];
     
    45654589    set(handles.ListObject,'String',ListObject)
    45664590end
     4591
     4592IndexObj=length(ListObject);
     4593
    45674594UvData=get(handles.uvmat,'UserData');
    45684595UvData.Object{IndexObj}=[]; %create a new empty object
     
    45704597UvData.Object{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
    45714598set(handles.uvmat,'UserData',UvData)
    4572 set(handles.ListObject,'Value',length(ListObject))
     4599set(handles.ListObject,'Value',IndexObj)
    45734600hset_object=set_object(data);% call the set_object interface
    45744601set(get(hset_object,'children'),'enable','on')% enable edit action on elements on GUI set_object
Note: See TracChangeset for help on using the changeset viewer.