- Timestamp:
- May 1, 2012, 10:08:36 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field.m
r404 r405 77 77 end 78 78 FieldList=FieldList(check_calc==1); 79 if isempty(FieldList)80 DataOut=DataIn;81 return82 end79 % if isempty(FieldList) 80 % DataOut=DataIn; 81 % return 82 % end 83 83 if isfield(DataIn,'Z')&& isequal(size(DataIn.Z),size(DataIn.X)) 84 84 nbcoord=3; … … 93 93 %% interpolation with new civ data 94 94 if isfield(DataIn,'SubRange') && isfield(DataIn,'Coord_tps') && (exist('Coord_interp','var') || check_grid ||check_der) 95 %create a default grid if needed 96 if ~exist('Coord_interp','var') 97 coord_x=DataIn.XMin:DataIn.Mesh:DataIn.XMax; 98 coord_y=DataIn.XMin:DataIn.Mesh:DataIn.YMax; 99 [XI,YI]=meshgrid(coord_x,coord_y); 100 XI=reshape(XI,[],1); 101 YI=reshape(YI,[],1); 102 Coord_interp=[XI YI]; 103 end 95 104 96 DataOut.ListGlobalAttribute=DataIn.ListGlobalAttribute; %reproduce global attribute 105 97 for ilist=1:numel(DataOut.ListGlobalAttribute) … … 113 105 XMin=min(min(DataIn.SubRange(1,:,:))); 114 106 YMin=min(min(DataIn.SubRange(2,:,:))); 115 % check_der=0; 116 % check_val=0; 107 %create a default grid if needed 108 if ~exist('Coord_interp','var') 109 if ~isfield(DataIn,'Mesh') 110 DataIn.Mesh=sqrt(2*(XMax-XMin)*(YMax-YMin)/numel(DataIn.Coord_tps)); 111 % adjust the mesh to a value 1, 2 , 5 *10^n 112 ord=10^(floor(log10(DataIn.Mesh)));%order of magnitude 113 if DataIn.Mesh/ord>=5 114 DataIn.Mesh=5*ord; 115 elseif DataIn.Mesh/ord>=2 116 DataIn.Mesh=2*ord; 117 else 118 DataIn.Mesh=ord; 119 end 120 end 121 coord_x=XMin:DataIn.Mesh:XMax; 122 coord_y=YMin:DataIn.Mesh:YMax; 123 [XI,YI]=meshgrid(coord_x,coord_y); 124 XI=reshape(XI,[],1); 125 YI=reshape(YI,[],1); 126 Coord_interp=[XI YI]; 127 end 117 128 nb_sites=size(Coord_interp,1); 118 129 nb_coord=size(Coord_interp,2); … … 124 135 DataOut.V=zeros(nb_sites,1); 125 136 otherwise 126 % case{'vort','div','strain'}% case of spatial derivatives137 % case{'vort','div','strain'}% case of spatial derivatives 127 138 DataOut.(FieldList{ilist})=zeros(nb_sites,1); 128 % otherwise % case of a scalar129 % check_val=1;130 % DataOut.(FieldList{ilist})=zeros(size(Coord_interp,1));139 % otherwise % case of a scalar 140 % check_val=1; 141 % DataOut.(FieldList{ilist})=zeros(size(Coord_interp,1)); 131 142 end 132 143 end … … 142 153 % ctrs=DataIn.Coord_tps(1:nbvec_sub,:,isub);%(=initial points) ctrs 143 154 nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap) 144 if check_ val155 if check_grid 145 156 EM = tps_eval(Coord_interp(ind_sel,:),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the velocity from tps 'sources' 146 157 end … … 164 175 VarAttributes{1}.Role='scalar'; 165 176 DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub); 166 case 'norm_vel' 177 case 'norm_vel' 167 178 ListFields={'norm_vel'}; 168 179 VarAttributes{1}.Role='scalar'; -
trunk/src/fileparts_uvmat.m
r390 r405 115 115 %r=regexp(FileName,'.*[^a^b^A^B](?<end_string>ab|AB|[abAB])\>','names'); 116 116 NomType=''; 117 r=regexp(RootFile,'\D (?<num1>\d+)(?<end_string>[a-z]|[A-Z]|[a-z][a-z]|[A-Z][A-Z])$','names');117 r=regexp(RootFile,'\D*(?<num1>\d+)(?<end_string>[a-z]|[A-Z]|[a-z][a-z]|[A-Z][A-Z])$','names'); 118 118 if ~isempty(r) 119 119 NomType=get_type(r.end_string); -
trunk/src/plot_field.m
r404 r405 880 880 set(hima,'YData',AY); 881 881 end 882 % set the transparency to 0.5 if vectors are also plotted 883 if test_vec 884 set(hima,'AlphaData',0.5) 885 else 886 set(hima,'AlphaData',1) 887 end 882 888 end 883 889 test_ima=1; -
trunk/src/read_field.m
r404 r405 64 64 [Field,ParamOut.VelType,errormsg]=read_civdata(ObjectName,InputField,ParamIn.VelType,Data.CivStage); 65 65 CivStage=Field.CivStage; 66 ParamOut.CivStage=Field.CivStage; 66 67 %case of old civx conventions 67 68 elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0) -
trunk/src/set_col_vec.m
r356 r405 11 11 % colcode: struture setting the colorcode for vectors 12 12 % colcode.CName: 'ima_cor','black','white',... 13 % colcode. ListColorCode ='black', 'white', 'rgb','brg', '64 colors'13 % colcode.ColorCode ='black', 'white', 'rgb','brg', '64 colors' 14 14 % colcode.CheckFixVecColor =0; thresholds scaling relative to min and max, =1 fixed thresholds 15 15 % colcode.MinVec; min … … 22 22 function [colorlist,col_vec,colcode_out]=set_col_vec(colcode,vec_C) 23 23 col_vec=[]; 24 if ~isstruct(colcode),colcode=[];end; 24 25 colcode_out=colcode;%default 25 26 if isempty(vec_C) || ~isnumeric(vec_C) 26 colorlist=[0 0 1]; %blue 27 colorlist=[0 0 1]; %blue 27 28 col_vec=ones(size(vec_C)); 28 29 return 29 30 end 30 if (isfield(colcode,'CheckFixVecColor') && isequal(colcode.CheckFixVecColor,1)) 31 minC=colcode.MinVec; 32 maxC=colcode.MaxVec; 31 32 33 34 % colcode_out.ColCode1=ColCode1; 35 % colcode_out.ColCode2=ColCode2; 36 %% uniform color plot 37 check_multicolors=0; 38 col_vec=ones(size(vec_C));%all vectors at color#1 by default 39 %default input parameters 40 if ~isfield(colcode,'ColorCode') || isempty(colcode.ColorCode) 41 colorlist=[0 0 1]; %blue 33 42 else 34 minC=min(vec_C); 35 maxC=max(vec_C); 43 if strcmp(colcode.ColorCode,'black') 44 colorlist(1,:)=[0 0 0];%black 45 elseif strcmp(colcode.ColorCode,'white') 46 colorlist(1,:)=[1 1 1];%white 47 else 48 check_multicolors=1; 49 end 36 50 end 37 51 38 %default input parameters 39 if ~isstruct(colcode),colcode=[];end; 40 if ~isfield(colcode,'ListColorCode') || isempty(colcode.ListColorCode) 41 colorlist=[0 0 1]; %blue 42 col_vec=ones(size(vec_C)); 43 return 52 if check_multicolors 53 if (isfield(colcode,'CheckFixVecColor') && isequal(colcode.CheckFixVecColor,1)) 54 minC=colcode.MinVec; 55 maxC=colcode.MaxVec; 56 else 57 minC=min(vec_C); 58 maxC=max(vec_C); 59 end 60 colcode_out.MinC=minC; 61 colcode_out.MaxC=maxC; 62 if strcmp(colcode.ColorCode,'rgb')|| strcmp(colcode.ColorCode,'bgr')% 3 color representation 63 if isfield(colcode,'ColCode1') 64 colcode_out.ColCode1=colcode.ColCode1; 65 else 66 colcode_out.ColCode1=minC+(maxC-minC)/3;%default 67 end 68 if isfield(colcode,'ColCode2') 69 colcode_out.ColCode2=colcode.ColCode2; 70 else 71 colcode_out.ColCode2=minC+2*(maxC-minC)/3;%default 72 end 73 colorlist(2,:)=[0 1 0];%green 74 col_vec(vec_C < colcode_out.ColCode1)=1;% vectors with vec_C smaller than ColCode1 set to the first color (r or b) 75 col_vec((vec_C >= colcode_out.ColCode1) & (vec_C < colcode_out.ColCode2))=2;% select green vectors 76 col_vec(vec_C >= colcode_out.ColCode2)=3; 77 if strcmp(colcode.ColorCode,'rgb') 78 colorlist(1,:)=[1 0 0];%red 79 colorlist(3,:)=[0 0 1];%blue 80 else 81 colorlist(1,:)=[0 0 1];%blue 82 colorlist(3,:)=[1 0 0];%red 83 end 84 else 85 colorjet=jet;% ususal colormap from blue to red 86 sizlist=size(colorjet); 87 indsel=ceil((sizlist(1)/64)*(1:64)); 88 colorlist(:,1)=colorjet(indsel,1); 89 colorlist(:,2)=colorjet(indsel,2); 90 colorlist(:,3)=colorjet(indsel,3); 91 sizlist=size(colorlist); 92 nblevel=sizlist(1); 93 col2_1=maxC-minC; 94 col_vec=1+floor(nblevel*(vec_C-minC)/col2_1); 95 col_vec=col_vec.*(col_vec<= nblevel)+nblevel*(col_vec >nblevel);% take color #nblevel at saturation 96 col_vec=col_vec.*(col_vec>= 1)+ (col_vec <1);% take color #1 for values below 1 97 end 44 98 end 45 if isfield(colcode,'ColCode1')46 ColCode1=minC+colcode.ColCode1*(maxC-minC);47 else48 ColCode1=minC+(maxC-minC)/3;%default49 end50 if isfield(colcode,'ColCode2')51 ColCode2=minC+colcode.ColCode2*(maxC-minC);52 else53 ColCode2=minC+2*(maxC-minC)/3;%default54 end55 colcode_out.MinC=minC;56 colcode_out.MaxC=maxC;57 if strcmp(colcode.ListColorCode,'black')58 colorlist(1,:)=[0 0 0];%black59 col_vec=ones(size(vec_C));%all vectors at color#160 elseif strcmp(colcode.ListColorCode,'white')61 colorlist(1,:)=[1 1 1];%white62 col_vec=ones(size(vec_C));%all vectors at color#163 elseif strcmp(colcode.ListColorCode,'rgb')|| strcmp(colcode.ListColorCode,'bgr')% 3 color representation64 % ind1=find(vec_C < ColCode1); % =1 for red vectors65 ind_green=find((vec_C >= ColCode1) & (vec_C < ColCode2));% =1 for green vectors66 % ind3=find(vec_C >= ColCode2);% =1 for blue vectors67 colorlist(2,:)=[0 1 0];%green68 col_vec(vec_C < ColCode1)=1;69 col_vec(ind_green)=2;70 col_vec(vec_C >= ColCode2)=3;71 if strcmp(colcode.ListColorCode,'rgb')72 colorlist(1,:)=[1 0 0];%red73 colorlist(3,:)=[0 0 1];%blue74 else75 colorlist(1,:)=[0 0 1];%blue76 colorlist(3,:)=[1 0 0];%red77 end78 else79 colorjet=jet;% ususal colormap from blue to red80 sizlist=size(colorjet);81 indsel=ceil((sizlist(1)/64)*(1:64));82 colorlist(:,1)=colorjet(indsel,1);83 colorlist(:,2)=colorjet(indsel,2);84 colorlist(:,3)=colorjet(indsel,3);85 sizlist=size(colorlist);86 nblevel=sizlist(1);87 col2_1=maxC-minC;88 col_vec=1+floor(nblevel*(vec_C-minC)/col2_1);89 col_vec=col_vec.*(col_vec<= nblevel)+nblevel*(col_vec >nblevel);% take color #nblevel at saturation90 col_vec=col_vec.*(col_vec>= 1)+ (col_vec <1);% take color #1 for values below 191 end -
trunk/src/sub_field.m
r402 r405 17 17 18 18 function [SubData,errormsg]=sub_field(Field,Field_1) 19 20 %% global attributes 19 21 test_attr=0; 20 22 if isfield(Field,'ListGlobalAttribute') … … 22 24 for ilist=1:numel(Field.ListGlobalAttribute) 23 25 AttrName=Field.ListGlobalAttribute{ilist}; 24 eval(['SubData.' AttrName '=Field.' AttrName ';'])26 SubData.(AttrName)=Field.(AttrName); 25 27 end 26 28 test_attr=1; … … 49 51 end 50 52 end 53 54 %% variables 51 55 SubData.ListVarName=Field.ListVarName; 52 56 SubData.VarDimName=Field.VarDimName; … … 54 58 SubData.VarAttribute=Field.VarAttribute; 55 59 end 56 %reproduce Field by default60 %reproduce the first field Field by default 57 61 for ivar=1:numel(Field.ListVarName) 58 62 VarName=Field.ListVarName{ivar}; 59 eval(['SubData.' VarName '=Field.' VarName ';'])60 end 61 62 % fields63 SubData.(VarName)=Field.(VarName); 64 end 65 66 %% check the two input fields 63 67 [CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_indices(Field); 64 68 if ~isempty(errormsg) … … 111 115 end 112 116 113 % substract two vector fields or two scalars117 %% substract two vector fields or two scalars 114 118 if (testU && testU_1) || (~testU && ~testU_1) 115 119 %check coincidence in positions … … 118 122 XName=Field.ListVarName{VarType.coord_x}; 119 123 YName=Field.ListVarName{VarType.coord_y}; 120 eval(['vec_X=Field.' XName ';'])121 eval(['vec_Y=Field.' YName ';'])124 vec_X=Field.(XName); 125 vec_Y=Field.(YName); 122 126 nbpoints=numel(vec_X); 123 127 vec_X=reshape(vec_X,nbpoints,1); … … 361 365 VName_1_1=[VName_1 '_1']; 362 366 end 363 end 367 end 368 364 369 if ~testX_1 365 370 DimCell=[{XName_1_1} {YName_1_1}]; … … 376 381 SubData.VarAttribute=[SubData.VarAttribute {XAttr} {YAttr} {UAttr} {VAttr}]; 377 382 end 378 eval(['SubData.' XName_1_1 '=Field_1.' XName_1 ';'])379 eval(['SubData.' YName_1_1 '=Field_1.' YName_1 ';'])380 eval(['SubData.' UName_1_1 '=Field_1.' UName_1 ';'])381 eval(['SubData.' VName_1_1 '=Field_1.' VName_1 ';'])383 SubData.(XName_1_1)=Field_1.(XName_1); 384 SubData.(YName_1_1)=Field_1.(YName_1); 385 SubData.(UName_1_1)=Field_1.(UName_1); 386 SubData.(VName_1_1)=Field_1.(VName_1); 382 387 end 383 388 -
trunk/src/uvmat.m
r404 r405 769 769 Input.RootFile_1=Input.RootFile; 770 770 end 771 if ~isfield(Input,'FileExt_1')||strcmp(Input.FileExt_1,'"') 772 Input.FileExt_1=Input.FileExt; 773 end 774 if ~isfield(Input,'NomType_1')||strcmp(Input.NomType_1,'"') 775 Input.NomType_1=Input.NomType; 776 end 771 777 %updtate the indices of the second field series to correspond to the newly opened one 772 778 FileName_1=fullfile_uvmat(Input.RootPath_1,Input.SubDir_1,Input.RootFile_1,Input.FileExt_1,Input.NomType_1,i1,i2,j1,j2); … … 1074 1080 col_vec={'get_field...'}; 1075 1081 end 1076 set(handles. ListColorScalar,'String',col_vec)1082 set(handles.ColorScalar,'String',col_vec) 1077 1083 end 1078 1084 end … … 2004 2010 end 2005 2011 if strcmp(FieldName,'velocity') 2006 list_code=get(handles. ListColorCode,'String');% list menu fields2007 index_code=get(handles. ListColorCode,'Value');% selected string index2012 list_code=get(handles.ColorCode,'String');% list menu fields 2013 index_code=get(handles.ColorCode,'Value');% selected string index 2008 2014 if ~strcmp(list_code{index_code},'black') && ~strcmp(list_code{index_code},'white') 2009 list_code=get(handles. ListColorScalar,'String');% list menu fields2010 index_code=get(handles. ListColorScalar,'Value');% selected string index2015 list_code=get(handles.ColorScalar,'String');% list menu fields 2016 index_code=get(handles.ColorScalar,'Value');% selected string index 2011 2017 ParamIn.ColorVar= list_code{index_code}; % selected field 2012 2018 end … … 2043 2049 end 2044 2050 2045 %% choose a second field filename_1 if defined2051 %% choose and read a second field filename_1 if defined 2046 2052 VelType_1=[];%default 2047 2053 FieldName_1=[]; … … 2053 2059 end 2054 2060 Name=filename_1; 2055 % FileType_1=UvData.FileType{2};2056 2061 switch UvData.FileType{2} 2057 2062 case {'civx','civdata','netcdf'}; … … 2064 2069 end 2065 2070 end 2066 if strcmp(FieldName_1,'velocity') 2067 list_code=get(handles. ListColorCode,'String');% list menu fields2068 index_code=get(handles. ListColorCode,'Value');% selected string index2071 if strcmp(FieldName_1,'velocity')&& strcmp(get(handles.ColorCode,'Visible'),'on') 2072 list_code=get(handles.ColorCode,'String');% list menu fields 2073 index_code=get(handles.ColorCode,'Value');% selected string index 2069 2074 if ~strcmp(list_code{index_code},'black') && ~strcmp(list_code{index_code},'white') 2070 list_code=get(handles. ListColorScalar,'String');% list menu fields2071 index_code=get(handles. ListColorScalar,'Value');% selected string index2072 ParamIn .ColorVar= list_code{index_code}; % selected field2075 list_code=get(handles.ColorScalar,'String');% list menu fields 2076 index_code=get(handles.ColorScalar,'Value');% selected string index 2077 ParamIn_1.ColorVar= list_code{index_code}; % selected field for vector color display 2073 2078 end 2074 2079 end … … 2077 2082 case 'vol' %TODO: update 2078 2083 if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx') 2079 ParamIn .Npy=UvData.XmlData.Npy;2080 ParamIn .Npx=UvData.XmlData.Npx;2084 ParamIn_1.Npy=UvData.XmlData.Npy; 2085 ParamIn_1.Npx=UvData.XmlData.Npx; 2081 2086 else 2082 2087 errormsg='Npx and Npy need to be defined in the xml file for volume images .vol'; … … 2094 2099 Field{2}=UvData.Field_1;% keep the stored field 2095 2100 else 2096 ParamIn .FieldName=FieldName_1;2097 ParamIn .VelType=VelType_1;2098 ParamIn .GUIName='get_field_1';2099 [Field{2},ParamOut_1,errormsg] = read_field(Name,UvData.FileType{2},ParamIn ,num_i1);2101 ParamIn_1.FieldName=FieldName_1; 2102 ParamIn_1.VelType=VelType_1; 2103 ParamIn_1.GUIName='get_field_1'; 2104 [Field{2},ParamOut_1,errormsg] = read_field(Name,UvData.FileType{2},ParamIn_1,num_i1); 2100 2105 if ~isempty(errormsg) 2101 2106 errormsg=['error in reading ' FieldName_1 ' in ' filename_1 ': ' errormsg]; 2102 2107 return 2103 2108 end 2104 UvData.Field_1=Field{2}; %store the second field for possible use at next RUN 2105 end 2106 % end 2109 % UvData.Field_1=Field{2}; %store the second field for possible use at next RUN 2110 end 2107 2111 end 2108 2112 … … 2139 2143 set(handles.VelType,'Visible','off') 2140 2144 end 2145 % display the Fields menu from the input file and pick the selected one: 2141 2146 field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList); 2142 2147 set(handles.Fields,'String',ParamOut.FieldList); %update the field menu … … 2144 2149 2145 2150 %% update the display menu for the second velocity type (second menuline) 2151 2146 2152 test_veltype_1=0; 2147 2153 if isempty(filename_1) 2148 2154 set(handles.Fields_1,'Value',1); %update the field menu 2149 2155 set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu 2150 else 2156 elseif ~test_keepdata_1 2151 2157 if (~strcmp(UvData.FileType{2},'netcdf')&&~strcmp(UvData.FileType{2},'civdata')&&~strcmp(UvData.FileType{2},'civx'))|| isequal(FieldName_1,'get_field...') 2152 2158 set(handles.VelType_1,'Visible','off') 2153 else 2159 else 2154 2160 test_veltype_1=1; 2155 2161 set(handles.VelType_1,'Visible','on') 2156 if ~get(handles.FixVelType,'Value')2162 % if ~get(handles.FixVelType,'Value') 2157 2163 menu=set_veltype_display(ParamOut_1.CivStage); 2158 2164 index_menu=strcmp(ParamOut_1.VelType,menu); 2159 2165 set(handles.VelType_1,'Value',1+find(index_menu,1)) 2160 2166 set(handles.VelType_1,'String',[{''};menu]) 2161 end 2162 end 2167 % end 2168 end 2169 % update the second field menu: the same quantity 2170 set(handles.Fields_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu 2171 % display the Fields menu from the input file and pick the selected one: 2172 field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList); 2173 set(handles.Fields_1,'Value',find(field_index,1)+1) 2174 % % synchronise with the first menu if the first selection is not 'velocity' 2175 % if ~strcmp(ParamOut.FieldName,'velocity') 2176 % field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList); 2177 % set(handles.Fields_1,'Value',field_index); %update the field menu 2178 % ParamOut_1.FieldName=ParamOut.FieldName; 2179 % set(handles.Fields_1,'String',ParamOut_1.FieldList) 2180 % end 2163 2181 end 2164 2182 if test_veltype||test_veltype_1 … … 2167 2185 set(handles.FixVelType,'Visible','off') 2168 2186 end 2187 2188 % field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList); 2189 % set(handles.Fields,'String',ParamOut.FieldList); %update the field menu 2190 % set(handles.Fields,'Value',find(field_index,1)) 2169 2191 2170 2192 %% introduce w as background image by default for a new series (only for nbdim=2) … … 2211 2233 Field{1}.ZIndex=z_index; 2212 2234 end 2213 %px to phys or other transform on field2214 2235 if ~isempty(transform) 2215 2236 if length(Field)>=2 … … 2243 2264 2244 2265 %% calculate scalar 2245 % if (strcmp(FileType,'civdata')||strcmp(FileType,'civx'))&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)%2246 %Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1});2247 %end2248 % if numel(Field)==2 && ~test_keepdata_1 && (strcmp(FileType,'civdata')||strcmp(FileType,'civx')) &&~strcmp(ParamOut.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...')2249 %Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2});2250 %end2266 if (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))%&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)% 2267 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1}); 2268 end 2269 if numel(Field)==2 && ~test_keepdata_1 && (strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileType{2},'civx')) &&~strcmp(ParamOut_1.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...') 2270 Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2}); 2271 end 2251 2272 2252 2273 %% combine the two input fields (e.g. substract velocity fields) 2253 Field{1}.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}];2274 %Field{1}.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 2254 2275 if numel(Field)==2 2255 Field{2}.FieldList=[{ParamOut_1.FieldName} {ParamOut_1.ColorVar}];2276 % Field{2}.FieldList=[{ParamOut_1.FieldName} {ParamOut_1.ColorVar}]; 2256 2277 [UvData.Field,errormsg]=sub_field(Field{1},Field{2}); 2278 UvData.Field_1=Field{2}; %store the second field for possible use at next RUN 2257 2279 else 2258 2280 UvData.Field=Field{1}; … … 2423 2445 2424 2446 %% reset the min and max of scalar if only the mask is displayed(TODO: check the need) 2425 if isfield(UvData,'Mask')&& ~isfield(UvData,'A')2426 set(handles.num_MinA,'String','0')2427 set(handles.num_MaxA,'String','255')2428 end2447 % if isfield(UvData,'Mask')&& ~isfield(UvData,'A') 2448 % set(handles.num_MinA,'String','0') 2449 % set(handles.num_MaxA,'String','255') 2450 % end 2429 2451 2430 2452 %% Plot the projections on the selected projection objects … … 2448 2470 %PlotParam{1}=read_plot_param(handles);%read plotting parameters on the uvmat interfac 2449 2471 PlotParam{1}=read_GUI(handles.uvmat); 2472 %default settings if vectors not visible (should not be needed) 2450 2473 if ~isfield(PlotParam{1},'Vectors') 2451 2474 PlotParam{1}.Vectors.MaxVec=1; … … 2454 2477 PlotParam{1}.Vectors.ColCode1=0.33; 2455 2478 PlotParam{1}.Vectors.ColCode2=0.66; 2456 PlotParam{1}.Vectors.ListColorScalar={'ima_cor'};2457 PlotParam{1}.Vectors.ListColorCode= {'rgb'};2479 PlotParam{1}.Vectors.ColorScalar={'ima_cor'}; 2480 PlotParam{1}.Vectors.ColorCode= {'rgb'}; 2458 2481 end 2459 2482 %keeplim(1)=get(handles.CheckFixLimits,'Value');% test for fixed graph limits … … 2466 2489 plot_handles{2}=guidata(view_field_handle); 2467 2490 haxes(2)=plot_handles{2}.axes3; 2468 %PlotParam{2}=read_plot_param(plot_handles{2});%read plotting parameters on the viewinterface2469 2491 PlotParam{2}=read_GUI(handles.uvmat);%read plotting parameters on the uvmat interface 2470 % keeplim(2)=get(plot_handles{2}.CheckFixLimits,'Value');2471 2492 PosColorbar{2}='*'; %TODO: deal with colorbar position on view_field 2472 2493 end 2473 2494 end 2474 2495 2475 % loop on the projection objects: one or two2496 %% loop on the projection objects: one or two 2476 2497 for imap=1:numel(IndexObj) 2477 2498 iobj=IndexObj(imap); 2478 if iobj==1&& ~isfield(UvData.Object{iobj},'Type')% case with no projection (only for the first empty object)2479 [ObjectData,errormsg]=calc_field(UvData.Field.FieldList,UvData.Field);2480 else2499 % if imap==2 || check_proj==0 % field not yet projected) && ~isfield(UvData.Object{iobj},'Type')% case with no projection (only for the first empty object) 2500 % % [ObjectData,errormsg]=calc_field(UvData.Field.FieldList,UvData.Field); 2501 % % else 2481 2502 [ObjectData,errormsg]=proj_field(UvData.Field,UvData.Object{iobj});% project field on the object 2482 end2503 % end 2483 2504 if ~isempty(errormsg) 2484 2505 return … … 2991 3012 UvData.filename_1='';% desactivate the use of a constant second file 2992 3013 list_fields=get(handles.Fields,'String');% list menu fields 2993 index_fields=get(handles.Fields,'Value');% selected string index 2994 field= list_fields{index_fields(1)}; % selected string 3014 field= list_fields{get(handles.Fields,'Value')}; % selected string 2995 3015 list_fields=get(handles.Fields_1,'String');% list menu fields 2996 index_fields=get(handles.Fields_1,'Value');% selected string index 2997 field_1= list_fields{index_fields(1)}; % selected string for the second field 2998 if isequal(field_1,'')||(numel(UvData.FileType)>=2 && strcmp(UvData.FileType{2},'image')) 3016 field_1= list_fields{get(handles.Fields_1,'Value')}; % selected string for the second field 3017 if isempty(field_1)%||(numel(UvData.FileType)>=2 && strcmp(UvData.FileType{2},'image')) 2999 3018 set(handles.SubField,'Value',0) 3000 check_new=1;3019 % check_new=1; 3001 3020 SubField_Callback(hObject, eventdata, handles) 3002 if isempty(field_1)%remove second field if 'blank' field is selected3021 % if isempty(field_1)%remove second field if 'blank' field is selected 3003 3022 return 3004 end 3005 end 3006 set(handles.SubField,'Value',1)%state that a second field is now entered 3023 % end 3024 else 3025 set(handles.SubField,'Value',1)%state that a second field is now entered 3026 end 3007 3027 3008 3028 %% read the rootfile input display 3009 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1 ,NomTYpe_1]=read_file_boxes_1(handles);3029 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles); 3010 3030 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; 3011 3031 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String')); 3012 set(handles.FileIndex_1,'Visible','on')3013 set(handles.FileExt_1,'Visible','on')3032 % set(handles.FileIndex_1,'Visible','on') 3033 % set(handles.FileExt_1,'Visible','on') 3014 3034 switch field_1 3015 3035 case 'get_field...' … … 3027 3047 set(handles.path_transform,'String','') 3028 3048 case 'image' 3029 % transform netc type to the corresponding image type 3030 NomType=get(handles.NomType,'string'); 3031 check_letter=~isempty(regexp(NomType,'[ab|AB]$'));%detect pair label by letter 3032 % NomType_1=NomType; 3033 % if check_letter 3034 % NomType_1=NomType_1(1:end-1); 3035 % else 3036 % r=regexp(NomType_1,'.-(?<num2>\d+$','names'); 3037 % if ~isempty(r) 3038 % NomType_1=regexprep(NomType_1,['-' r.num2],''); 3039 % end 3040 % end 3041 imagename=fullfile_uvmat(RootPath_1,'',RootFile_1,'.png',NomType,i1,[],j1); 3042 if ~exist(imagename,'file') 3049 % guess the image name corresponding to the current netcdf name (no unique correspondance) 3050 imagename=fullfile_uvmat(RootPath_1,'',RootFile_1,'.png',get(handles.NomType,'String'),i1,[],j1); 3051 if ~exist(imagename,'file') % browse for images if it is not found 3043 3052 [FileName,PathName] = uigetfile( ... 3044 3053 {'*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol', ' (*.png, .tif, *.avi,*.vol)'; … … 3050 3059 '*.*', 'All Files (*.*)'}, ... 3051 3060 'Pick an image',imagename); 3052 % display the selected field and related information3053 3061 imagename=[PathName FileName]; 3054 3062 end 3055 set(handles.TitleNpx,'Visible','on')% visible npx,pxcm... buttons 3056 set(handles.TitleNpy,'Visible','on') 3057 set(handles.num_Npx,'Visible','on') 3058 set(handles.num_Npy,'Visible','on') 3059 display_file_name(hObject, eventdata, handles,imagename,2)%display the imag 3063 if ~ischar(imagename)% quit if the browser has been closed 3064 set(handles.SubField,'Value',0) 3065 else %valid browser input: display the selected image 3066 set(handles.TitleNpx,'Visible','on')% visible npx,pxcm... buttons 3067 set(handles.TitleNpy,'Visible','on') 3068 set(handles.num_Npx,'Visible','on') 3069 set(handles.num_Npy,'Visible','on') 3070 display_file_name(hObject, eventdata, handles,imagename,2)%display the imag 3071 end 3060 3072 otherwise 3061 3073 if check_new … … 3071 3083 end 3072 3084 set(handles.uvmat,'UserData',UvData) 3073 % setfield(handles);% update the field structure ('civ1'....)3074 3085 if ~(isfield(UvData,'NewSeries')&&isequal(UvData.NewSeries,1)) 3075 3086 run0_Callback(hObject, eventdata, handles) … … 3112 3123 end 3113 3124 end 3114 3115 3116 3117 3125 menu=menu(1:imax); 3118 3126 … … 3121 3129 function FixVelType_Callback(hObject, eventdata, handles) 3122 3130 %------------------------------------------------------------------------ 3123 val=get(handles.FixVelType,'Value'); 3124 if ~ val3131 % refresh the current plot if the fixed veltype is unselected 3132 if ~get(handles.FixVelType,'Value') 3125 3133 run0_Callback(hObject, eventdata, handles) 3126 3134 end … … 3137 3145 function VelType_1_Callback(hObject, eventdata, handles) 3138 3146 %------------------------------------------------------------------------ 3139 3140 3147 set(handles.FixVelType,'Value',1)% the velocity type is now imposed by the GUI (not automatic) 3141 3148 UvData=get(handles.uvmat,'UserData'); 3142 %refresh field with a second filename=first fi elname3149 %refresh field with a second filename=first file name 3143 3150 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow 3144 3151 drawnow … … 3146 3153 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 3147 3154 filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 3148 % VelTypeList=get(handles.VelType_1,'String'); 3149 % VelType_1=VelTypeList{get(handles.VelType_1,'Value')}; 3155 3150 3156 if isempty(InputFile.VelType_1) 3151 3157 filename_1='';% we plot the current field without the second field … … 3155 3161 [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles); 3156 3162 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1]; 3157 % UvData.VelType{2}=InputFile.VelType_1; 3158 else 3159 filename_1=filename;% we compare two fields in the same file 3163 else 3164 filename_1=filename;% we compare two fields in the same file by default 3160 3165 UvData.FileType{2}=UvData.FileType{1}; 3161 % UvData.VelType{2}=InputFile.VelType_1;3162 3166 set(handles.SubField,'Value',1) 3163 3167 end … … 3369 3373 %------------------------------------------------------------------ 3370 3374 3371 %------------------------------------------------------------------ 3372 % --- Executes on selection change in ListColorScalar: choice of the color code. 3373 function ListColorScalar_Callback(hObject, eventdata, handles) 3374 %------------------------------------------------------------------ 3375 % edit the choice for color code 3376 list_code=get(handles.ListColorScalar,'String');% list menu fields 3377 index_code=get(handles.ListColorScalar,'Value');% selected string index 3378 col_code= list_code{index_code(1)}; % selected field 3379 if isequal(col_code,'black') || isequal(col_code,'white') 3380 set(handles.Slider1,'Visible','off') 3381 set(handles.Slider2,'Visible','off') 3382 set(handles.num_ColCode1,'Visible','off') 3383 set(handles.num_ColCode2,'Visible','off') 3384 set(handles.CheckFixVecColor,'Visible','off') 3385 set_vec_col_bar(handles) 3386 else 3387 set(handles.Slider1,'Visible','on') 3388 set(handles.Slider2,'Visible','on') 3389 set(handles.num_ColCode1,'Visible','on') 3390 set(handles.num_ColCode2,'Visible','on') 3391 set(handles.CheckFixVecColor,'Visible','on') 3392 if isequal(col_code,'ima_cor') 3393 set(handles.CheckFixVecColor,'Value',0)%fixed scale by default 3394 set(handles.VecColBar,'Value',0)% 3 colors r,g,b by default 3395 set(handles.Slider1,'Min',0); 3396 set(handles.Slider1,'Max',1); 3397 set(handles.Slider2,'Min',0); 3398 set(handles.Slider2,'Max',1); 3399 % set(handles.min_title_vec,'String','0') 3400 set(handles.num_MaxVec,'String','1') 3401 set(handles.num_ColCode1,'String','0.333') 3402 num_ColCode1_Callback(hObject, eventdata, handles) 3403 set(handles.num_ColCode2,'String','0.666') 3404 num_ColCode2_Callback(hObject, eventdata, handles) 3405 else 3406 set(handles.CheckFixVecColor,'Value',1)%auto scale between min,max by default 3407 set(handles.VecColBar,'Value',1)% colormap 'jet' by default 3408 minval=get(handles.Slider1,'Min'); 3409 maxval=get(handles.Slider1,'Max'); 3410 set(handles.Slider1,'Value',minval) 3411 set(handles.Slider2,'Value',maxval) 3412 set_vec_col_bar(handles) 3413 end 3414 % slider_update(handles) 3415 end 3416 %replot the current graph 3417 run0_Callback(hObject, eventdata, handles) 3418 3419 3420 %---------------------------------------------------------------- 3421 % -- Executes on slider movement to set the color code 3422 % 3423 function Slider1_Callback(hObject, eventdata, handles) 3424 %------------------------------------------------------------------ 3425 slider1=get(handles.Slider1,'Value'); 3426 min_val=str2num(get(handles.num_MinVec,'String')); 3427 max_val=str2num(get(handles.num_MaxVec,'String')); 3428 col=min_val+(max_val-min_val)*slider1; 3429 set(handles.num_ColCode1,'String',num2str(col)) 3430 if(get(handles.Slider2,'Value') < col)%move also the second slider at the same value if needed 3431 set(handles.Slider2,'Value',col) 3432 set(handles.num_ColCode2,'String',num2str(col)) 3433 end 3434 num_ColCode1_Callback(hObject, eventdata, handles) 3435 3436 %---------------------------------------------------------------- 3437 % Executes on slider movement to set the color code 3438 %---------------------------------------------------------------- 3439 function Slider2_Callback(hObject, eventdata, handles) 3440 slider2=get(handles.Slider2,'Value'); 3441 min_val=str2num(get(handles.num_MinVec,'String')); 3442 max_val=str2num(get(handles.num_MaxVec,'String')); 3443 col=min_val+(max_val-min_val)*slider2; 3444 set(handles.num_ColCode2,'String',num2str(col)) 3445 if(get(handles.Slider1,'Value') > col)%move also the first slider at the same value if needed 3446 set(handles.Slider1,'Value',col) 3447 set(handles.num_ColCode1,'String',num2str(col)) 3448 end 3449 num_ColCode2_Callback(hObject, eventdata, handles) 3450 3451 %---------------------------------------------------------------- 3452 % --- Execute on return carriage on the edit box corresponding to slider 1 3453 %---------------------------------------------------------------- 3454 function num_ColCode1_Callback(hObject, eventdata, handles) 3455 set_vec_col_bar(handles) 3456 update_plot(handles); 3457 3458 %---------------------------------------------------------------- 3459 % --- Execute on return carriage on the edit box corresponding to slider 2 3460 %---------------------------------------------------------------- 3461 function num_ColCode2_Callback(hObject, eventdata, handles) 3462 set_vec_col_bar(handles) 3463 update_plot(handles); 3464 %------------------------------------------------------------------------ 3465 %------------------------------------------------------- 3466 % --- Executes on button press in CheckFixVecColor. 3467 %------------------------------------------------------- 3468 function VecColBar_Callback(hObject, eventdata, handles) 3469 set_vec_col_bar(handles) 3375 3470 3376 3471 3377 %------------------------------------------------------------- … … 3649 3555 %CALLBACKS FOR PLOTTING PARAMETERS 3650 3556 %------------------------------------------------- 3651 3557 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3558 % Plot coordinates 3559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3652 3560 %------------------------------------------------------------------------ 3653 3561 function num_MinX_Callback(hObject, eventdata, handles) … … 3678 3586 update_plot(handles); 3679 3587 3588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3589 % Scalar or image representation 3590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3680 3591 %------------------------------------------------------------------------ 3681 3592 function num_MinA_Callback(hObject, eventdata, handles) … … 3744 3655 update_plot(handles); 3745 3656 3657 3658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3659 % Vector representation 3660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3746 3661 %------------------------------------------------------------------- 3747 3662 function CheckHideWarning_Callback(hObject, eventdata, handles) … … 3780 3695 3781 3696 %------------------------------------------------------------------------ 3782 % --- Executes on selection change in ListColorCode menu 3783 function ListColorCode_Callback(hObject, eventdata, handles) 3784 %------------------------------------------------------------------------ 3697 % --- Executes on selection change in ColorCode menu 3698 function ColorCode_Callback(hObject, eventdata, handles) 3699 %------------------------------------------------------------------------ 3700 % edit the choice for color code 3701 update_color_code_boxes(handles); 3702 update_plot(handles); 3703 3704 %------------------------------------------------------------------------ 3705 function update_color_code_boxes(handles) 3706 %------------------------------------------------------------------------ 3707 list_code=get(handles.ColorCode,'String');% list menu fields 3708 colcode= list_code{get(handles.ColorCode,'Value')}; % selected field 3709 enable_slider='off';%default 3710 enable_bounds='off';%default 3711 enable_scalar='off';%default 3712 switch colcode 3713 case {'rgb','bgr'} 3714 enable_slider='on'; 3715 enable_bounds='on'; 3716 enable_scalar='on'; 3717 case '64 colors' 3718 enable_bounds='on'; 3719 enable_scalar='on'; 3720 end 3721 set(handles.Slider1,'Visible',enable_slider) 3722 set(handles.Slider2,'Visible', enable_slider) 3723 set(handles.num_ColCode1,'Visible',enable_slider) 3724 set(handles.num_ColCode2,'Visible',enable_slider) 3725 set(handles.TitleColCode1,'Visible',enable_slider) 3726 set(handles.TitleColCode2,'Visible',enable_slider) 3727 set(handles.CheckFixVecColor,'Visible',enable_bounds) 3728 set(handles.num_MinVec,'Visible',enable_bounds) 3729 set(handles.num_MaxVec,'Visible',enable_bounds) 3730 set(handles.ColorScalar,'Visible',enable_scalar) 3731 set_vec_col_bar(handles) 3732 3733 %------------------------------------------------------------------ 3734 % --- Executes on selection change in ColorScalar: choice of the color code. 3735 function ColorScalar_Callback(hObject, eventdata, handles) 3736 %------------------------------------------------------------------ 3737 % edit the choice for color code 3738 list_scalar=get(handles.ColorScalar,'String');% list menu fields 3739 col_scalar= list_scalar{get(handles.ColorScalar,'Value')}; % selected field 3740 if isequal(col_scalar,'ima_cor') 3741 set(handles.CheckFixVecColor,'Value',1)%fixed scale by default 3742 ColorCode='rgb'; 3743 set(handles.num_MinVec,'String','0') 3744 set(handles.num_MaxVec,'String','1') 3745 set(handles.num_ColCode1,'String','0.333') 3746 set(handles.num_ColCode2,'String','0.666') 3747 else 3748 set(handles.CheckFixVecColor,'Value',0)%auto scale between min,max by default 3749 ColorCode='64 colors'; 3750 end 3751 ColorCodeList=get(handles.ColorCode,'String'); 3752 ichoice=find(strcmp(ColorCode,ColorCodeList),1); 3753 set(handles.ColorCode,'Value',ichoice)% set color code in the menu 3754 3755 update_color_code_boxes(handles); 3756 %replot the current graph 3757 run0_Callback(hObject, eventdata, handles) 3758 3759 %---------------------------------------------------------------- 3760 % -- Executes on slider movement to set the color code 3761 % 3762 function Slider1_Callback(hObject, eventdata, handles) 3763 %------------------------------------------------------------------ 3764 slider1=get(handles.Slider1,'Value'); 3765 min_val=str2num(get(handles.num_MinVec,'String')); 3766 max_val=str2num(get(handles.num_MaxVec,'String')); 3767 col=min_val+(max_val-min_val)*slider1; 3768 set(handles.num_ColCode1,'String',num2str(col)) 3769 if(get(handles.Slider2,'Value') < col)%move also the second slider at the same value if needed 3770 set(handles.Slider2,'Value',col) 3771 set(handles.num_ColCode2,'String',num2str(col)) 3772 end 3785 3773 set_vec_col_bar(handles) 3786 3774 update_plot(handles); 3787 3775 3776 %---------------------------------------------------------------- 3777 % Executes on slider movement to set the color code 3778 %---------------------------------------------------------------- 3779 function Slider2_Callback(hObject, eventdata, handles) 3780 slider2=get(handles.Slider2,'Value'); 3781 min_val=str2num(get(handles.num_MinVec,'String')); 3782 max_val=str2num(get(handles.num_MaxVec,'String')); 3783 col=min_val+(max_val-min_val)*slider2; 3784 set(handles.num_ColCode2,'String',num2str(col)) 3785 if(get(handles.Slider1,'Value') > col)%move also the first slider at the same value if needed 3786 set(handles.Slider1,'Value',col) 3787 set(handles.num_ColCode1,'String',num2str(col)) 3788 end 3789 set_vec_col_bar(handles) 3790 update_plot(handles); 3791 3792 %---------------------------------------------------------------- 3793 % --- Execute on return carriage on the edit box corresponding to slider 1 3794 %---------------------------------------------------------------- 3795 function num_ColCode1_Callback(hObject, eventdata, handles) 3796 set_vec_col_bar(handles) 3797 update_plot(handles); 3798 3799 %---------------------------------------------------------------- 3800 % --- Execute on return carriage on the edit box corresponding to slider 2 3801 %---------------------------------------------------------------- 3802 function num_ColCode2_Callback(hObject, eventdata, handles) 3803 set_vec_col_bar(handles) 3804 update_plot(handles); 3805 %------------------------------------------------------------------------ 3806 %------------------------------------------------------- 3807 % --- Executes on button press in CheckFixVecColor. 3808 %------------------------------------------------------- 3809 function VecColBar_Callback(hObject, eventdata, handles) 3810 set_vec_col_bar(handles) 3811 3788 3812 %------------------------------------------------------------------------ 3789 3813 % --- Executes on button press in CheckFixVecColor. 3790 3814 function CheckFixVecColor_Callback(hObject, eventdata, handles) 3791 3815 %------------------------------------------------------------------------ 3792 test=get(handles.CheckFixVecColor,'Value'); 3793 if test 3794 set(handles.CheckFixVecColor,'BackgroundColor',[1 1 0]) 3795 else 3816 if ~get(handles.CheckFixVecColor,'Value') 3796 3817 update_plot(handles); 3797 %set(handles.num_VecScale,'String',num2str(ScalOut.num_VecScale,3))3798 set(handles.CheckFixVecColor,'BackgroundColor',[0.7 0.7 0.7])3799 3818 end 3800 3819 … … 3822 3841 3823 3842 %------------------------------------------------------------------------ 3824 % --- update the display of color code for vectors 3843 % --- update the display of color code for vectors (on vecColBar) 3825 3844 function set_vec_col_bar(handles) 3826 3845 %------------------------------------------------------------------------ … … 3833 3852 3834 3853 %get slider indications 3835 list=get(handles. ListColorCode,'String');3836 ichoice=get(handles. ListColorCode,'Value');3837 colcode. ListColorCode=list{ichoice};3854 list=get(handles.ColorCode,'String'); 3855 ichoice=get(handles.ColorCode,'Value'); 3856 colcode.ColorCode=list{ichoice}; 3838 3857 colcode.MinVec=str2num(get(handles.num_MinVec,'String')); 3839 3858 colcode.MaxVec=str2num(get(handles.num_MaxVec,'String')); 3840 test3color=strcmp(colcode. ListColorCode,'rgb') || strcmp(colcode.ListColorCode,'bgr');3859 test3color=strcmp(colcode.ColorCode,'rgb') || strcmp(colcode.ColorCode,'bgr'); 3841 3860 if test3color 3842 3861 colcode.ColCode1=str2num(get(handles.num_ColCode1,'String')); 3843 3862 colcode.ColCode2=str2num(get(handles.num_ColCode2,'String')); 3844 3863 end 3845 % colcode.FixedCbounds=0;3846 %colcode.CheckFixVecColor=1;3847 3864 vec_C=colcode.MinVec+(colcode.MaxVec-colcode.MinVec)*(0.5:width-0.5)/width;%sample of vec_C values from min to max 3848 3865 [colorlist,col_vec]=set_col_vec(colcode,vec_C); … … 4641 4658 web(helpfile); 4642 4659 end 4643 4644 4645 4646 -
trunk/src/view_field.m
r402 r405 768 768 769 769 770 771 772 % --- Executes on selection change in ColorCode. 773 function ColorCode_Callback(hObject, eventdata, handles) 774 % hObject handle to ColorCode (see GCBO) 775 % eventdata reserved - to be defined in a future version of MATLAB 776 % handles structure with handles and user data (see GUIDATA) 777 778 % Hints: contents = cellstr(get(hObject,'String')) returns ColorCode contents as cell array 779 % contents{get(hObject,'Value')} returns selected item from ColorCode 780 781 782 % --- Executes on selection change in ColorScalar. 783 function ColorScalar_Callback(hObject, eventdata, handles) 784 % hObject handle to ColorScalar (see GCBO) 785 % eventdata reserved - to be defined in a future version of MATLAB 786 % handles structure with handles and user data (see GUIDATA) 787 788 % Hints: contents = cellstr(get(hObject,'String')) returns ColorScalar contents as cell array 789 % contents{get(hObject,'Value')} returns selected item from ColorScalar -
trunk/src/write_plot_param.m
r313 r405 54 54 set(handles.num_MinVec,'String', num2str(MinC,3)); 55 55 set(handles.num_MaxVec,'String',num2str(MaxC,3)); 56 list=get(handles. ListColorCode,'String');57 ichoice=get(handles. ListColorCode,'Value');56 list=get(handles.ColorCode,'String'); 57 ichoice=get(handles.ColorCode,'Value'); 58 58 color_option=list{ichoice}; 59 59 test3color=strcmp(color_option,'rgb')||strcmp(color_option,'bgr'); … … 63 63 set(handles.Slider1,'Visible','on') 64 64 set(handles.Slider2,'Visible','on') 65 ColCode1=MinC+(MaxC-MinC)*PlotParam.Vectors.ColCode1; 66 ColCode2=MinC+(MaxC-MinC)*PlotParam.Vectors.ColCode2; 67 set(handles.num_ColCode1,'String',num2str(ColCode1,3)) 68 set(handles.num_ColCode2,'String',num2str(ColCode2,3)) 69 set(handles.Slider1,'Value',PlotParam.Vectors.ColCode1) 70 set(handles.Slider2,'Value',PlotParam.Vectors.ColCode2) 65 %ColCode1=MinC+(MaxC-MinC)*PlotParam.Vectors.ColCode1; 66 %ColCode2=MinC+(MaxC-MinC)*PlotParam.Vectors.ColCode2; 67 % ColCode1=MinC+(MaxC-MinC)*PlotParam.Vectors.ColCode1; 68 %ColCode2=MinC+(MaxC-MinC)*PlotParam.Vectors.ColCode2; 69 set(handles.num_ColCode1,'String',num2str(PlotParam.Vectors.ColCode1,3)) 70 set(handles.num_ColCode2,'String',num2str(PlotParam.Vectors.ColCode2,3)) 71 set(handles.Slider1,'Value',(PlotParam.Vectors.ColCode1-MinC)/(MaxC-MinC)) 72 set(handles.Slider2,'Value',(PlotParam.Vectors.ColCode2-MinC)/(MaxC-MinC)) 71 73 else 72 74 set(handles.num_ColCode1,'Visible','off')
Note: See TracChangeset
for help on using the changeset viewer.