Changeset 39 for trunk/src/civ.m


Ignore:
Timestamp:
Mar 9, 2010, 5:46:24 PM (14 years ago)
Author:
sommeria
Message:

civ: bug corrected for civ in batch
series and uvmat: further improvement and debugging for the menu of field transforms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r36 r39  
    9191end
    9292
    93 if exist('ext','var') && length(ext)>1 && (~isempty(imformats(ext([2:end])))|...
    94                        isequal(ext,'.avi')||isequal(ext,'.AVI'));%if an image file has been opened by uvmat
     93if exist('ext','var') && length(ext)>1 && (~isempty(imformats(ext(2:end)))||...
     94                       isequal(lower(ext),'.avi'));%if an image file has been opened by uvmat
    9595        set(handles.ext_ima,'String',ext)
    9696        if exist('nom_type_read','var')
     
    259259filebase=get(handles.displ_filebase,'String');
    260260oldfile=''; %default
    261 if isempty(filebase)|isequal(filebase,'')%loads the previously stored file name and set it as default in the file_input box
     261if isempty(filebase)|| isequal(filebase,'')%loads the previously stored file name and set it as default in the file_input box
    262262     dir_perso=prefdir;
    263263     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     
    448448field_count=1;%default
    449449nom_type_nc=[];
    450 npx=[];%default
    451 npy=[];
     450% npx=[];%default
     451% npy=[];
    452452time=[];
    453453TimeUnit=[]; %default
     
    478478end
    479479first_j=str2num(get(handles.first_j,'String'));
    480 if isempty(first_j)| first_j < 1
     480if isempty(first_j)|| first_j < 1
    481481    first_j=1; %default first_j
    482482end
    483483last_j=str2num(get(handles.last_j,'String'));
    484 if isempty(last_j)| last_j < first_j
     484if isempty(last_j)|| last_j < first_j
    485485    last_j=first_j; %default last_j
    486486end
    487487incr_i=str2num(get(handles.incr_i,'String'));
    488 if isempty(incr_i) | incr_i < 1;
     488if isempty(incr_i) || incr_i < 1;
    489489    set(handles.incr_i,'String','1') %default incr_i
    490490end
    491491incr_j=str2num(get(handles.incr_j,'String'));
    492 if isempty(incr_j) | incr_j < 1;
     492if isempty(incr_j) || incr_j < 1;
    493493    set(handles.incr_j,'String','1') %default incr_j
    494494end
     
    554554    if isfield(XmlData,'Heading')&&isfield(XmlData.Heading','ImageName')&&ischar(XmlData.Heading.ImageName)% get image nom type and extension from the xml file
    555555        [PP,FF,fc,str2,str_a,str_b,ext_ima_read,nom_type_read]=name2display(XmlData.Heading.ImageName);
    556         fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName) %full name (including path) of the first image defined by the xmle file,
     556        fullname=fullfile(fileparts(filebase),XmlData.Heading.ImageName); %full name (including path) of the first image defined by the xmle file,
    557557        if exist(fullname,'file')
    558558            testima_xml=1;
     
    13181318last_i=str2num(get(handles.last_i,'String'));%last index i
    13191319incr=str2num(get(handles.incr_i,'String'));% increment
    1320 num1=[first_i:incr:last_i];% list of i indices (reference values for each pair)
     1320num_i=[first_i:incr:last_i];% list of i indices (reference values for each pair)
    13211321if isequal(get(handles.first_j,'Visible'),'on')
    13221322    first_j=str2num(get(handles.first_j,'String'));%first index j
     
    13311331list_civ1=get(handles.list_pair_civ1,'String');
    13321332index_civ1=get(handles.list_pair_civ1,'Value');
     1333[num_i,num_j]=meshgrid(num_i,num_j);
    13331334str_civ1=list_civ1{index_civ1};%string defining the image pairs for civ1
    13341335if isempty(str_civ1)||isequal(str_civ1,'')
     
    13451346if isempty(first_i)||isempty(first_j), msgbox_uvmat('ERROR','first field number not defined'),...
    13461347    return,end;
    1347 if isequal(last_i,[])| isequal(last_j,[]),msgbox_uvmat('ERROR','last field number not defined'),...
     1348if isequal(last_i,[])|| isequal(last_j,[]),msgbox_uvmat('ERROR','last field number not defined'),...
    13481349    return,end;
    1349 if isequal(incr,[])| isequal(incr_j,[]),msgbox_uvmat('ERROR','increment in field number not defined'),...
     1350if isequal(incr,[])|| isequal(incr_j,[]),msgbox_uvmat('ERROR','increment in field number not defined'),...
    13501351    return,end;
    1351 if last_i < first_i | last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),...
     1352if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),...
    13521353    return,end;
    13531354if isequal (mode,'series(Di)')
     
    13621363        d2=str2num(str_civ1([indsel(indsepar)+1:indsel(indsepar+1)-1]));
    13631364    end   
    1364     num1_civ1=num1-d1;% set of first image numbers
    1365     num2_civ1=num1+d2;
     1365    num1_civ1=num_i-d1;% set of first image numbers
     1366    num2_civ1=num_i+d2;
    13661367    num_a_civ1=num_j;
    13671368    num_b_civ1=num_j;
     
    13781379    end   
    13791380    if isempty(d1)
    1380         num1_civ2=num1;
     1381        num1_civ2=num_i;
    13811382    else
    1382         num1_civ2=num1-d1;% set of first image numbers
     1383        num1_civ2=num_i-d1;% set of first image numbers
    13831384    end
    13841385    if isempty(d2)
    1385         num2_civ2=num1;
     1386        num2_civ2=num_i;
    13861387    else
    1387         num2_civ2=num1+d2;
     1388        num2_civ2=num_i+d2;
    13881389    end
    13891390    num_a_civ2=num_j;
     
    14001401        firstind=indsel(1);
    14011402        lastind=indsel(end);
    1402         set(handles.first_i,'String',num2str(num1(firstind)))%update the display of first and last fields
    1403         set(handles.last_i,'String',num2str(num1(lastind)))
    1404         num1=num1(indsel);
     1403        set(handles.first_i,'String',num2str(num_i(firstind)))%update the display of first and last fields
     1404        set(handles.last_i,'String',num2str(num_i(lastind)))
     1405        num_i=num_i(indsel);
    14051406        num1_civ1=num1_civ1(indsel);
    14061407        num1_civ2=num1_civ2(indsel);
     
    14101411elseif isequal (mode,'series(Dj)')
    14111412    lastfield_j=str2num(get(handles.nb_field2,'String'));
    1412     num1_civ1=num1;% set of first image numbers
    1413     num2_civ1=num1;
     1413    num1_civ1=num_i;% set of first image numbers
     1414    num2_civ1=num_i;
    14141415    num_a_civ1=num_j-floor(index_civ1/2)*ones(size(num_j));
    14151416    num_b_civ1=num_j+ceil(index_civ1/2)*ones(size(num_j));
    1416     num1_civ2=num1;
    1417     num2_civ2=num1;
     1417    num1_civ2=num_i;
     1418    num2_civ2=num_i;
    14181419    num_a_civ2=num_j-floor(index_civ2/2)*ones(size(num_j));
    14191420    num_b_civ2=num_j+ceil(index_civ2/2)*ones(size(num_j));
     
    14361437    end
    14371438elseif isequal(mode,'pair j1-j2') %case of bursts (png_old or png_2D)
    1438     num1_civ1=num1;
    1439     num1_civ2=num1;
     1439    num1_civ1=num_i;
     1440    num1_civ2=num_i;
    14401441    displ_num=get(handles.list_pair_civ1,'UserData');
    1441     num2_civ1=num1;
     1442    num2_civ1=num_i;
    14421443    num_a_civ1=displ_num(1,index_civ1);
    14431444    num_b_civ1=displ_num(2,index_civ1);
    1444     num2_civ2=num1;
     1445    num2_civ2=num_i;
    14451446    num_a_civ2=displ_num(1,index_civ2);
    14461447    num_b_civ2=displ_num(2,index_civ2);
    14471448elseif isequal(mode,'displacement')
    1448     num1_civ1=num1;
    1449     num2_civ1=num1;
     1449    num1_civ1=num_i;
     1450    num2_civ1=num_i;
    14501451    num_a_civ1=num_j;
    14511452    num_b_civ1=num_j;
    1452     num1_civ2=num1;
    1453     num2_civ2=num1;
     1453    num1_civ2=num_i;
     1454    num2_civ2=num_i;
    14541455    num_a_civ2=num_j;
    14551456    num_b_civ2=num_j;
    14561457end
    1457 'TESTfind'
    1458 num1_civ1
    1459 num2_civ1
    1460 num_a_civ1
    1461 num_b_civ1
    14621458
    14631459%------------------------------------------------------------------------
     
    16641660[filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=...
    16651661       set_civ_filenames(handles,compare,box_test);
    1666    'TESTnbre_RUN'
    1667 nbfield=size(num1_civ1,2)
    1668 nbslice=size(num1_civ1,1)
     1662nbfield=size(num1_civ1,2);
     1663nbslice=size(num1_civ1,1);
    16691664
    16701665if isempty(filecell)
     
    21852180       set_civ_filenames(handles,compare,box_test);
    21862181display('files OK, processing...') 
    2187 'TESTnbre'
    2188 nbfield=size(num1_civ1,2)
    2189 nbslice=size(num1_civ1,1)
     2182nbfield=size(num1_civ1,2);
     2183nbslice=size(num1_civ1,1);
    21902184
    21912185%GET PARAMETERS:
     
    26782672            cmd=char({cmd;[Civ_exe ' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]});
    26792673        end
    2680 
    26812674      % create the .bat file:
    26822675        if sge
     
    26882681        filename_bat(end-2:end)='bat';
    26892682        fid=fopen(filename_bat,'w');
    2690         fprintf(fid,cmd)
    2691         fclose(fid)
     2683        fprintf(fid,cmd);
     2684        fclose(fid);
    26922685        %dlmwrite(filename_bat,cmd,'');%write commands in filename_bat
    26932686        if sge
     
    27722765[num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2]=...
    27732766    find_pair_indices(handles,mode);
    2774 
    27752767%determine the new filebase for 'displacement' mode (comparison of two series)
    27762768filebase_B=filebase;% root name of the second field series for stereo
     
    34583450        term_b=num2stra(num_b(j),nom_type_nc);%
    34593451        if test_grid && ~isempty(nbslice_grid)       
    3460              num1_grid=mod(num1(ifile)-1,nbslice_grid)+1
     3452             num1_grid=mod(num1(ifile)-1,nbslice_grid)+1;
    34613453            gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')];
    34623454            if ~exist(gridname,'file')
     
    36523644        filename_nc1([end-2:end])=[]; % remove '.nc'     
    36533645        if test_grid && ~isempty(nbslice_grid)       
    3654             num1_grid=mod(num1(ifile)-1,nbslice_grid)+1
     3646            num1_grid=mod(num1(ifile)-1,nbslice_grid)+1;
    36553647            gridname=[filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')];
    36563648            if ~exist(gridname,'file')
     
    42144206if value
    42154207        filebase=get(handles.displ_filebase,'String');
    4216     [nbslice, flag_grid]=get_grid(filebase,handles)
     4208    [nbslice, flag_grid]=get_grid(filebase,handles);
    42174209    if isequal(flag_grid,1)
    42184210       filegrid=[num2str(nbslice) 'grid'];
     
    42644256if value
    42654257        filebase=get(handles.displ_filebase,'String');
    4266     [nbslice, flag_grid]=get_grid(filebase,handles)
     4258    [nbslice, flag_grid]=get_grid(filebase,handles);
    42674259    if isequal(flag_grid,1)
    42684260        mask_displ=[num2str(nbslice) 'grid'];
Note: See TracChangeset for help on using the changeset viewer.