- Timestamp:
- Mar 15, 2010, 5:37:11 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/aver_stat.m
r41 r43 92 92 nbview=2; 93 93 end 94 95 %determine image type 94 96 hhh=which('mmreader'); 95 97 for iview=1:nbview 96 test_movie(iview)=0; 97 if ~isequal(hhh,'')&& mmreader.isPlatformSupported() 98 if isequal(lower(FileExt{iview}),'.avi') 98 if isequal(FileExt{iview},'.nc')||isequal(FileExt{iview},'.cdf') 99 FileType{iview}='netcdf'; 100 elseif isequal(lower(FileExt{iview}),'.avi') 101 if ~isequal(hhh,'')&& mmreader.isPlatformSupported() 99 102 MovieObject{iview}=mmreader(fullfile(RootPath{iview},[RootFile{iview} FileExt{iview}])); 100 test_movie(iview)=1; 101 end 102 end 103 FileType{iview}='movie'; 104 else 105 FileType{iview}='avi'; 106 end 107 elseif isequal(lower(FileExt{iview}),'.vol') 108 FileType{iview}='vol'; 109 else 110 form=imformats(FileExt{iview}(2:end)); 111 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 112 if isequal(NomType{iview},'*'); 113 FileType{iview}='multimage'; 114 else 115 FileType{iview}='image'; 116 end 117 end 118 end 103 119 end 104 120 … … 132 148 end 133 149 %detect whether the two files are 'images' or 'netcdf' 134 testima=0;135 testvol=0;150 % testima=0; 151 % testvol=0; 136 152 testcivx=0; 137 testnc=0;153 % testnc=0; 138 154 FileExt=get(hseries.FileExt,'String'); 139 155 % test_movie=0; 140 for iview=1:nbview141 ext=FileExt{iview};142 form=imformats(ext([2:end]));143 if isequal(lower(ext),'.vol')144 testvol=testvol+1;145 elseif ~isempty(form)||isequal(lower(ext),'.avi')% if the extension corresponds to an image format recognized by Matlab146 testima=testima+1;147 elseif isequal(ext,'.nc')148 testnc=testnc+1;149 end150 end151 if testvol152 msgbox_uvmat('ERROR','volume images not implemented yet')153 return154 end155 if testnc~=nbview && testima~=nbview && testvol~=nbview156 msgbox_uvmat('ERROR','compare two image series or two netcdf files with the same fields as input')157 return158 end156 % for iview=1:nbview 157 % ext=FileExt{iview}; 158 % form=imformats(ext([2:end])); 159 % if isequal(lower(ext),'.vol') 160 % testvol=testvol+1; 161 % elseif ~isempty(form)||isequal(lower(ext),'.avi')% if the extension corresponds to an image format recognized by Matlab 162 % testima=testima+1; 163 % elseif isequal(ext,'.nc') 164 % testnc=testnc+1; 165 % end 166 % end 167 % if testvol 168 % msgbox_uvmat('ERROR','volume images not implemented yet') 169 % return 170 % end 171 % if testnc~=nbview && testima~=nbview && testvol~=nbview 172 % msgbox_uvmat('ERROR','compare two image series or two netcdf files with the same fields as input') 173 % return 174 % end 159 175 if ~isequal(FieldName,{'get_field...'}) 160 if isequal(FieldName,{''}) && ~testima 161 msgbox_uvmat('ERROR','an input field needs to be selected') 162 return 163 end 164 testcivx=testnc; 165 end 176 testcivx=isequal(FileType{1},'netcdf'); 177 end 178 % if ~isequal(FieldName,{'get_field...'}) 179 % if isequal(FieldName,{''}) && ~testima 180 % msgbox_uvmat('ERROR','an input field needs to be selected') 181 % return 182 % end 183 % testcivx=testnc; 184 % end 166 185 167 186 if testcivx … … 288 307 [filename]=... 289 308 name_generator(filebase{iview},num_i1{iview}(ifile),num_j1{iview}(ifile),FileExt{iview},NomType{iview},1,num_i2{iview}(ifile),num_j2{iview}(ifile),SubDir{iview}); 290 if testima309 if ~isequal(FileType{iview},'netcdf') 291 310 Data{iview}.ListVarName={'A'}; 292 311 Data{iview}.AName='image'; 293 if test_movie(iview) 294 Data{iview}.A=read(MovieObject{iview},num_i1{iview}(ifile)); 312 switch FileType{iview} 313 case 'movie' 314 A=read(MovieObject{iview},num_i1{iview}(ifile)); 315 case 'avi' 316 mov=aviread(filename,num_i1{iview}(ifile)); 317 A=frame2im(mov(1)); 318 case 'vol' 319 A=imread(filename); 320 case 'multimage' 321 A=imread(filename,num_i1{iview}(ifile)); 322 case 'image' 323 A=imread(filename); 324 end 325 Data{iview}.ListVarName={'coord_y','coord_x','A'}; % 326 Atype{iview}=class(A); 327 npy=size(A,1); 328 npx=size(A,2); 329 nbcolor=size(A,3); 330 if nbcolor==3 331 Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x','rgb'}}; 295 332 else 296 Data{iview}.A=read_image(filename,NomType{iview},num_i1{iview}(ifile));% read the image, num2 is the counter for avi files 297 end 298 Atype{iview}=class(Data{iview}.A); 299 Data{iview}.A=double(Data{iview}.A); 333 Data{iview}.VarDimName={'coord_y','coord_x',{'coord_y','coord_x'}}; 334 end 335 Data{iview}.coord_y=[npy-0.5 0.5]; 336 Data{iview}.coord_x=[0.5 npx-0.5]; 337 Data{iview}.A=double(A); 338 Data{iview}.CoordType='px'; 300 339 elseif testcivx 301 340 [Data{iview},VelTypeOut]=read_civxdata(filename,FieldName,VelType); … … 356 395 eval(['siz=size(Field.' VarName ');']); 357 396 if ~isequal(siz,sizmean) 358 msgbox_uvmat('WARNING',['unequal size of input field ' VarName ', need to interpolate on a grid']) 359 nbmissing=nbmissing+1; 360 break 397 msgbox_uvmat('ERROR',['unequal size of input field ' VarName ', need to interpolate on a grid']) 398 return 361 399 else 362 400 eval(['DataMean.' VarName '=DataMean.' VarName '+ Field.' VarName ';']); % update the sum
Note: See TracChangeset
for help on using the changeset viewer.