Changeset 342 for trunk/src/set_grid.m


Ignore:
Timestamp:
Dec 20, 2011, 5:14:43 PM (13 years ago)
Author:
sommeria
Message:

various bugs corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/set_grid.m

    r315 r342  
    264264textout=char(textgrid);
    265265imageA=get(handles.image_1,'String');
    266 [Pathsub]=name2display(imageA);
    267 Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile(Pathsub,'gridA.grid'));
     266RootPath=fileparts_uvmat(imageA);
     267%[Pathsub]=name2display(imageA);
     268Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile(RootPath,'gridA.grid'));
    268269% Answer = inputdlg('grid file name (*.grid)',' ',1,{fullfile(Pathsub,'gridA.grid')},'on');
    269270dlmwrite(Answer,textout,'');
     
    281282    textgrid={tete;txt};
    282283    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'));
    284285    dlmwrite(Answer,textout,'');
    285286    msgbox_uvmat('CONFIRMATION',[Answer ' written as ASCII text file']);
     
    287288
    288289%-------------------------
    289 function [grid_pix_A,grid_pix_B]=get_grid(handles);
     290function [grid_pix_A,grid_pix_B]=get_grid(handles)
    290291%Object=read_set_object(handles);%read the set_grid interface;
    291292grid_pix_B=[];%default
     
    296297YMin=str2num(get(handles.YMin,'String'));
    297298YMax=str2num(get(handles.YMax,'String'));
    298 array_realx=[XMin:DX:XMax];
    299 array_realy=[YMin:DY:YMax];
     299array_realx=XMin:DX:XMax;
     300array_realy=YMin:DY:YMax;
    300301nx_patch=length(array_realx);
    301302ny_patch=length(array_realy);
     
    325326    return
    326327end
    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);
     330form=imformats(FileExt(2:end));
    329331if isempty(form)% if the extension corresponds to an image format recognized by Matlab
    330332     msgbox_uvmat('ERROR',['error: ' imageA ' is not an image name recognized by Matlab '])
    331333     return
    332334end
    333 fileAxml=[fullfile(Pathsub,RootFile) '.xml'];
     335fileAxml=[fullfile(RootPath,RootFile) '.xml'];
    334336[XmlDataA,error]=imadoc2struct(fileAxml);
    335337if isfield(XmlDataA,'GeometryCalib')
     
    360362        return
    361363    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));
    364367    if isempty(form)% if the extension corresponds to an image format recognized by Matlab
    365          msgbox_uvmat('ERROR',['error: ' imageB ' is not an image name recognized by Matlab '])
    366          return
    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);
    370373    if isfield(XmlDataB,'GeometryCalib')
    371      tsaiB=XmlDataB.GeometryCalib;
     374        tsaiB=XmlDataB.GeometryCalib;
    372375    else
    373      msgbox_uvmat('WARNING','no geometric calibration available for image B')
    374      tsaiB=[];
    375  end
    376     %[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,...
    377380    %     npxB,npyB,tsaiB]=read_imadoc(fileBxml,0);
    378381    [grid_imaB(:,1),grid_imaB(:,2)]=px_XYZ(tsaiB,grid_real(:,1),grid_real(:,2),0);
    379 %     if isempty(npxB)|isempty(npyB)
    380         B=imread(imageB);
    381        siz=size(B);
    382        npxB=siz(2);
    383        npyB=siz(1);
    384 %     end
    385     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;
    386389end
    387390if testB
Note: See TracChangeset for help on using the changeset viewer.