Changeset 342 for trunk/src/set_grid.m
- Timestamp:
- Dec 20, 2011, 5:14:43 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_grid.m
r315 r342 264 264 textout=char(textgrid); 265 265 imageA=get(handles.image_1,'String'); 266 [Pathsub]=name2display(imageA); 267 Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile(Pathsub,'gridA.grid')); 266 RootPath=fileparts_uvmat(imageA); 267 %[Pathsub]=name2display(imageA); 268 Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile(RootPath,'gridA.grid')); 268 269 % Answer = inputdlg('grid file name (*.grid)',' ',1,{fullfile(Pathsub,'gridA.grid')},'on'); 269 270 dlmwrite(Answer,textout,''); … … 281 282 textgrid={tete;txt}; 282 283 textout=char(textgrid); 283 Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile( Pathsub,'gridB.grid'));284 Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile(RootPath,'gridB.grid')); 284 285 dlmwrite(Answer,textout,''); 285 286 msgbox_uvmat('CONFIRMATION',[Answer ' written as ASCII text file']); … … 287 288 288 289 %------------------------- 289 function [grid_pix_A,grid_pix_B]=get_grid(handles) ;290 function [grid_pix_A,grid_pix_B]=get_grid(handles) 290 291 %Object=read_set_object(handles);%read the set_grid interface; 291 292 grid_pix_B=[];%default … … 296 297 YMin=str2num(get(handles.YMin,'String')); 297 298 YMax=str2num(get(handles.YMax,'String')); 298 array_realx= [XMin:DX:XMax];299 array_realy= [YMin:DY:YMax];299 array_realx=XMin:DX:XMax; 300 array_realy=YMin:DY:YMax; 300 301 nx_patch=length(array_realx); 301 302 ny_patch=length(array_realy); … … 325 326 return 326 327 end 327 [Pathsub,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(imageA); 328 form=imformats(ext(2:end)); 328 %[Pathsub,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(imageA); 329 [RootPath,~,RootFile,~,~,~,~,FileExt]=fileparts_uvmat(imageA); 330 form=imformats(FileExt(2:end)); 329 331 if isempty(form)% if the extension corresponds to an image format recognized by Matlab 330 332 msgbox_uvmat('ERROR',['error: ' imageA ' is not an image name recognized by Matlab ']) 331 333 return 332 334 end 333 fileAxml=[fullfile( Pathsub,RootFile) '.xml'];335 fileAxml=[fullfile(RootPath,RootFile) '.xml']; 334 336 [XmlDataA,error]=imadoc2struct(fileAxml); 335 337 if isfield(XmlDataA,'GeometryCalib') … … 360 362 return 361 363 end 362 [Pathsub,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(imageB); 363 form=imformats(ext([2:end])); 364 %[RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(imageB); 365 [RootPath,~,RootFile,~,~,~,~,FileExt]=fileparts_uvmat(imageB); 366 form=imformats(FileExt(2:end)); 364 367 if isempty(form)% if the extension corresponds to an image format recognized by Matlab 365 366 367 end 368 fileBxml=[fullfile( Pathsub,RootFile) '.xml'];369 [XmlDataB,error]=imadoc2struct(fileBxml); 368 msgbox_uvmat('ERROR',['error: ' imageB ' is not an image name recognized by Matlab ']) 369 return 370 end 371 fileBxml=[fullfile(RootPath,RootFile) '.xml']; 372 [XmlDataB,error]=imadoc2struct(fileBxml); 370 373 if isfield(XmlDataB,'GeometryCalib') 371 tsaiB=XmlDataB.GeometryCalib;374 tsaiB=XmlDataB.GeometryCalib; 372 375 else 373 msgbox_uvmat('WARNING','no geometric calibration available for image B')374 tsaiB=[];375 end376 %[error,Heading, nom_type_read,ext_ima_read,time,TimeUnit,mode,NbSlice,...376 msgbox_uvmat('WARNING','no geometric calibration available for image B') 377 tsaiB=[]; 378 end 379 %[error,Heading,NomType_read,ext_ima_read,time,TimeUnit,mode,NbSlice,... 377 380 % npxB,npyB,tsaiB]=read_imadoc(fileBxml,0); 378 381 [grid_imaB(:,1),grid_imaB(:,2)]=px_XYZ(tsaiB,grid_real(:,1),grid_real(:,2),0); 379 % if isempty(npxB)|isempty(npyB)380 381 382 383 384 % end385 flagB=grid_imaB(:,1)>0 & grid_imaB(:,1)<npxB & grid_imaB(:,2)>0 & grid_imaB(:,2)<npyB; 382 % if isempty(npxB)|isempty(npyB) 383 B=imread(imageB); 384 siz=size(B); 385 npxB=siz(2); 386 npyB=siz(1); 387 % end 388 flagB=grid_imaB(:,1)>0 & grid_imaB(:,1)<npxB & grid_imaB(:,2)>0 & grid_imaB(:,2)<npyB; 386 389 end 387 390 if testB
Note: See TracChangeset
for help on using the changeset viewer.