- Timestamp:
- Jun 8, 2012, 4:30:52 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ_matlab.m
r444 r445 105 105 par_civ1.ImageA=Field.A;%= image matrix A in the first input field 106 106 end 107 if isfield(par_civ1,'ImageB')&& (ischar(par_civ1.ImageB)||strcmp(class(par_civ1.Image A),'VideoReader'))107 if isfield(par_civ1,'ImageB')&& (ischar(par_civ1.ImageB)||strcmp(class(par_civ1.ImageB),'VideoReader')) 108 108 [Field,ParamOut,errormsg] = read_field(par_civ1.ImageB,par_civ1.FileTypeB,[],par_civ1.FrameIndexB); 109 109 if ~isempty(errormsg) -
trunk/src/find_file_series.m
r441 r445 52 52 % ifile_min=1;%default 53 53 [FileType,FileInfo,Object]=get_file_type(fullfileinput); 54 NbFrame=1; 55 54 56 switch FileType 55 57 case 'multimage' 56 NomType='*'; 57 i1_series=(1:FileInfo.NbFrame)'; 58 % NomType='*'; 59 % i1_series=(1:FileInfo.NbFrame)'; 60 NbFrame=FileInfo.NbFrame; 58 61 case {'video','mmreader'} 59 62 NomType='*'; 60 i1_series=(1:FileInfo.NumberOfFrames)'; 63 NbFrame=FileInfo.NumberOfFrames; 64 % i1_series=(1:FileInfo.NumberOfFrames)'; 61 65 end 62 66 % if strcmp( FileType,'multimage')||strcmp( FileType,'video')||strcmp( FileType,'mmreader') … … 64 68 % i1_series=(1:FileInfo.NumberOfFrames)'; 65 69 % end 66 70 RootFile_i=''; 71 NomTypePref=''; 67 72 if strcmp(NomType,'')||strcmp(NomType,'*') 68 73 if exist(fullfileinput,'file') … … 77 82 else 78 83 %% possibly include the first index in the root name, if there exists a corresponding xml file 79 NomTypePref='';80 84 r=regexp(NomType,'^(?<tiretnum>_?\d+)','names');%look for a number or _1 at the beginning of NomType 81 85 if ~isempty(r) … … 87 91 end 88 92 if ~isempty(rr) 89 RootFile New=[RootFile rr.i1];90 checkpair=~isempty(regexp(NomType,'-','once'))||~isempty(regexp(NomType,'ab$','once'))||~isempty(regexp(NomType,'AB$','once'));%case of PIV results91 if exist(fullfile(RootPath,SubDir,[RootFile New '.xml']),'file') %|| (checkpair && exist(fullfile(fileparts(RootPath),[RootFileNew'.xml']),'file'))92 RootFile=RootFile New;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; 93 97 NomTypePref=r.tiretnum; 94 98 NomType=regexprep(NomType,['^' NomTypePref],''); … … 252 256 if isequal(j2_series,0), j2_series=[]; end 253 257 258 %% introduce the frame index in case of movies or multimage type 259 if 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 267 end 268 254 269 %% sort pairs by decreasing index differences in case of multiple pairs at the same reference index 255 270 if size(i2_series,3)>1 %pairs i1 -i2 … … 280 295 end 281 296 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 20 20 uvmat(filename) 21 21 set(gcbo,'Value',1) 22 delete(get(hObject,'parent'))%delete the display figure to stop the check process22 % delete(get(hObject,'parent'))%delete the display figure to stop the check process 23 23 end -
trunk/src/proj_field.m
r421 r445 1159 1159 for ivar=VarIndex 1160 1160 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)) 1162 1163 ivar_new=ivar_new+1; 1163 1164 ProjData.ListVarName=[ProjData.ListVarName {VarName}]; -
trunk/src/read_field.m
r441 r445 24 24 % = vol: images representing scanned volume (images concatened in the y direction) 25 25 % 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'...) 28 28 % .ColorVar: variable used for vector color 29 29 % .Npx, .Npy: nbre of pixels along x and y (used for .vol input files) … … 43 43 A=[]; 44 44 %% 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); 45 try 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 65 94 CivStage=Field.CivStage; 66 95 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...'}]; 95 98 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...'}; 104 145 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'} 154 147 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 159 catch ME 160 errormsg=ME.message; 161 return 162 end 163 173 164 %% case of image 174 165 if ~isempty(A) -
trunk/src/set_object.m
r432 r445 7 7 % hset_object: handle of the GUI figure 8 8 % 9 % INPUT: 9 % INPUT:u 10 10 % data: structure describing the object properties 11 11 % .Style=... … … 439 439 ListObject=get(hhuvmat.ListObject,'String');% list of objects displayed in uvmat 440 440 IndexObj=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 442 detectname=1; 443 ObjectNameNew=ObjectName; 444 vers=0;% index of the name 445 ListOther=ListObject; 446 ListOther(IndexObj)=[]; 447 while ~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 459 end 460 ObjectName=ObjectNameNew; 461 set(handles.Name,'String',ObjectName)% display the default name in set_object 462 ListObject{IndexObj}=ObjectName; 463 set(hhuvmat.ListObject,'String',ListObject);%complement the object list 464 set(hhuvmat.ViewObject,'Value',1)% indicate that the currently selected objected is viewed on set_object 465 check_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); 467 if check_handle 468 obj_handle=UvData.Object{IndexObj}.DisplayHandle.uvmat; 469 end 470 UvData.Object{IndexObj}=ObjectData; 471 if check_handle 472 UvData.Object{IndexObj}.DisplayHandle.uvmat=obj_handle; %preserve the object plot handle if valid 473 else 466 474 UvData.Object{IndexObj}.DisplayHandle.uvmat=hhuvmat.axes3; %axes taken as object display handle by defualt 467 475 end 476 set(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 468 486 469 487 %% plot the field projected on the object 470 488 hview_field=[];%default 489 IndexObj_1=get(hhuvmat.ListObject_1,'Value'); 471 490 if strcmp(ObjectData.ProjMode,'mask_inside')||strcmp(ObjectData.ProjMode,'mask_outside')||strcmp(ObjectData.ProjMode,'none') 472 491 PlotType='text'; … … 477 496 return 478 497 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 481 499 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 selected500 else % if the projection is in veiw_field 483 501 hview_field=findobj(allchild(0),'tag','view_field'); 484 502 if isempty(hview_field) … … 501 519 set(hview_field,'Position',Data.GUISize) 502 520 end 521 set(hhuvmat.ViewField,'Value',1)% indicate that the field projection on the current object is plotted in view_field 503 522 end 504 523 end 505 524 506 525 %% 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 526 hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat; 527 % if we are editing the object used for projection in uvmat 528 if 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 537 else % 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 552 end 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 511 565 % end 512 % if isfield(UvData.Object{IndexObj},'DisplayHandle')% save the previous object graph handles513 % ObjectData.DisplayHandle.view_field=UvData.Object{IndexObj(end)}.DisplayHandle.view_field;514 % else515 % ObjectData.DisplayHandle.view_field=[];516 % end517 % UvData.Object{IndexObj}=ObjectData;%update the current object properties518 % if numel(IndexObj)==2519 hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat;520 if isempty(hobject)521 hobject=hhuvmat.axes3;522 end523 UvData.Object{IndexObj}.DisplayHandle.uvmat=plot_object(ObjectData,[],hobject,'m');%draw the object in uvmat524 if ~isempty(hview_field)525 if isfield(UvData.Object{IndexObj}.DisplayHandle,'view_field')526 hobject=UvData.Object{IndexObj}.DisplayHandle.view_field;527 end528 if isempty(hobject)529 hobject=haxes;530 end531 UvData.Object{IndexObj}.DisplayHandle.view_field=plot_object(ObjectData,[],hobject,'m');%draw the object in view_field532 % UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));533 end534 566 set(huvmat,'UserData',UvData) 535 567 -
trunk/src/uvmat.m
r444 r445 2009 2009 %% read the first input field if a filename has been introduced 2010 2010 ParamIn.ColorVar='';%default variable name for vector color 2011 frame_index=1;%default 2011 2012 if ~isempty(filename) 2012 2013 ObjectName=filename; … … 2035 2036 end 2036 2037 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 2038 2050 case 'vol' %TODO: update 2039 2051 if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx') … … 2048 2060 ParamIn.VelType=VelType; 2049 2061 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); 2051 2063 if ~isempty(errormsg) 2052 2064 errormsg=['error in reading ' filename ': ' errormsg]; … … 2069 2081 FieldName_1=[]; 2070 2082 ParamOut_1=[]; 2083 frame_index_1=1; 2071 2084 if ~isempty(filename_1) 2072 2085 if ~exist(filename_1,'file') … … 2096 2109 case {'video','mmreader'} 2097 2110 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 2098 2122 case 'vol' %TODO: update 2099 2123 if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx') … … 2123 2147 ParamIn_1.VelType=VelType_1; 2124 2148 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); 2126 2150 if ~isempty(errormsg) 2127 2151 errormsg=['error in reading ' FieldName_1 ' in ' filename_1 ': ' errormsg]; … … 4565 4589 set(handles.ListObject,'String',ListObject) 4566 4590 end 4591 4592 IndexObj=length(ListObject); 4593 4567 4594 UvData=get(handles.uvmat,'UserData'); 4568 4595 UvData.Object{IndexObj}=[]; %create a new empty object … … 4570 4597 UvData.Object{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation 4571 4598 set(handles.uvmat,'UserData',UvData) 4572 set(handles.ListObject,'Value', length(ListObject))4599 set(handles.ListObject,'Value',IndexObj) 4573 4600 hset_object=set_object(data);% call the set_object interface 4574 4601 set(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.