Changeset 1151 for trunk


Ignore:
Timestamp:
Jun 26, 2024, 6:37:49 PM (6 months ago)
Author:
sommeria
Message:

civ_3D updated

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r1150 r1151  
    180180if ~isempty(hhuvmat.RootPath)&& ~isempty(hhuvmat.RootFile)
    181181    RootPath=get(hhuvmat.RootPath,'String');% path to the currently displayed image
    182     SubDirBase=regexprep(get(hhuvmat.SubDir,'String'),'\..+$','');
    183     outputfile=[fullfile(RootPath,SubDirBase) '.xml'];%xml file associated with the currently displayed image
     182    %SubDirBase=regexprep(get(hhuvmat.SubDir,'String'),'\..+$','');
     183    outputfile=[fullfile(RootPath,get(hhuvmat.SubDir,'String')) '.xml'];%xml file associated with the currently displayed image
    184184else
    185185    question={'save the calibration data and point coordinates in'};
     
    295295            SourceDir=get(BrowseData.SourceDir,'String');
    296296            ListExp=get(BrowseData.ListExperiments,'String');
    297             ExpIndices=get(BrowseData.ListExperiments,'Value');
    298             ListExp=ListExp(ExpIndices);
     297            ListExp=ListExp(get(BrowseData.ListExperiments,'Value'));% list of selected experiments
    299298            ListDevices=get(BrowseData.ListDevices,'String');
    300             DeviceIndices=get(BrowseData.ListDevices,'Value');
    301             ListDevices=ListDevices(DeviceIndices);
     299            ListDevices=ListDevices(get(BrowseData.ListDevices,'Value'));% list of selected devices
    302300            ListDataSeries=get(BrowseData.DataSeries,'String');
    303             DataSeriesIndices=get(BrowseData.DataSeries,'Value');
    304             ListDataSeries=ListDataSeries(DataSeriesIndices);
     301            ListDataSeries=ListDataSeries(get(BrowseData.DataSeries,'Value'));% list of selected data series
     302            if find(~cellfun('isempty',strfind(ListDataSeries,'.xml')))
     303                msgbox_uvmat('ERROR','select folders in browse_data, not xml files');
     304                return
     305            end
     306            if find(~cellfun('isempty',strfind(ListDataSeries,'.')))
     307                msgbox_uvmat('ERROR','select only folders at the root, without dot (.) in the name');
     308                return
     309            end
    305310            NbExp=0; % counter of the number of experiments set by the GUI browse_data
    306311            for iexp=1:numel(ListExp)
     
    344349                else
    345350                    if check_update
    346                         display([XmlName ' updated with calibration parameters' dispmessage])
     351                        disp([XmlName ' updated with calibration parameters' dispmessage]);
    347352                    else
    348                         display([XmlName ' created with calibration parameters: no timing defined' dispmessage])
     353                        disp([XmlName ' created with calibration parameters: no timing defined' dispmessage]);
    349354                    end
    350355                end
  • trunk/src/series/civ_3D.m

    r1150 r1151  
    289289        par_civ1.ImageA=zeros(2*SearchRange_z+1,npy,npx);
    290290        par_civ1.ImageB=zeros(2*SearchRange_z+1,npy,npx);
    291 
    292         for islice=par_civ1.Dz:NbSlice
    293             if par_civ1.Dz<2*SearchRange_z+1
    294             par_civ1.ImageA=circshift(par_civ1.ImageA,-par_civ1.Dz);
     291        %first vertical block centered at image index islice=par_civ1.Dz
     292        islice=par_civ1.Dz;
     293         for iz=1:par_civ1.Dz+SearchRange_z
     294              ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(1,ifield),[],j1_series_Civ1(iz,1));%
     295            A= read_image(ImageName_A,FileType_A);
     296            ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(1,ifield),[],j1_series_Civ1(iz,1));
     297            B= read_image(ImageName_B,FileType_B);
     298            par_civ1.ImageA(iz+par_civ1.Dz-1,:,:) = A;
     299            par_civ1.ImageB(iz+par_civ1.Dz-1,:,:) = B;
     300         end
     301         % caluclate velocity data (y and v in indices, reverse to y component)
     302            [Data.Civ1_X(islice,:,:),Data.Civ1_Y(islice,:,:), utable, vtable,wtable, ctable, FF, result_conv, errormsg] = civ3D (par_civ1);
     303            if ~isempty(errormsg)
     304                disp_uvmat('ERROR',errormsg,checkrun)
     305                return
     306            end
     307        for islice=2*par_civ1.Dz:NbSlice% loop on slices for the first image in the pair
     308            par_civ1.ImageA=circshift(par_civ1.ImageA,-par_civ1.Dz);%shift the indces in the block upward by par_civ1.Dz
    295309            par_civ1.ImageB=circshift(par_civ1.ImageA,-par_civ1.Dz);
    296             end
    297310              for iz=1:par_civ1.Dz
    298             ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(1,ifield),[],j1_series_Civ1(islice+SearchRange_z-iz+1,1));
     311            ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(1,ifield),[],j1_series_Civ1(islice+SearchRange_z-par_civ1.Dz+iz,1));%
    299312            A= read_image(ImageName_A,FileType_A);
    300             ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(1,ifield),[],j1_series_Civ1(islice+SearchRange_z-iz+1,1));
     313            ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(1,ifield),[],j1_series_Civ1(islice+SearchRange_z-par_civ1.Dz+iz,1));
    301314            B= read_image(ImageName_B,FileType_B);
    302             par_civ1.ImageA(2*SearchRange_z+2-iz,:,:) = A;
    303             par_civ1.ImageB(2*SearchRange_z+2-iz,:,:) = B;
     315            par_civ1.ImageA(2*SearchRange_z+1-par_civ1.Dz+iz,:,:) = A;
     316            par_civ1.ImageB(2*SearchRange_z+1-par_civ1.Dz+iz,:,:) = B;
    304317            end
    305318            % caluclate velocity data (y and v in indices, reverse to y component)
  • trunk/src/update_imadoc.m

    r1127 r1151  
    3030errormsg='';
    3131testappend=0;
    32 %% backup the output file if it already exist, and read it
    33 if exist(outputfile,'file')%=1 if the output file already exists, 0 else
    34     testappend=1;
    35     backupfile=outputfile;
    36     t=xmltree(outputfile); %read the file
    37     title=get(t,1,'name');
    38     if strcmp(title,'ImaDoc')
    39         %         testappend=1;
    40         %rename the existing file for backup
    41         testexist=2;
     32
     33%% set the output xml file at the root, hide other existing  xml files
     34dotchar=regexp(outputfile,'\.');
     35for idot=1:numel(dotchar)
     36    outputfile=[outputfile(1:dotchar(end-idot+1)-1) '.xml'];
     37    if exist(outputfile,'file')
     38         backupfile=outputfile;
     39         testexist=2;
    4240        while testexist==2
    4341            backupfile=[backupfile '~'];
     
    4947            return
    5048        end
    51         %if the xml file is  ImaDoc
    52         uid_calib=find(t,['ImaDoc/' StructName]);
    53         if isempty(uid_calib)  %if Struct does not already exists, create it
    54             [t,uid_calib]=add(t,1,'element',StructName);
    55         else %if Struct already exists, delete its content
    56             uid_child=children(t,uid_calib);
    57             t=delete(t,uid_child);
    58         end
     49    end
     50end
     51
     52
     53%% backup the output file if it already exist, and read it
     54if exist(outputfile,'file')%=1 if the output file already exists, 0 else
     55    testappend=1;
     56    t=xmltree(outputfile); %read the file
     57    title=get(t,1,'name');
     58    if ~strcmp(title,'ImaDoc')
     59        errormsg=[outputfile ' not appropriate for calibration'];
     60        return
     61    end
     62    uid_calib=find(t,['ImaDoc/' StructName]);
     63    if isempty(uid_calib)  %if Struct does not already exists, create it
     64        [t,uid_calib]=add(t,1,'element',StructName);
     65    else %if Struct already exists, delete its content
     66        uid_child=children(t,uid_calib);
     67        t=delete(t,uid_child);
    5968    end
    6069end
Note: See TracChangeset for help on using the changeset viewer.