- Timestamp:
- Jul 20, 2024, 9:33:32 AM (5 months ago)
- Location:
- trunk/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/filter_tps_3D.m
r1161 r1162 43 43 warning off 44 44 NbVec=size(Coord,1);% nbre of vectors in the field to interpolate 45 NbCoord=size(Coord,2);% space dimension 45 NbCoord=size(Coord,2);% space dimension,Coord(:,1)= x,Coord(:,2)= y , Coord(:,3)= z 46 46 MinCoord=min(Coord,[],1);%lower coordinate bounds 47 47 MaxCoord=max(Coord,[],1);%upper coordinate bounds 48 Range=MaxCoord-MinCoord; 49 AspectRatio=Range(2)/Range(1); 50 NbSubDomain=NbVec/SubDomainSize;% estimated number of subdomains 51 NbSubDomainX=max(floor(sqrt(NbSubDomain/AspectRatio)),1);% estimated number of subdomains in x 52 NbSubDomainY=max(floor(sqrt(NbSubDomain*AspectRatio)),1);% estimated number of subdomains in y 53 NbSubDomainZ=max(floor(sqrt(NbSubDomain*AspectRatio)),1);% estimated number of subdomains in y 48 Range=MaxCoord-MinCoord;%along eacch coordiante x,y,z 49 Cellmesh=(prod(Range)/NbVec)^(1/3); 50 NbSubDomainX=floor(range(1)/Cellmesh); 51 NbSubDomainY=floor(range(2)/Cellmesh); 52 NbSubDomainZ=floor(range(3)/Cellmesh); 53 54 % NbSubDomain=NbVec/SubDomainSize;% estimated number of subdomains 55 % NbSubDomainX=max(floor(sqrt(NbSubDomain/(AspectRatio(1)*AspectRatio(2))),1);% estimated number of subdomains in x 56 % NbSubDomainY=max(floor(sqrt(NbSubDomain*AspectRatio)),1);% estimated number of subdomains in y 57 % NbSubDomainZ=max(floor(sqrt(NbSubDomain*AspectRatio)),1);% estimated number of subdomains in y 54 58 NbSubDomain=NbSubDomainX*NbSubDomainY;% new estimated number of subdomains in a matrix shape partition in subdomains 55 59 Siz(1)=Range(1)/NbSubDomainX;%width of subdomains 56 60 Siz(2)=Range(2)/NbSubDomainY;%height of subdomains 61 Siz(3)=Range(3)/NbSubDomainZ;%height of subdomains 57 62 CentreX=linspace(MinCoord(1)+Siz(1)/2,MaxCoord(1)-Siz(1)/2,NbSubDomainX);% X positions of subdomain centres 58 63 CentreY=linspace(MinCoord(2)+Siz(2)/2,MaxCoord(2)-Siz(2)/2,NbSubDomainY);% Y positions of subdomain centres 59 [CentreX,CentreY]=meshgrid(CentreX,CentreY); 64 CentreZ=linspace(MinCoord(3)+Siz(3)/2,MaxCoord(3)-Siz(3)/2,NbSubDomainZ);% Y positions of subdomain centres 65 [CentreX,CentreY,CentreZ]=meshgrid(CentreX,CentreY,CentreZ); 60 66 CentreX=reshape(CentreX,1,[]);% X positions of subdomain centres 61 67 CentreY=reshape(CentreY,1,[]);% Y positions of subdomain centres 68 CentreZ=reshape(CentreZ,1,[]);% Y positions of subdomain centres 62 69 63 70 %% smoothing parameter: CHANGED 03 May 2024 TO GET RESULTS INDEPENDENT OF SUBDOMAINSIZE -
trunk/src/get_field.m
r1157 r1162 1032 1032 % --- Executes on selection change in TimeName. 1033 1033 function TimeName_Callback(hObject, eventdata, handles) 1034 1034 1035 Field=get(handles.get_field,'UserData'); 1035 index=get(handles.SwitchVarIndexTime,'Value'); 1036 TimeMenu=get(handles.SwitchVarIndexTime,'String'); 1037 TimeOption=TimeMenu{get(handles.SwitchVarIndexTime,'Value')}; 1036 1038 MenuIndex=get(handles.TimeName,'Value'); 1037 1039 string=get(handles.TimeName,'String'); … … 1040 1042 TimeName=string{MenuIndex}; 1041 1043 end 1042 switch index1043 case 11044 switch TimeOption 1045 case 'file index' 1044 1046 set(handles.num_TimeDimension,'String','') 1045 1047 set(handles.TimeUnit,'String','index') 1046 case 21048 case 'attribute' 1047 1049 set(handles.num_TimeDimension,'String','') 1048 1050 attr_index=find(strcmpi([TimeName 'Unit'],Field.ListGlobalAttribute));% look for time unit … … 1053 1055 set(handles.TimeUnit,'String','') 1054 1056 end 1055 case {3 ,4} 1056 if index==3 % TimeName is used to chose a variable 1057 case 'variable' % TimeName is used to chose a variable 1057 1058 VarIndex=name2index(TimeName,Field.ListVarName); 1058 1059 DimName=Field.VarDimName{VarIndex}; … … 1066 1067 set(handles.TimeUnit,'String',unit) 1067 1068 update_field(handles,TimeName) 1068 elseif index==4% TimeName is used to chose a dimension1069 case 'matrix index' % TimeName is used to chose a dimension 1069 1070 DimName=string{MenuIndex}; 1070 1071 DimIndex=name2index(DimName,Field.ListDimName); … … 1072 1073 set(handles.num_TimeDimension,'String',num2str(DimValue)) 1073 1074 set(handles.TimeUnit,'String','index') 1074 end1075 1075 end 1076 1076 -
trunk/src/get_file_info.m
r1161 r1162 55 55 56 56 function [FileInfo,VideoObject]=get_file_info(fileinput) 57 57 58 VideoObject=[]; 58 59 FileInfo.FileType='';% input file does not exist … … 65 66 FileInfo.FileName=fileinput; 66 67 FileInfo.FileType='txt'; %default 67 68 68 else 69 return %input file does not exist. 69 70 end 70 71 [tild,tild,FileExt]=fileparts(fileinput);%get the file extension FileExt … … 81 82 case '.im7' 82 83 try 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 84 Input=readimx(fileinput); 85 Image=Input.Frames{1}.Components{1}.Planes{1}; 86 FileInfo.FileType='image_DaVis'; 87 FileInfo.NumberOfFrames=numel(Input.Frames); 88 FileInfo.Height=size(Image,2); 89 FileInfo.Width=size(Image,1); 90 FileInfo.TimeName='timestamp'; 91 for ilist=1:numel(Input.Attributes) 92 % if strcmp(Input.Attributes{ilist}.Name,'_Date') 93 % DateString=Input.Attributes{ilist}.Value; 94 % end 95 % if strcmp(Input.Attributes{ilist}.Name,'_Time') 96 % TimeString=Input.Attributes{ilist}.Value; 97 % end 98 end 98 99 catch ME 99 100 msgbox_uvmat('ERROR',{ME.message;'reading image from DaVis is possible only with Matlab version 2013 or earlier'}) … … 124 125 FileInfo.Height=BitmapInfoHeader.biHeight; 125 126 FileInfo.Width=BitmapInfoHeader.biWidth; 126 127 127 FileInfo.BitDepth=BitmapInfoHeader.biBitCount; 128 FileInfo.TimeName='video'; 128 129 otherwise 129 130 if ~isempty(FileExt)% exclude empty extension … … 134 135 try 135 136 imainfo=imfinfo(fileinput); 136 if length(imainfo) >1 %case of image with multiple frames 137 if length(imainfo) >1 %case of image with multiple frames 137 138 FileInfo=imainfo(1);%take info from the first frame 138 139 FileInfo.NumberOfFrames=length(imainfo); … … 149 150 else 150 151 error_nc=0; 151 try 152 [Data,tild,tild,errormsg]=nc2struct(fileinput,[]); 153 if ~isempty(errormsg) 154 error_nc=1; 155 else 152 try %try netcdf file 153 [Data,tild,tild,errormsg]=nc2struct(fileinput,[]); 154 if isempty(errormsg) 156 155 if isfield(Data,'absolut_time_T0') && isfield(Data,'hart') && ~isempty(Data.absolut_time_T0) && ~isempty(Data.hart) 157 FileInfo.FileType='civx'; 156 FileInfo.FileType='civx';%old civ data from the Fortran program 158 157 if isfield(Data,'patch2') && isequal(Data.patch2,1) 159 158 FileInfo.CivStage=6; … … 175 174 FileInfo.FileType='civdata_3D'; % test for 3D volume civ velocity fields 176 175 FileInfo.CivStage=Data.CivStage; 176 z_dim_index=find(strcmp(Data.ListDimName,'npz')); 177 FileInfo.NumberOfFrames=Data.DimValue(z_dim_index); 177 178 else 178 179 FileInfo.FileType='netcdf'; 179 180 FileInfo.ListVarName=Data.ListVarName; 180 FileInfo.VarAttribute=Data.VarAttribute; 181 FileInfo.VarAttribute={}; 182 if isfield(Data,'VarAttribute') 183 FileInfo.VarAttribute=Data.VarAttribute; 184 end 185 FileInfo.ListDimName=Data.ListDimName; 186 FileInfo.NumberOfFrames=Data.DimValue; 181 187 end 188 else 189 error_nc=1; 182 190 end 183 191 catch ME … … 186 194 if error_nc 187 195 try 188 if exist(' VideoReader.m','file')%recent version of Matlab189 VideoObject=VideoReader(fileinput);190 FileInfo=get(VideoObject);191 FileInfo.FileType='video';192 elseif exist('mmreader.m','file')% Matlab 2009a193 VideoObject=mmreader(fileinput);194 FileInfo=get(VideoObject);195 FileInfo.FileType='mmreader';196 if exist('mmreader.m','file')% Matlab 2009a 197 INFO=mmfileinfo (fileinput); 198 if ~isempty(INFO.Video.Format) 199 200 VideoObject=mmreader(fileinput); 201 FileInfo=get(VideoObject); 202 FileInfo.FileType='mmreader'; 203 end 196 204 end 197 205 FileInfo.BitDepth=FileInfo.BitsPerPixel/3; … … 212 220 213 221 if ismember (FileInfo.FileType,{'mat','image','image_DaVis','multimage','mmreader','cine_phantom','video','netcdf','civdata'}) 214 222 FileInfo.FileIndexing='on'; % allow to detect file index for scanning series 215 223 else 216 224 FileInfo.FileIndexing='off'; … … 219 227 switch FileInfo.FileType 220 228 case {'image','multimage','video','mmreader','rdvision','image_DaVis','cine_phantom'} 221 FileInfo.FieldType='image';229 FileInfo.FieldType='image'; 222 230 case {'civx','civdata','pivdata_fluidimage'} 223 231 FileInfo.FieldType='civdata'; -
trunk/src/nc2struct.m
r1157 r1162 108 108 catch ME 109 109 end 110 eval(['Data.' varargin{ilist} '=valuestr;'])110 Data.(varargin{ilist})=valuestr; 111 111 end 112 112 netcdf.close(nc) -
trunk/src/read_civdata.m
r1161 r1162 59 59 %======================================================================= 60 60 61 function [Field,VelTypeOut,errormsg]=read_civdata(FileName,FieldNames,VelType )61 function [Field,VelTypeOut,errormsg]=read_civdata(FileName,FieldNames,VelType,frame_index) 62 62 63 63 %% default input 64 if ~exist('frame_index','var') 65 frame_index=1; 66 end 64 67 if ~exist('VelType','var') 65 68 VelType=''; … … 74 77 VelTypeOut=VelType; 75 78 errormsg=''; 76 if ischar(FieldNames), FieldNames={FieldNames}; end ;79 if ischar(FieldNames), FieldNames={FieldNames}; end 77 80 ProjModeRequest=''; 78 81 for ilist=1:length(FieldNames) … … 90 93 91 94 %% reading data 92 [Data,tild,tild,errormsg]=nc2struct(FileName,'ListGlobalAttribute','C ivStage');95 [Data,tild,tild,errormsg]=nc2struct(FileName,'ListGlobalAttribute','Conventions','CivStage'); 93 96 if ~isempty(errormsg) 94 97 errormsg=['read_civdata: ' errormsg]; … … 101 104 return 102 105 else 106 if strcmp(Data.Conventions,'uvmat/civdata_3D') 107 [Field,vardetect]=nc2struct(FileName,'TimeDimName','npz',frame_index,varlist);%read the variables in the netcdf file 108 else 103 109 [Field,vardetect]=nc2struct(FileName,varlist);%read the variables in the netcdf file 110 end 104 111 end 105 112 if isfield(Field,'Txt') -
trunk/src/read_field.m
r1137 r1162 1 1 %'read_field': read the fields from files in different formats (netcdf files, images, video) 2 2 %-------------------------------------------------------------------------- 3 % function [Field,ParamOut,errormsg] = read_field(FileName,FileType,ParamIn, num)3 % function [Field,ParamOut,errormsg] = read_field(FileName,FileType,ParamIn,frame_index) 4 4 % 5 5 % OUTPUT: … … 20 20 % .ColorVar: variable used for vector color 21 21 % .Npx, .Npy: nbre of pixels along x and y (used for .vol input files) 22 % .TimeDimName: name of the dimension considered as 'time', selected index value then set by input ' num'23 % num: frame number for movies22 % .TimeDimName: name of the dimension considered as 'time', selected index value then set by input 'frame_index' 23 % frame_index: frame number for movies or multidimensional netcdf files with dim >2 24 24 % 25 25 % see also read_image.m,read_civxdata.m,read_civdata.m, … … 43 43 %======================================================================= 44 44 45 function [Field,ParamOut,errormsg] = read_field(FileName,FileType,ParamIn, num)45 function [Field,ParamOut,errormsg] = read_field(FileName,FileType,ParamIn,frame_index) 46 46 %% default output and check input 47 47 Field=[]; 48 if ~exist(' num','var')49 num=1;50 end 51 if isempty( num)52 num=1;48 if ~exist('frame_index','var') 49 frame_index=1; 50 end 51 if isempty(frame_index) 52 frame_index=1; 53 53 end 54 54 if ~exist('ParamIn','var') … … 57 57 ParamOut=ParamIn;%default 58 58 errormsg=''; 59 if isempty(regexp(FileName,'^http://' ))&& ~exist(FileName,'file')59 if isempty(regexp(FileName,'^http://', 'once'))&& ~exist(FileName,'file') 60 60 errormsg=['input file ' FileName ' does not exist']; 61 61 return … … 81 81 %% distingush different input file types 82 82 switch FileType 83 case 'civdata'% new format for civ results84 [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType );83 case {'civdata','civdata_3D'}% new format for civ results 84 [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType,frame_index); 85 85 if ~isempty(errormsg),errormsg=['read_civdata / ' errormsg];return,end 86 86 ParamOut.CivStage=Field.CivStage; … … 102 102 % scan the list InputField 103 103 Operator=cell(1,numel(InputField)); 104 InputVar=cell(1,numel(InputField));104 %InputVar=cell(1,numel(InputField)); 105 105 for ilist=1:numel(InputField) 106 106 % look for input variables to read … … 145 145 NbCoord=~isempty(ParamIn.Coord_x)+~isempty(ParamIn.Coord_y)+~isempty(ParamIn.Coord_z); 146 146 if isfield(ParamIn,'TimeDimName')% case of reading of a single time index in a multidimensional array 147 [Field,var_detect,ichoice,errormsg]=nc2struct(FileName,'TimeDimName',ParamIn.TimeDimName, num,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVarName]);147 [Field,var_detect,ichoice,errormsg]=nc2struct(FileName,'TimeDimName',ParamIn.TimeDimName,frame_index,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVarName]); 148 148 elseif isfield(ParamIn,'TimeVarName')% case of reading of a single time in a multidimensional array 149 [Field,var_detect,ichoice,errormsg]=nc2struct(FileName,'TimeVarName',ParamIn.TimeVarName, num,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVarName]);150 if numel( num)~=1149 [Field,var_detect,ichoice,errormsg]=nc2struct(FileName,'TimeVarName',ParamIn.TimeVarName,frame_index,[ParamIn.Coord_x ParamIn.Coord_y ParamIn.Coord_z ListVarName]); 150 if numel(frame_index)~=1 151 151 NbCoord=NbCoord+1;% adds time coordinate, except if a single time has been selected 152 152 end … … 157 157 return 158 158 end 159 CheckStructured=1;159 % CheckStructured=1; 160 160 %scan all the variables 161 161 NbCoord=0; 162 162 if ~isempty(ParamIn.Coord_x) 163 index_Coord_x= find(strcmp(ParamIn.Coord_x,Field.ListVarName));163 index_Coord_x=strcmp(ParamIn.Coord_x,Field.ListVarName); 164 164 Field.VarAttribute{index_Coord_x}.Role='coord_x';% 165 165 NbCoord=NbCoord+1; … … 167 167 if ~isempty(ParamIn.Coord_y) 168 168 if ischar(ParamIn.Coord_y) 169 index_Coord_y= find(strcmp(ParamIn.Coord_y,Field.ListVarName));169 index_Coord_y=strcmp(ParamIn.Coord_y,Field.ListVarName); 170 170 Field.VarAttribute{index_Coord_y}.Role='coord_y';% 171 171 NbCoord=NbCoord+1; 172 172 else 173 173 for icoord_y=1:numel(ParamIn.Coord_y) 174 index_Coord_y= find(strcmp(ParamIn.Coord_y{icoord_y},Field.ListVarName));174 index_Coord_y=strcmp(ParamIn.Coord_y{icoord_y},Field.ListVarName); 175 175 Field.VarAttribute{index_Coord_y}.Role='coord_y';% 176 176 NbCoord=NbCoord+1; … … 180 180 NbDim=1; 181 181 if ~isempty(ParamIn.Coord_z) 182 index_Coord_z= find(strcmp(ParamIn.Coord_z,Field.ListVarName));182 index_Coord_z=strcmp(ParamIn.Coord_z,Field.ListVarName); 183 183 Field.VarAttribute{index_Coord_z}.Role='coord_z';% 184 184 NbCoord=NbCoord+1; … … 187 187 NbDim=2; 188 188 end 189 NormName='';190 UName='';191 VName='';192 189 if numel(Field.ListVarName)>NbCoord % if there are variables beyond coord (exclude 1 D plots) 193 190 VarAttribute=cell(1,numel(ListVarName)); … … 236 233 end 237 234 case 'video' 238 if strcmp(class(ParamIn),'VideoReader')239 A=read(ParamIn, num);235 if isa(ParamIn,'VideoReader') 236 A=read(ParamIn,frame_index); 240 237 else 241 238 ParamOut=VideoReader(FileName); 242 A=read(ParamOut, num);239 A=read(ParamOut,frame_index); 243 240 end 244 241 case 'mmreader' 245 if strcmp(class(ParamIn),'mmreader')246 A=read(ParamIn, num);242 if isa(ParamIn,'mmreader') 243 A=read(ParamIn,frame_index); 247 244 else 248 245 ParamOut=mmreader(FileName); 249 A=read(ParamOut, num);246 A=read(ParamOut,frame_index); 250 247 end 251 248 case 'vol' … … 255 252 A=permute(A,[3 2 1]); 256 253 case 'multimage' 257 % warning 'off' 258 A=imread(FileName,num); 254 A=imread(FileName,frame_index); 259 255 case 'image' 260 256 A=imread(FileName); 261 257 case 'rdvision' 262 [A,FileInfo,timestamps,errormsg]=read_rdvision(FileName, num);258 [A,FileInfo,timestamps,errormsg]=read_rdvision(FileName,frame_index); 263 259 case 'image_DaVis' 264 260 Input=readimx(FileName); 265 261 if numel(Input.Frames)==1 266 num=1;267 end 268 A=Input.Frames{ num}.Components{1}.Planes{1}';262 frame_index=1; 263 end 264 A=Input.Frames{frame_index}.Components{1}.Planes{1}'; 269 265 for ilist=1:numel(Input.Frames{1}.Attributes) 270 266 if strcmp(Input.Frames{1}.Attributes{ilist}.Name,'AcqTimeSeries') … … 274 270 end 275 271 case 'cine_phantom' 276 [A,FileInfo] = read_cine_phantom(FileName, num);272 [A,FileInfo] = read_cine_phantom(FileName,frame_index ); 277 273 otherwise 278 274 errormsg=[ FileType ': invalid input file type for uvmat']; … … 299 295 Field.VarAttribute{3}.Role='scalar'; 300 296 if ndims(A)==3 301 if Npz==1 ;%color297 if Npz==1%color 302 298 Field.VarDimName={'Coord_y','Coord_x',{'Coord_y','Coord_x','rgb'}}; % 303 299 Field.Coord_y=[npxy(1)-0.5 0.5]; -
trunk/src/script_delete_rdvision.m
r1161 r1162 45 45 ind_rdvision=[]; 46 46 for isubsub=1:numel(ListNamesSubSub) 47 if ~isempty(regexp(ListNamesSubSub{isubsub},'^2024-' ))47 if ~isempty(regexp(ListNamesSubSub{isubsub},'^2024-', 'once')) 48 48 ind_rdvision=[ind_rdvision isubsub];%detect rdvision folders 49 49 end … … 53 53 if numel(ind_rdvision)==1% 54 54 DataFolder=fullfile(RootFolder,ListNames{ilist},ListNamesSub{isub},ListNamesSubSub{ind_rdvision}); 55 if isempty(regexp(DataFolder,'.extract$' ))% if the detected folder is not .extract55 if isempty(regexp(DataFolder,'.extract$', 'once'))% if the detected folder is not .extract 56 56 % ExtractFolder=fullfile(Param.InputTable{1},[Param.InputTable{2} '.extract']); 57 57 % mkdir(ExtractFolder) … … 76 76 if numel(ind_rdvision)==2 77 77 for irdvision=1:2 78 CheckExtract(irdvision)=isempty(regexp(fullfile(RootFolder,ListNames{ilist},ListNamesSub{isub},ListNamesSubSub{irdvision}), '.extract$' ));78 CheckExtract(irdvision)=isempty(regexp(fullfile(RootFolder,ListNames{ilist},ListNamesSub{isub},ListNamesSubSub{irdvision}), '.extract$', 'once')); 79 79 end 80 80 status='extract missing'; 81 81 if numel(find(CheckExtract))==1 82 ExtractFolder=fullfile(RootFolder,ListNames{ilist},ListNamesSub{isub},ListNamesSubSub{ find(CheckExtract)});82 ExtractFolder=fullfile(RootFolder,ListNames{ilist},ListNamesSub{isub},ListNamesSubSub{CheckExtract}); 83 83 PngFolder=fullfile(RootFolder,ListNames{ilist},ListNamesSub{isub},'im'); 84 84 status='image folder not created'; -
trunk/src/series/civ_series.m
r1161 r1162 993 993 shifty=shifty*ones(nbvec,1); 994 994 end 995 %TODO: shift the origin by -shift/2 995 996 996 997 %% Array initialisation and default output if par_civ.CorrSmooth=0 (just the grid calculated, no civ computation) … … 1193 1194 FF=false; % no error by the limited search box 1194 1195 max_conv=result_conv(y,x);% max correlation 1195 peak2noise= max(4,max_conv/std(reshape(result_conv,1,[])));% ratio of max conv to standard deviation of correlations (estiamtion of noise level), set to value 4 if it is too low 1196 %peak2noise= max(4,max_conv/std(reshape(result_conv,1,[])));% ratio of max conv to standard deviation of correlations (estiamtion of noise level), set to value 4 if it is too low 1197 peak2noise=100;% TODO: make this threshold more precise, depending on the image noise 1196 1198 result_conv=result_conv*peak2noise/max_conv;% renormalise the correlation with respect to the noise 1197 1199 result_conv(result_conv<1)=1; %set to 1 correlation values smaller than 1 (=0 by discretisation, to avoid divergence in the log) -
trunk/src/set_field_list.m
r1127 r1162 34 34 %======================================================================= 35 35 36 function [FieldList,VecColorList]=set_field_list(UName,VName,CName) 37 36 function [FieldList,VecColorList]=set_field_list(UName,VName,CName,WName) 37 if exist('WName','var')% 3D civ case 38 FieldList={['vec(' UName ',' VName ')'];... 39 ['norm(' UName ',' VName ')'];... 40 UName;... 41 VName;... 42 WName}; 43 VecColorList={['norm(' UName ',' VName ')'];... 44 WName;... 45 VName}; 46 else 38 47 FieldList={['vec(' UName ',' VName ')'];... 39 48 ['norm(' UName ',' VName ')'];... … … 50 59 UName;... 51 60 VName};... 61 end 52 62 if exist('CName','var') && ~isempty(CName) 53 63 VecColorList=[{CName};VecColorList]; -
trunk/src/uvmat.m
r1161 r1162 2018 2018 function MenuRun1_Callback(hObject, eventdata, handles) 2019 2019 %------------------------------------------------------------------------ 2020 MenuRun(hObject,handles); 2021 2022 2023 % -------------------------------------------------------------------- 2024 function MenuRun2_Callback(hObject, eventdata, handles) 2025 MenuRun(hObject,handles); 2026 % Param=read_GUI(handles.uvmat); 2027 % Param.HiddenData=get(handles.uvmat,'UserData'); 2028 % hseries=series(Param); 2029 % hhseries=guidata(hseries); 2030 % ActionMenu=get(hhseries.ActionName,'String'); 2031 % index_action=find(strcmp('civ_series',ActionMenu)); 2032 % set(hhseries.ActionName,'Value',index_action); 2033 % series('ActionName_Callback',hObject,eventdata,hhseries); %file input with xml reading in uvmat, show the image in phys coordinates 2034 2035 % -------------------------------------------------------------------- 2036 function MenuRun3_Callback(hObject, eventdata, handles) 2037 MenuRun(hObject,handles); 2038 % Param=read_GUI(handles.uvmat); 2039 % Param.HiddenData=get(handles.uvmat,'UserData'); 2040 % hseries=series(Param); 2041 % hhseries=guidata(hseries); 2042 % ActionMenu=get(hhseries.ActionName,'String'); 2043 % index_action=find(strcmp('test_filter_tps',ActionMenu)); 2044 % set(hhseries.ActionName,'Value',index_action); 2045 % series('ActionName_Callback',hObject,eventdata,hhseries); %file input with xml reading in uvmat, show the image in phys coordinates 2046 2047 function MenuRun(hObject,handles) 2020 2048 Param=read_GUI(handles.uvmat); 2021 2049 Param.HiddenData=get(handles.uvmat,'UserData'); 2022 series(Param); %run the series interface 2023 2024 % -------------------------------------------------------------------- 2025 function MenuRun2_Callback(hObject, eventdata, handles) 2026 Param=read_GUI(handles.uvmat); 2027 Param.HiddenData=get(handles.uvmat,'UserData'); 2028 hseries=series(Param); 2029 hhseries=guidata(hseries); 2030 ActionMenu=get(hhseries.ActionName,'String'); 2031 index_action=find(strcmp('civ_series',ActionMenu)); 2050 hseries=series(Param); %run the series interface 2051 ActionName=get(hObject,'Label'); 2052 if ~strcmp(ActionName,'series') 2053 hhseries=guidata(hseries); 2054 ActionMenu=get(hhseries.ActionName,'String'); 2055 index_action=find(strcmp(ActionName,ActionMenu)); 2056 if isempty(index_action) %add to the menu 2057 NbBuiltinAction=get(hhseries.Action,'UserData'); 2058 ActionMenu(NbBuiltinAction+1)=[]; 2059 ActionMenu=[ActionMenu(1:end-1); {ActionName} ;{'more...'}];%insert the required action at the penultimate rank in the menu 2060 index_action=numel(ActionMenu)-1; 2061 set(hhseries.ActionName,'String',ActionMenu); 2062 end 2032 2063 set(hhseries.ActionName,'Value',index_action); 2033 series('ActionName_Callback',hObject,eventdata,hhseries); %file input with xml reading in uvmat, show the image in phys coordinates 2064 series('ActionName_Callback',hObject,[],hhseries); %file input with xml reading in uvmat, show the image in phys coordinates 2065 end 2034 2066 2035 2067 % %------------------------------------------------------------------------ … … 2240 2272 editxml(fileinput); 2241 2273 return 2242 % case 'mat'% matlab data file2243 % % global Data_uvmat2244 % Data_uvmat.Field=load(fileinput);2245 % evalin('base','global Data_uvmat')%make CurData global in the workspace2246 % disp('Data_uvmat.Field=')2247 % evalin('base','Data_uvmat.Field') %display CurData in the workspace2248 % commandwindow; %brings the Matlab command window to the front2249 % return2250 2274 otherwise 2251 2275 set(handles_RootPath,'String',RootPath); 2252 2276 set(handles_SubDir,'String',['/' SubDir]); 2253 2277 set(handles_RootFile,'String',['/' RootFile]); %display the separator 2254 if isempty(regexp(RootPath,'^http://' ))2278 if isempty(regexp(RootPath,'^http://', 'once')) 2255 2279 rootname=fullfile(RootPath,SubDir,RootFile); 2256 2280 else … … 2464 2488 if isfield(XmlDataRead, 'Slice') && ~isempty(XmlDataRead.Slice) 2465 2489 XmlData.Slice=XmlDataRead.Slice; 2466 % check whether the GUI geometry_calib is opened2467 % hgeometry_calib=findobj('tag','geometry_calib');2468 % if ~isempty(hgeometry_calib) % check whether the display of the GUI geometry_calib is consistent with the current calib param2469 % GUserData=get(hgeometry_calib,'UserData');2470 % if ~(isfield(GUserData,'XmlInputFile') && strcmp(GUserData.XmlInputFile,XmlFileName))2471 % answer=msgbox_uvmat('INPUT_Y-N','refresh the display of the GUI geometry_calib with the new input data?');2472 % if strcmp(answer,'Yes')2473 % geometry_calib(XmlFileName);%diplay the new calibration points and parameters in geometry_calib2474 % end2475 % end2476 % end2477 2490 end 2478 2491 if isfield(XmlData.Slice,'CheckVolumeScan') && isequal(XmlData.Slice.CheckVolumeScan,1) … … 2498 2511 elseif strcmp(FileInfo.FieldType,'civdata')% ajouter pivdata_fluidimage 2499 2512 TimeName='civdata'; 2513 elseif strcmp(FileInfo.FieldType,'civdata_3D')% ajouter pivdata_fluidimage 2514 TimeName='civdata_3D'; 2500 2515 end 2501 2516 if index==1 … … 2593 2608 switch FileInfo.FieldType 2594 2609 case 'civdata' 2595 [FieldList, ColorList]=set_field_list('U','V','C');2610 [FieldList,VecColorList]=set_field_list('U','V','C'); 2596 2611 set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 2597 2612 set(handles_Fields,'Value',2) % set menu to 'velocity … … 2601 2616 end 2602 2617 set(handles.ColorScalar,'Value',1) 2603 set(handles.ColorScalar,'String', ColorList)2618 set(handles.ColorScalar,'String',VecColorList) 2604 2619 set(handles.Vectors,'Visible','on') 2605 2620 set(handles.Coord_x,'String','X'); 2606 2621 set(handles.Coord_y,'String','Y'); 2607 set(handles.MenuRun3,'Label','test_filter_tps') 2622 set(handles.MenuRun2,'Label','test_filter_tps') 2623 set(handles.MenuRun3,'Label','civ_series') 2624 case 'civdata_3D' 2625 [FieldList,VecColorList]=set_field_list('U','V','C','W'); 2626 set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 2627 set(handles_Fields,'Value',2) % set menu to 'velocity 2628 if index==1 2629 set(handles.FieldName_1,'Value',1); 2630 set(handles.FieldName_1,'String',[{''};{'image'};FieldList;{'get_field...'}]);%standard menu for civx data reproduced for the second field 2631 end 2632 set(handles.ColorScalar,'Value',1) 2633 set(handles.ColorScalar,'String',VecColorList) 2634 set(handles.Vectors,'Visible','on') 2635 set(handles.Coord_x,'String','X'); 2636 set(handles.Coord_y,'String','Y'); 2637 set(handles.MenuRun2,'Label','') 2638 set(handles.MenuRun3,'Label','') 2608 2639 case {'netcdf','mat'} 2609 2640 set(handles_Fields,'Value',1) … … 2620 2651 set(handles.Coord_x,'String','Coord_x'); 2621 2652 set(handles.Coord_y,'String','Coord_y'); 2653 set(handles.MenuRun2,'Label','civ_series') 2654 set(handles.MenuRun3,'Label','sub_background') 2622 2655 end 2623 2656 … … 2635 2668 end 2636 2669 if ~isempty(i1_series) 2637 [ref_j,ref_i]=find(squeeze(i1_series(1,:,:)));2638 if ~isempty(j1_series)2670 [ref_j,ref_i]=find(squeeze(i1_series(1,:,:))); 2671 if ~isempty(j1_series) 2639 2672 state_j='on'; 2640 2673 if index==1 … … 2643 2676 end 2644 2677 end 2645 end2646 if isequal(scan_option,'i')2647 diff_ref_i=diff(ref_i,1);2648 if isempty(diff_ref_i)2649 diff_ref_i=1;2650 end2651 if isequal (diff_ref_i,diff_ref_i(1)*ones(size(diff_ref_i)))2652 set(handles.num_IndexIncrement,'String',num2str(diff_ref_i(1)))2653 end2654 set(handles.scan_i,'Value',1)2655 scan_i_Callback([],[], handles);2656 else2657 diff_ref_j=diff(ref_j);2658 if isempty(diff_ref_j)2659 diff_ref_j=1;2660 end2661 if isequal (diff_ref_j,diff_ref_j(1)*ones(size(diff_ref_j)))2662 set(handles.num_IndexIncrement,'String',num2str(diff_ref_j(1)))2663 end2664 set(handles.scan_j,'Value',1)2665 scan_j_Callback([],[], handles);2666 end2678 end 2679 if isequal(scan_option,'i') 2680 diff_ref_i=diff(ref_i,1); 2681 if isempty(diff_ref_i) 2682 diff_ref_i=1; 2683 end 2684 if isequal (diff_ref_i,diff_ref_i(1)*ones(size(diff_ref_i))) 2685 set(handles.num_IndexIncrement,'String',num2str(diff_ref_i(1))) 2686 end 2687 set(handles.scan_i,'Value',1) 2688 scan_i_Callback([],[], handles); 2689 else 2690 diff_ref_j=diff(ref_j); 2691 if isempty(diff_ref_j) 2692 diff_ref_j=1; 2693 end 2694 if isequal (diff_ref_j,diff_ref_j(1)*ones(size(diff_ref_j))) 2695 set(handles.num_IndexIncrement,'String',num2str(diff_ref_j(1))) 2696 end 2697 set(handles.scan_j,'Value',1) 2698 scan_j_Callback([],[], handles); 2699 end 2667 2700 end 2668 2701 set(handles.scan_j,'Visible',state_j) … … 3140 3173 NomType=InputFile.NomType; 3141 3174 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(InputFile.FileIndex);% check back the indices used 3142 if isempty(i1) 3143 i1=str2 num(get(handles.i1,'String'));%read the field indices (for movie, it is not given by the file name)3175 if isempty(i1)% no i index set by the input file name 3176 i1=str2double(get(handles.i1,'String'));%read the field indices (for movie, it is not given by the file name) 3144 3177 elseif isempty(j1) && strcmp(get(handles.j1,'Visible'),'on') 3145 j1=str2 num(get(handles.j1,'String'));%case of indexed movie3178 j1=str2double(get(handles.j1,'String'));%case of indexed movie 3146 3179 end 3147 3180 % if movie_status% we read the second index from the edit box … … 3171 3204 3172 3205 % the pair i1-i2 or j1-j2 is imposed (check box CheckFixPair selected) 3173 if CheckFixPair &&isnumeric(increment)3174 if get(handles.scan_i,'Value')==1 % case of scanning along index i3206 if isnumeric(increment) 3207 if get(handles.scan_i,'Value')==1 % case of scanning along index i 3175 3208 i1=i1+increment; 3176 3209 i2=i2+increment; … … 3553 3586 end 3554 3587 switch UvData.FileInfo{1}.FieldType 3555 case {'civdata',' netcdf','mat'}3588 case {'civdata','civdata_3D','netcdf','mat'} 3556 3589 list_fields=get(handles.FieldName,'String');% list menu fields 3557 3590 FieldName= list_fields{get(handles.FieldName,'Value')}; % selected field … … 3573 3606 index_code=get(handles.ColorScalar,'Value');% selected string index 3574 3607 ParamIn.ColorVar= list_code{index_code}; % selected field 3608 end 3609 end 3610 if strcmp(UvData.FileInfo{1}.FieldType,'civdata_3D') 3611 if num_j1>UvData.FileInfo{1}.NumberOfFrames 3612 errormsg='specified frame index exceeds file content'; 3613 return 3614 else 3615 frame_index=num_j1;% frame index from a set of indexed movies 3575 3616 end 3576 3617 end … … 3663 3704 end 3664 3705 switch UvData.FileInfo{2}.FileType 3665 case {'civx','civdata',' netcdf','pivdata_fluidimage','mat'}3706 case {'civx','civdata','civdata_3D','netcdf','pivdata_fluidimage','mat'} 3666 3707 list_fields=get(handles.FieldName_1,'String');% list menu fields 3667 3708 FieldName_1= list_fields{get(handles.FieldName_1,'Value')}; % selected field … … 3728 3769 %% update the display menu for the first velocity type (first menuline) 3729 3770 test_veltype=0; 3730 if isfield(UvData.FileInfo{1},'FieldType') && strcmp(UvData.FileInfo{1}.FieldType,'civdata')&& ~strcmp(FieldName,'get_field...')3771 if isfield(UvData.FileInfo{1},'FieldType') && ismember(UvData.FileInfo{1}.FieldType,{'civdata','civdata_3D'})&& ~strcmp(FieldName,'get_field...') 3731 3772 test_veltype=1; 3732 3773 set(handles.VelType,'Visible','on') … … 4635 4676 %read selection from get_field 4636 4677 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 4637 if isempty(regexp(RootPath,'^http://' ))4678 if isempty(regexp(RootPath,'^http://', 'once')) 4638 4679 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 4639 4680 else … … 4641 4682 end 4642 4683 GetFieldData=get_field(FileName,ParamIn);% inport field names from the GUI get_field 4684 4643 4685 FieldList={}; 4644 4686 VecColorList={''}; … … 4698 4740 case 'variable' 4699 4741 set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName]) 4700 set(handles.NomType,'String','*')4742 % set(handles.NomType,'String','*') 4701 4743 set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')]) 4702 4744 set(handles.i1,'String','1')% set counter to 1 (now the time index in the input matrix) … … 4972 5014 imax=6; 4973 5015 end 4974 case {'civdata',' pivdata_fluidimage'}5016 case {'civdata','civdata_3D','pivdata_fluidimage'} 4975 5017 menu={'civ1';'filter1';'civ2';'filter2'}; 4976 5018 imax=[0 1 1 2 3 3 4 5 5 6]; … … 5255 5297 ichoice=find(strcmp(transform_name,menu),1);%look for the selected fct in the existing menu 5256 5298 if isempty(ichoice)% if the item is not found, add it to the menu (before 'more...' and select it) 5257 menu=[menu(1:end-1);{transform_name};{'more...'}]; 5299 if numel(menu)>12 5300 menu(4:numel(menu)-9)=[];%remove the old items, preserving the three first ones 5301 end 5302 menu=[menu(1:end-1);{transform_name};{'more...'}];% insert the new fct in the menu 5258 5303 ichoice=numel(menu)-1; 5259 5304 end … … 6121 6166 6122 6167 6123 % --------------------------------------------------------------------6124 function MenuRun3_Callback(hObject, eventdata, handles)6125 Param=read_GUI(handles.uvmat);6126 Param.HiddenData=get(handles.uvmat,'UserData');6127 hseries=series(Param);6128 hhseries=guidata(hseries);6129 ActionMenu=get(hhseries.ActionName,'String');6130 index_action=find(strcmp('test_filter_tps',ActionMenu));6131 set(hhseries.ActionName,'Value',index_action);6132 series('ActionName_Callback',hObject,eventdata,hhseries); %file input with xml reading in uvmat, show the image in phys coordinates
Note: See TracChangeset
for help on using the changeset viewer.