Changeset 315


Ignore:
Timestamp:
Dec 3, 2011, 10:25:45 PM (12 years ago)
Author:
sommeria
Message:

many corrections, use of the new GUI civ with mask, grid and the new matlab civ1 and fix
pivlab now included in civ_matlab which contains all matlab subfunctions for civ.

Location:
trunk/src
Files:
1 added
2 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/check_files.m

    r306 r315  
    4141    'civ_3D';... function associated with the interface 'civ_3D.fig' for PIV in volume (in progress)
    4242    'civ_3D.fig';...
    43     'civ_uvmat';...% civ programs, Matlab version (called by civ.m, option Civuvmat)
     43    'civ_matlab';...% civ programs, Matlab version (called by civ.m, option Civprogram/Matlab in the upper menu bar)
    4444    'close_fig';...% function  activated when a figure is closed
    4545    'copyfields';...% copy fields between two matlab structures
     
    7171    'peaklock';...%
    7272    'phys_XYZ';...% transform coordiantes from pixels to phys
    73     'pivlab';...% PIV program (Civ1), called by civ_uvmat
    7473    'px_XYZ';...% transform coordiantes from phys to pixels
    7574    'plot_field';...%displays a vector field and/or scalar or images
  • trunk/src/civ.m

    r314 r315  
    2323%TODO: search range
    2424
    25 % Last Modified by GUIDE v2.5 30-Nov-2011 21:52:52
     25% Last Modified by GUIDE v2.5 03-Dec-2011 16:08:25
    2626% Begin initialization code - DO NOT EDIT
    2727gui_Singleton = 1;
     
    533533    ind_opening=2;% propose 'fix' as the default option
    534534    Data=nc2struct(fileinput,'ListGlobalAttribute','CivStage','absolut_time_T0','fix','patch','civ2','fix2');
     535    if isfield(Data,'Txt')
     536        msgbox_uvmat('ERROR',Data.Txt)
     537        return
     538    end
    535539    if ~isempty(Data.CivStage)%test for civ files
    536540        ind_opening=Data.CivStage;
     
    959963%could be included in get_mask callback ?
    960964if isequal(get(handles.CheckMask,'Value'),1)
    961     maskname=get(handles.txt_MaskName,'String');
     965    maskname=get(handles.txt_Mask,'String');
    962966    if ~exist(maskname,'file')
    963967        get_mask_civ1_Callback(hObject, eventdata, handles);
     
    965969end
    966970if isequal(get(handles.CheckMask,'Value'),1)
    967     maskname=get(handles.txt_MaskName,'String');
     971    maskname=get(handles.txt_Mask,'String');
    968972    if ~exist(maskname,'file')
    969973        get_mask_fix1_Callback(hObject, eventdata, handles);
     
    977981end
    978982if isequal(get(handles.CheckMask,'Value'),1)
    979     maskname=get(handles.txt_MaskName,'String');
     983    maskname=get(handles.txt_Mask,'String');
    980984    if ~exist(maskname,'file')
    981985        get_mask_fix2_Callback(hObject, eventdata, handles);
     
    10971101%% MAIN LOOP
    10981102time=get(handles.ImaDoc,'UserData'); %get the set of times
    1099 super_cmd=[];
    11001103batch_file_list=[];
    11011104 
     
    11291132        if Param.CheckCiv1
    11301133            % read image-dependent parameters
    1131             Param.Civ1.filename_ima_a=filecell.ima1.civ1{ifile,j};
    1132             Param.Civ1.filename_ima_b=filecell.ima2.civ1{ifile,j};
     1134            Param.Civ1.ImageA=filecell.ima1.civ1{ifile,j};
     1135            Param.Civ1.ImageB=filecell.ima2.civ1{ifile,j};
    11331136            if size(time,1)>=i2_civ1(ifile) && size(time,2)>=j2_civ1(j)
    11341137                Param.Civ1.Dt=(time(i2_civ1(ifile),j2_civ1(j))-time(i1_civ1(ifile),j1_civ1(j)));
    1135                 Param.Civ1.T0=((time(i2_civ1(ifile),j2_civ1(j))+time(i1_civ1(ifile),j1_civ1(j)))/2);
     1138                Param.Civ1.Time=((time(i2_civ1(ifile),j2_civ1(j))+time(i1_civ1(ifile),j1_civ1(j)))/2);
    11361139            else
    11371140                Param.Civ1.Dt=1;
    1138                 Param.Civ1.T0=0;
     1141                Param.Civ1.Time=0;
    11391142            end
    11401143            Param.Civ1.term_a=num2stra(j1_civ1(j),nom_type_nc);%UTILITE?
    1141             Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);%
    1142             Param.Civ1.pxcmx=1; %velocities are expressed in pixel dispalcement
    1143             Param.Civ1.pxcmy=1;     
    1144             Param.Civ1.ImageInfo=imfinfo(filecell.ima1.civ1{1,1});%read the first image to get the size
    1145            
    1146             %TODO : civ should not need npx and npy
    1147            
     1144            Param.Civ1.term_b=num2stra(j2_civ1(j),nom_type_nc);%   
     1145            ImageInfo=imfinfo(filecell.ima1.civ1{1,1});%read the first image to get the size
     1146            Param.Civ1.ImageWidth=ImageInfo.Width;
     1147            Param.Civ1.ImageHeight=ImageInfo.Height;
     1148            Param.Civ1.ImageBitDepth=ImageInfo.BitDepth;
    11481149            % read mask parameters
    11491150            if Param.Civ1.CheckMask % the lines below should be changed with the new gui
    1150                 %matbe they when check_mask the Maskname is read
    1151                 if exist(Param.Civ1.MaskName,'file')
    1152                     Param.Civ1.MaskFlag='y';
    1153                 else
    1154                     maskbase=[filecell.filebase '_' Param.Civ1.MaskName]; %
    1155                     nbslice_mask=str2double(maskdispl(1:end-4)); %
     1151                if ~exist(Param.Civ1.Mask,'file')
     1152                    maskbase=[filecell.filebase '_' Param.Civ1.Mask]; %
     1153                    nbslice_mask=str2double(Param.Civ1.Mask(1:end-4)); %
    11561154                    i1_mask=mod(i1_civ1(ifile)-1,nbslice_mask)+1;
    1157                     Param.Civ1.MaskName=name_generator(maskbase,i1_mask,1,'.png','_i');
    1158                     if exist(Param.Civ1.MaskName,'file')
    1159                         Param.Civ1.maskflag='y';
    1160                     else
    1161                         Param.Civ1.MaskName='noFile use default';
    1162                         Param.Civ1.MaskFlag='n';
    1163                     end
     1155                    Param.Civ1.Mask=name_generator(maskbase,i1_mask,1,'.png','_i');
    11641156                end
    1165             else
    1166                 Param.Civ1.MaskName='noFile use default';
    1167                 Param.Civ1.MaskFlag='n';
    1168             end
    1169            
     1157            end
    11701158            % read grid parameters
    11711159            if Param.Civ1.CheckGrid
    1172 %                 Param.Civ1.GridFlag='y';
    1173                 if isequal(Param.Civ1.GridName(end-3:end),'grid')
    1174                     nbslice_grid=str2double(Param.Civ1.GridName(1:end-4)); %
     1160                if numel(Param.Civ1.Grid)>=4 && isequal(Param.Civ1.Grid(end-3:end),'grid')
     1161                    nbslice_grid=str2double(Param.Civ1.Grid(1:end-4)); %
    11751162                    if ~isnan(nbslice_grid)
    11761163                        i1_grid=mod(i1_civ1(ifile)-1,nbslice_grid)+1;
    1177                         Param.Civ1.GridName=[filecell.filebase '_' name_generator(Param.Civ1.GridName,i1_grid,1,'.grid','_i')];
     1164                        Param.Civ1.Grid=[filecell.filebase '_' name_generator(Param.Civ1.Grid,i1_grid,1,'.grid','_i')];
    11781165                        if ~exist(Param.Civ1.GridName,'file')
    11791166                            msgbox_uvmat('ERROR','grid file absent for civ1')
    11801167                        end
    1181                     elseif ~exist(Param.Civ1.GridName,'file')
     1168                    elseif ~exist(Param.Civ1.Grid,'file')
    11821169                        msgbox_uvmat('ERROR','grid file absent for civ1')
    11831170                    end
    11841171                end
    1185 %            else
    1186 %                 Param.Civ1.GridName='noFile use default';
    1187 %                 Param.Civ1.GridFlag='n';
    11881172            end
    11891173           
     
    12821266        end
    12831267        if Param.CheckCiv2==1
    1284             Param.Civ2.filename_ima_a=filecell.ima1.civ2{ifile,j};
    1285             Param.Civ2.filename_ima_b=filecell.ima2.civ2{ifile,j};
     1268            Param.Civ2.ImageA=filecell.ima1.civ2{ifile,j};
     1269            Param.Civ2.ImageB=filecell.ima2.civ2{ifile,j};
    12861270            if size(time,1)>=i2_civ2(ifile) && size(time,2)>=j2_civ2(j)
    12871271                Param.Civ2.Dt=num2str(time(i2_civ2(ifile),j2_civ2(j))-time(i1_civ2(ifile),j1_civ2(j)));
    1288                 Param.Civ2.T0=num2str((time(i2_civ2(ifile),j2_civ2(j))+time(i1_civ2(ifile),j1_civ2(j)))/2);
     1272                Param.Civ2.Time=num2str((time(i2_civ2(ifile),j2_civ2(j))+time(i1_civ2(ifile),j1_civ2(j)))/2);
    12891273            else
    12901274                Param.Civ2.Dt=1;
    1291                 Param.Civ2.T0=0;
     1275                Param.Civ2.Time=0;
    12921276            end
    12931277            Param.Civ2.term_a=num2stra(j1_civ2(j),nom_type_nc);
     
    12951279            Param.Civ2.filename_nc1=filecell.nc.civ1{ifile,j};
    12961280            Param.Civ2.filename_nc1(end-2:end)=[]; % remove '.nc'
    1297             Param.Civ2.pxcmx=1; %velocities are expressed in pixel dispalcement
    1298             Param.Civ2.pxcmy=1;
     1281           
     1282            % mask
    12991283            if Param.Civ2.CheckMask
    1300                 maskdispl=get(handles.txt_Mask,'String');
    1301                 if exist(maskdispl,'file')
    1302                     Param.Civ2.MaskName=maskdispl;
    1303                     Param.Civ2.MaskFlag='y';
    1304                 else
    1305                     maskbase=[filecell.filebase '_' maskdispl]; %
    1306                     nbslice_mask=str2double(maskdispl(1:end-4)); %
     1284                if ~exist(Param.Civ2.Mask,'file')
     1285                    maskbase=[filecell.filebase '_' Param.Civ2.Mask]; %
     1286                    nbslice_mask=str2double(Param.Civ2.Mask(1:end-4)); %
    13071287                    i1_mask=mod(i1_civ2(ifile)-1,nbslice_mask)+1;
    1308                     Param.Civ2.MaskName=name_generator(maskbase,i1_mask,1,'.png','_i');
    1309                     if exist(Param.Civ2.MaskName,'file')
    1310                         Param.Civ2.MaskFlag='y';
    1311                     else
    1312                         Param.Civ2.MaskName='noFile use default';
    1313                         Param.Civ2.MaskFlag='n';
     1288                    Param.Civ2.Mask=name_generator(maskbase,i1_mask,1,'.png','_i');
     1289                end
     1290            end
     1291            %grid
     1292            if Param.Civ2.CheckGrid
     1293                if numel(Param.Civ2.Grid)>=4 && isequal(Param.Civ2.Grid(end-3:end),'grid')
     1294                    nbslice_grid=str2double(Param.Civ2.Grid(1:end-4)); %
     1295                    if ~isnan(nbslice_grid)
     1296                        i1_grid=mod(i1_civ2(ifile)-1,nbslice_grid)+1;
     1297                        Param.Civ2.Grid=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')];
    13141298                    end
    13151299                end
    1316             else
    1317                 Param.Civ2.MaskName='noFile use default';
    1318                 Param.Civ2.MaskFlag='n';
    1319             end
    1320             gridname=get(handles.txt_GridName,'String');
    1321             if numel(gridname)>=4 && isequal(gridname(end-3:end),'grid')
    1322                 nbslice_grid=str2double(gridname(1:end-4)); %
    1323                 if ~isnan(nbslice_grid)
    1324                     Param.Civ2.GridFlag='y';
    1325                     i1_grid=mod(i1_civ2(ifile)-1,nbslice_grid)+1;
    1326                     Param.Civ2.GridName=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')];
    1327 %                     if exist(Param.Civ2.GridName,'file')
    1328 %                         Param.Civ2.GridFlag='y';
    1329 %                     else
    1330 %                         Param.Civ2.GridName='noFile use default';
    1331 %                         Param.Civ2.GridFlag='n';
    1332 %                     end
    1333                 elseif exist(gridname,'file')
    1334 %                     Param.Civ2.GridFlag='y';
    1335 %                 else
    1336 %                     Param.Civ2.GridName='noFile use default';
    1337 %                     Param.Civ2.GridFlag='n';
    1338                 end
    1339 %             else
    1340 %                 Param.Civ2.GridName='noFile use default';
    1341 %                 Param.Civ2.GridFlag='n';
    1342             end
    1343 %             A=imread(filecell.ima1.civ2{1,1});%read the first image to get the size
    1344 %             sizim=size(A);
    1345             Param.Civ2.ImageInfo=imfinfo(filecell.ima1.civ2{1,1});%read the first image to get the size
    1346             % TODO: case of movie
    1347 %             Param.Civ2.npx=(sizim(2));
    1348 %             Param.Civ2.npy=(sizim(1));     
     1300            end
     1301            ImageInfo=imfinfo(filecell.ima1.civ2{1,1});%read the first image to get the size
     1302            Param.Civ2.ImageWidth=ImageInfo.Width;
     1303            Param.Civ2.ImageHeight=ImageInfo.Height;
     1304            Param.Civ2.ImageBitDepth=ImageInfo.BitDepth;
     1305            % TODO: case of movie   
    13491306            switch CivMode
    13501307                case 'CivX'
     
    32353192set(gcf,'Pointer','arrow')
    32363193
    3237 
     3194%-------------------------------------------------------------------
     3195% ---
     3196function closeview_field(gcbo,eventdata)
     3197hview_field=findobj(allchild(0),'tag','view_field');% look for view_field   
     3198    if ~isempty(hview_field)
     3199        delete(hview_field)
     3200    end
     3201   
     3202   
     3203%------------------------------------------------------------------------   
     3204% call 'view_field.fig' to display the  field selected in the list of 'status'
     3205function open_view_field(hObject, eventdata)
     3206%------------------------------------------------------------------------
     3207list=get(hObject,'String');
     3208index=get(hObject,'Value');
     3209rootroot=get(hObject,'UserData');
     3210filename=list{index};
     3211ind_dot=strfind(filename,'...');
     3212filename=filename(1:ind_dot-1);
     3213filename=fullfile(rootroot,filename);
     3214delete(get(hObject,'parent'))%delete the display figure to stop the check process
     3215if exist(filename,'file')%visualise the vel field if it exists
     3216    uvmat(filename)
     3217    set(gcbo,'Value',1)
     3218end
     3219
     3220%------------------------------------------------------------------------   
     3221% launched by pressing OK on the status figure
     3222function close_GUI(hObject, eventdata)
     3223%------------------------------------------------------------------------
     3224    delete(gcbf)
     3225   
     3226%------------------------------------------------------------------------   
     3227% launched by deleting the status figure
     3228function stop_status(hObject, eventdata)
     3229%------------------------------------------------------------------------
     3230hciv=findobj(allchild(0),'tag','civ');
     3231hhciv=guidata(hciv);
     3232set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ
     3233set(hhciv.status,'BackgroundColor',[0 1 0])
    32383234
    32393235
     
    33513347end
    33523348
    3353 
     3349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     3350% Callbacks in the uipanel Fix1
     3351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    33543352%------------------------------------------------------------------------
    33553353% --- Executes on button press in CheckMask.
     
    33583356maskval=get(handles.CheckMask,'Value');
    33593357if isequal(maskval,0)
    3360     set(handles.txt_MaskName,'String','')
     3358    set(handles.txt_Mask,'String','')
    33613359else
    33623360    mask_displ='no mask'; %default
     
    33913389        set(handles.CheckMask,'Value',1)
    33923390    end
    3393     set(handles.txt_MaskName,'String',mask_displ)
    33943391    set(handles.txt_Mask,'String',mask_displ)
    3395     set(handles.txt_MaskName,'String',mask_displ)
     3392    set(handles.txt_Mask,'String',mask_displ)
     3393    set(handles.txt_Mask,'String',mask_displ)
    33963394end
    33973395
     
    34343432    end
    34353433    set(handles.txt_Mask,'String',mask_displ)
    3436     set(handles.txt_MaskName,'String',mask_displ)
     3434    set(handles.txt_Mask,'String',mask_displ)
    34373435end
    34383436
     
    34433441maskval=get(handles.CheckMask,'Value');
    34443442if isequal(maskval,0)
    3445     set(handles.txt_MaskName,'String','')
     3443    set(handles.txt_Mask,'String','')
    34463444else
    34473445    mask_displ='no mask'; %default
     
    34713469        set(handles.CheckMask,'Value',0)
    34723470    end
    3473     set(handles.txt_MaskName,'String',mask_displ)
     3471    set(handles.txt_Mask,'String',mask_displ)
    34743472end
    34753473
     
    36083606hparent=get(hObject,'parent');
    36093607hchildren=get(hparent,'children');
    3610 handle_txtbox=findobj(hchildren,'tag','txt_GridName');
     3608handle_txtbox=findobj(hchildren,'tag','txt_Grid');
    36113609handle_dx=findobj(hchildren,'tag','num_Dx');
    36123610handle_dy=findobj(hchildren,'tag','num_Dy');
     3611handle_title_dx=findobj(hchildren,'tag','title_Dx');
     3612handle_title_dy=findobj(hchildren,'tag','title_Dy');
    36133613testgrid=0;
    36143614filegrid='';
     
    36393639    set(handle_dx,'Visible','off');
    36403640    set(handle_dy,'Visible','off');
     3641    set(handle_title_dy,'Visible','off');
     3642    set(handle_title_dx,'Visible','off');
    36413643    set(handle_txtbox,'Visible','on')
    36423644    set(handle_txtbox,'String',filegrid)
    36433645else
    36443646    set(hObject,'Value',0);
    3645     set(handle_dx,'Visible','on');
     3647    set(handle_dx,'Visible','on'); 
    36463648    set(handle_dy,'Visible','on');
     3649    set(handle_title_dy,'Visible','on');
     3650    set(handle_title_dx,'Visible','on');
    36473651    set(handle_txtbox,'Visible','off')
    36483652end
    36493653
    36503654%% if hObject is on the checkciv1 frame, duplicate action for checkciv2 frame
    3651 PanelName=get(hparent,'tag');
    3652 if strcmp(PanelName,'panel_Civ1')
     3655PanelName=get(hparent,'tag')
     3656if strcmp(PanelName,'Civ1')
    36533657    hchildren=get(handles.Civ2,'children');
    3654     handle_checkbox=findobj(hchildren,'tag','check_Grid');
    3655     handle_txtbox=findobj(hchildren,'tag','txt_GridName');
     3658    handle_checkbox=findobj(hchildren,'tag','CheckGrid');
     3659    handle_txtbox=findobj(hchildren,'tag','txt_Grid');
    36563660    handle_dx=findobj(hchildren,'tag','num_Dx');
    36573661    handle_dy=findobj(hchildren,'tag','num_Dy');
     3662    handle_title_dx=findobj(hchildren,'tag','title_Dx');
     3663    handle_title_dy=findobj(hchildren,'tag','title_Dy');
    36583664    set(handle_checkbox,'UserData',filegrid);%store for future use
    36593665    if testgrid
     
    36613667        set(handle_dx,'Visible','off');
    36623668        set(handle_dy,'Visible','off');
     3669        set(handle_title_dx,'Visible','off');
     3670        set(handle_title_dy,'Visible','off');
    36633671        set(handle_txtbox,'Visible','on')
    36643672        set(handle_txtbox,'String',filegrid)
    3665     else
    3666         set(handle_checkbox,'Value',0);
    3667         set(handles.CheckGrid,'Value',0);
    3668         set(handle_dx,'Visible','on');
    3669         set(handle_dy,'Visible','on');
    3670         set(handle_txtbox,'Visible','off')
     3673%     else
     3674%         set(handle_checkbox,'Value',0);
     3675%         set(handles.CheckGrid,'Value',0);
     3676%         set(handle_dx,'Visible','on');
     3677%         set(handle_dy,'Visible','on');
     3678%          set(handle_title_dx,'Visible','on');
     3679%         set(handle_title_dy,'Visible','on');
     3680%         set(handle_txtbox,'Visible','off')
    36713681    end
    36723682end
     
    36763686%------------------------------------------------------------------------
    36773687value=get(hObject,'Value');
     3688hparent=get(hObject,'parent');
     3689parent_tag=get(hparent,'Tag');
     3690hchildren=get(hparent,'children');
     3691handle_txtbox=findobj(hchildren,'tag','txt_Mask');
     3692% handle_dx=findobj(hchildren,'tag','num_Dx');
     3693% handle_dy=findobj(hchildren,'tag','num_Dy');
    36783694testmask=0;
    36793695if value
     
    36843700        testmask=1;
    36853701    else % browse for a mask
    3686         filemask=get(handles.CheckMask,'UserData');%look for previous mask name stored as UserData
     3702        filemask=get(hObject,'UserData');%look for previous mask name stored as UserData
    36873703        if exist(filemask,'file')
    36883704            filebase=filemask;
    36893705        end
    3690         [FileName, PathName, filterindex] = uigetfile( ...
     3706        [FileName, PathName] = uigetfile( ...
    36913707            {'*.png', ' (*.png)';
    36923708            '*.png',  '.png files '; ...
     
    36943710            'Pick a mask file *.png',filebase);
    36953711        filemask=fullfile(PathName,FileName);
    3696         set(handles.CheckMask,'UserData',filemask);%store for future use
     3712        set(hObject,'UserData',filemask);%store for future use
    36973713        if ~(isempty(FileName)||isempty(PathName)||isequal(FileName,0)||~exist(filemask,'file'))
    36983714            testmask=1;
     
    37013717end
    37023718if testmask
    3703     set(handles.num_Dx,'Visible','off');
    3704     set(handles.num_Dy,'Visible','off');
    3705     set(handles.num_Dx,'Visible','off');
    3706     set(handles.num_Dy,'Visible','off');
    3707     set(handles.txt_MaskName,'Visible','on')
    3708     set(handles.txt_MaskName,'String',filemask)
    3709 else
    3710     set(handles.CheckMask,'Value',0);
    3711     set(handles.CheckGrid,'Value',0);
    3712     set(handles.num_Dx,'Visible','on');
    3713     set(handles.num_Dy,'Visible','on');
    3714     set(handles.num_Dx,'Visible','on');
    3715     set(handles.num_Dy,'Visible','on');
    3716     set(handles.txt_MaskName,'Visible','off')
     3719    stage=1;%default
     3720    switch parent_tag
     3721%         case 'Fix1'
     3722%             stage=2;
     3723        case 'Civ2'
     3724             stage=3;
     3725%         case 'Fix2'
     3726%             stage=4;
     3727    end
     3728    set(handles.txt_Mask(stage:end),'Visible','on')
     3729    set(handles.txt_Mask(stage:end),'String',filemask)
     3730    set(handles.CheckMask(stage:end),'Value',1)
     3731else
     3732    set(hObject,'Value',0);
     3733    set(handle_txtbox,'Visible','off')
    37173734end
    37183735
     
    39223939        ref_j=1;%default
    39233940    end
    3924     [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]=...
     3941    [filecell,i1,i21,j1,j2,i1_civ2,i2_civ2,j1_civ2,j2_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=...
    39253942        set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]);
    39263943    Data.ListVarName={'ny','nx','A'};
    3927     Data.VarDimName={'ny','nx',{'ny','nx'}};
     3944    Data.VarDimName= {'ny','nx',{'ny','nx'}};
    39283945    Data.A=imread(filecell.ima1.civ1{1});
    39293946    Data.ny=[size(Data.A,1) 1];
    39303947    Data.nx=[1 size(Data.A,2)];
    39313948    par_civ1=read_GUI(handles.Civ1);
    3932     par_civ1.filename_ima_a=filecell.ima1.civ1{1};
    3933     par_civ1.filename_ima_b=filecell.ima2.civ1{1};
    3934     par_civ1.T0=0;
    3935     par_civ1.Dt=1;
     3949    par_civ1.ImageWidth=size(Data.A,1);
     3950    par_civ1.ImageHeight=size(Data.A,2);
     3951    par_civ1.Mask='all';% will provide only the grid set for PIV, no image correlation
    39363952    Param.Civ1=par_civ1;
    3937     Data=civ_uvmat(Param);
    3938     Data.ListVarName=[Data.ListVarName {'ny','nx','A'}];
    3939     Data.VarDimName=[Data.VarDimName {'ny','nx',{'ny','nx'}}];
    3940     Data.A=imread(filecell.ima1.civ1{1});
    3941     Data.ny=[size(Data.A,1) 1];
    3942     Data.nx=[1 size(Data.A,2)];
     3953    Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV
    39433954    hview_field=view_field(Data);
    39443955    set(0,'CurrentFigure',hview_field)
     
    39483959    ViewData.CivHandle=handles.civ;% indicate the handle of the civ GUI in view_field
    39493960    ViewData.axes3.B=imread(filecell.ima2.civ1{1});%store the second image in the UserData of the GUI view_field
    3950     ViewData.axes3.X=Data.Civ1_X; %keep the set of points in memeory
    3951     ViewData.axes3.Y=Data.Civ1_Y;
     3961    ViewData.axes3.X=Grid.Civ1_X; %keep the set of points in memeory
     3962    ViewData.axes3.Y=Grid.Civ1_Y;
    39523963    set(hview_field,'UserData',ViewData)
    39533964    corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display
     
    39703981end
    39713982
    3972 %-------------------------------------------------------------------
    3973 % ---
    3974 function closeview_field(gcbo,eventdata)
    3975 hview_field=findobj(allchild(0),'tag','view_field');% look for view_field   
    3976     if ~isempty(hview_field)
    3977         delete(hview_field)
    3978     end
    3979    
    3980    
    3981 %------------------------------------------------------------------------   
    3982 % call 'view_field.fig' to display the  field selected in the list of 'status'
    3983 function open_view_field(hObject, eventdata)
    3984 %------------------------------------------------------------------------
    3985 list=get(hObject,'String');
    3986 index=get(hObject,'Value');
    3987 rootroot=get(hObject,'UserData');
    3988 filename=list{index};
    3989 ind_dot=findstr(filename,'...');
    3990 filename=filename(1:ind_dot-1);
    3991 filename=fullfile(rootroot,filename);
    3992 delete(get(hObject,'parent'))%delete the display figure to stop the check process
    3993 if exist(filename,'file')%visualise the vel field if it exists
    3994     uvmat(filename)
    3995     set(gcbo,'Value',1)
    3996 end
    3997 
    3998 %------------------------------------------------------------------------   
    3999 % launched by pressing OK on the status figure
    4000 function close_GUI(hObject, eventdata)
    4001 %------------------------------------------------------------------------
    4002     delete(gcbf)
    4003    
    4004 %------------------------------------------------------------------------   
    4005 % launched by deleting the status figure
    4006 function stop_status(hObject, eventdata)
    4007 %------------------------------------------------------------------------
    4008 hciv=findobj(allchild(0),'tag','civ');
    4009 hhciv=guidata(hciv);
    4010 set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ
    4011 set(hhciv.status,'BackgroundColor',[0 1 0])
     3983
     3984%------------------------------------------------------------------------
     3985% --- Executes on button press in CheckThreshold.
     3986function CheckThreshold_Callback(hObject, eventdata, handles)
     3987%------------------------------------------------------------------------
     3988huipanel=get(hObject,'parent');
     3989obj(1)=findobj(huipanel,'Tag','num_MinIma');
     3990obj(2)=findobj(huipanel,'Tag','num_MaxIma');
     3991obj(3)=findobj(huipanel,'Tag','title_Threshold');
     3992if get(hObject,'Value')
     3993    set(obj,'Visible','on')
     3994else
     3995    set(obj,'Visible','off')
     3996end
     3997
    40123998
    40133999%------------------------------------------------------------------------
     
    40394025% end
    40404026
    4041 
    4042 
    4043 
    40444027%------------------------------------------------------------------------
    40454028function cmd=cmd_civ1(filename,Param)
     
    40484031%changes : filename_cmx -> filename ( no extension )
    40494032filename=regexprep(filename,'.nc',''); %file name for the result
    4050 Param.Civ1
    40514033if isequal(Param.Civ1.Dt,'0')
    40524034    Param.Civ1.Dt='1' ;%case of 'displacement' mode
    40534035end
    4054 Param.Civ1.filename_ima_a=regexprep(Param.Civ1.filename_ima_a,'.png','');
    4055 Param.Civ1.filename_ima_b=regexprep(Param.Civ1.filename_ima_b,'.png','');
     4036Param.Civ1.ImageA=regexprep(Param.Civ1.ImageA,'.png','');
     4037Param.Civ1.ImageB=regexprep(Param.Civ1.ImageB,'.png','');
    40564038fid=fopen([filename '.civ1.cmx'],'w');
    40574039fprintf(fid,['##############   CMX file' '\n' ]);
    4058 fprintf(fid,   ['FirstImage ' regexprep(Param.Civ1.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility
    4059 fprintf(fid,   ['LastImage  ' regexprep(Param.Civ1.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility
     4040fprintf(fid,   ['FirstImage ' regexprep(Param.Civ1.ImageA,'\\','\\\\') '\n' ]);% for windows compatibility
     4041fprintf(fid,   ['LastImage  ' regexprep(Param.Civ1.ImageB,'\\','\\\\') '\n' ]);% for windows compatibility
    40604042fprintf(fid,  ['XX' '\n' ]);
    4061 fprintf(fid,  ['Mask ' Param.Civ1.MaskFlag '\n' ]);
    4062 fprintf(fid,  ['MaskName ' regexprep(Param.Civ1.MaskName,'\\','\\\\') '\n' ]);
    4063 fprintf(fid,   ['ImageSize ' num2str(Param.Civ1.ImageInfo.Width) ' ' num2str(Param.Civ1.ImageInfo.Height) '\n' ]);   %VERIFIER CAS GENERAL ?
     4043if isfield(Param.Civ1,'Mask')
     4044    fprintf(fid,  ['Mask ' 'y' '\n' ]);
     4045    fprintf(fid,  ['MaskName ' regexprep(Param.Civ1.Mask,'\\','\\\\') '\n' ]);
     4046else
     4047    fprintf(fid,  ['Mask ' 'n' '\n' ]);
     4048    fprintf(fid,  ['MaskName ' 'noFile use default' '\n' ]);
     4049end
     4050fprintf(fid,   ['ImageSize ' num2str(Param.Civ1.ImageWidth) ' ' num2str(Param.Civ1.ImageHeight) '\n' ]);   %VERIFIER CAS GENERAL ?
    40644051fprintf(fid,   ['CorrelationBoxesSize ' num2str(Param.Civ1.Bx) ' ' num2str(Param.Civ1.By) '\n' ]);
    40654052fprintf(fid,   ['SearchBoxeSize ' num2str(Param.Civ1.Searchx) ' ' num2str(Param.Civ1.Searchy) '\n' ]);
    40664053fprintf(fid,   ['RO ' num2str(Param.Civ1.Rho) '\n' ]);
    4067 if isfield(Param.Civ1,'GridName')
     4054if isfield(Param.Civ1,'Grid')
    40684055    fprintf(fid,   ['GridSpacing ' '25' ' ' '25' '\n' ]);
    40694056else
     
    40714058end
    40724059fprintf(fid,   ['XX 1.0' '\n' ]);
    4073 fprintf(fid,   ['Dt_TO ' num2str(Param.Civ1.Dt) ' ' num2str(Param.Civ1.T0) '\n' ]);
    4074 fprintf(fid,  ['PixCmXY ' num2str(Param.Civ1.pxcmx) ' ' num2str(Param.Civ1.pxcmy) '\n' ]);
     4060fprintf(fid,   ['Dt_TO ' num2str(Param.Civ1.Dt) ' ' num2str(Param.Civ1.Time) '\n' ]);
     4061fprintf(fid,  ['PixCmXY ' '1' ' ' '1' '\n' ]);
    40754062fprintf(fid,  ['XX 1' '\n' ]);
    40764063fprintf(fid,   ['ShiftXY ' num2str(Param.Civ1.Shiftx) ' '  num2str(Param.Civ1.Shifty) '\n' ]);
    4077 if isfield(Param.Civ1,'GridName')
     4064if isfield(Param.Civ1,'Grid')
    40784065    fprintf(fid,  ['Grid ' 'y' '\n' ]);
    4079     fprintf(fid,   ['GridName ' regexprep(Param.Civ1.GridName,'\\','\\\\') '\n' ]);
     4066    fprintf(fid,   ['GridName ' regexprep(Param.Civ1.Grid,'\\','\\\\') '\n' ]);
    40804067else
    40814068    fprintf(fid,  ['Grid ' 'n' '\n' ]);
     
    40954082else% Image threshold  activated
    40964083    if isempty(Param.Civ1.MaxIma)||isnan(Param.Civ1.MaxIma)
    4097         Param.Civ1.MaxIma=2^Param.Civ1.ImageInfo.BitDepth;%take the max image value as upper bound by default
     4084        Param.Civ1.MaxIma=2^Param.Civ1.ImageBitDepth;%take the max image value as upper bound by default
    40984085    end
    40994086    fprintf(fid,  ['SeuilImage y' '\n' ]);
     
    41764163    Param.Civ2.Dt='1' ;%case of 'displacement' mode
    41774164end
    4178 Param.Civ2.filename_ima_a=regexprep(Param.Civ2.filename_ima_a,'.png','');
    4179 Param.Civ2.filename_ima_b=regexprep(Param.Civ2.filename_ima_b,'.png','');% bug : .png appears two times ?
     4165Param.Civ2.ImageA=regexprep(Param.Civ2.ImageA,'.png','');
     4166Param.Civ2.ImageB=regexprep(Param.Civ2.ImageB,'.png','');% bug : .png appears two times ?
    41804167[fid,errormsg]=fopen([filename '.civ2.cmx'],'w');
    41814168if isequal(fid,-1)
     
    41854172end
    41864173fprintf(fid,['##############   CMX file' '\n' ]);
    4187 fprintf(fid,   ['FirstImage ' regexprep(Param.Civ2.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility
    4188 fprintf(fid,   ['LastImage  ' regexprep(Param.Civ2.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility
     4174fprintf(fid,   ['FirstImage ' regexprep(Param.Civ2.ImageA,'\\','\\\\') '\n' ]);% for windows compatibility
     4175fprintf(fid,   ['LastImage  ' regexprep(Param.Civ2.ImageB,'\\','\\\\') '\n' ]);% for windows compatibility
    41894176fprintf(fid,  ['XX' '\n' ]);
    4190 fprintf(fid, ['Mask ' Param.Civ2.MaskFlag '\n' ]);
    4191 fprintf(fid, ['MaskName ' regexprep(Param.Civ2.MaskName,'\\','\\\\') '\n' ]);% for windows compatibility
    4192 fprintf(fid,   ['ImageSize ' num2str(Param.Civ2.ImageInfo.Width) ' ' num2str(Param.Civ2.ImageInfo.Height) '\n' ]); 
     4177if isfield(Param.Civ2,'Mask')
     4178    fprintf(fid,  ['Mask ' 'y' '\n' ]);
     4179    fprintf(fid,  ['MaskName ' regexprep(Param.Civ2.Mask,'\\','\\\\') '\n' ]);
     4180else
     4181    fprintf(fid,  ['Mask ' 'n' '\n' ]);
     4182    fprintf(fid,  ['MaskName ' 'noFile use default' '\n' ]);
     4183end
     4184% fprintf(fid, ['Mask ' Param.Civ2.MaskFlag '\n' ]);
     4185% fprintf(fid, ['MaskName ' regexprep(Param.Civ2.MaskName,'\\','\\\\') '\n' ]);% for windows compatibility
     4186fprintf(fid,   ['ImageSize ' num2str(Param.Civ2.ImageWidth) ' ' num2str(Param.Civ2.ImageHeight) '\n' ]); 
    41934187% fprintf(fid, ['ImageSize ' num2str(Param.Civ2.npx) ' ' num2str(Param.Civ2.npy) '\n' ]);   %VERIFIER CAS GENERAL ?
    41944188fprintf(fid, ['CorrelationBoxesSize ' num2str(Param.Civ2.Bx) ' ' num2str(Param.Civ2.By) '\n' ]);
    41954189fprintf(fid, ['SearchBoxeSize ' num2str(Param.Civ2.Bx) ' ' num2str(Param.Civ2.By) '\n']);
    41964190fprintf(fid, ['RO ' num2str(Param.Civ2.Rho) '\n']);
    4197 if isfield(Param.Civ2,'GridName')
     4191if isfield(Param.Civ2,'Grid')
    41984192    fprintf(fid,   ['GridSpacing ' '25' ' ' '25' '\n' ]);
    41994193else
     
    42024196% fprintf(fid, ['GridSpacing ' num2str(Param.Civ2.Dx) ' ' num2str(Param.Civ2.Dy) '\n']);
    42034197fprintf(fid, ['XX 1.0' '\n' ]);
    4204 fprintf(fid, ['Dt_TO ' num2str(Param.Civ2.Dt) ' ' num2str(Param.Civ2.T0) '\n' ]);
    4205 fprintf(fid, ['PixCmXY ' num2str(Param.Civ2.pxcmx) ' ' num2str(Param.Civ2.pxcmy) '\n' ]);
     4198fprintf(fid, ['Dt_TO ' num2str(Param.Civ2.Dt) ' ' num2str(Param.Civ2.Time) '\n' ]);
     4199fprintf(fid, ['PixCmXY ' '1' ' ' '1' '\n' ]);
    42064200fprintf(fid, ['XX 1' '\n' ]);
    42074201fprintf(fid, 'ShiftXY 0 0\n');
    4208 if isfield(Param.Civ2,'GridName')
     4202if isfield(Param.Civ2,'Grid')
    42094203    fprintf(fid,  ['Grid ' 'y' '\n' ]);
    4210     fprintf(fid,   ['GridName ' regexprep(Param.Civ2.GridName,'\\','\\\\') '\n' ]);
     4204    fprintf(fid,   ['GridName ' regexprep(Param.Civ2.Grid,'\\','\\\\') '\n' ]);
    42114205else
    42124206    fprintf(fid,  ['Grid ' 'n' '\n' ]);
     
    42294223else% Image threshold  activated
    42304224    if isempty(Param.Civ2.MaxIma)||isnan(Param.Civ2.MaxIma)
    4231         Param.Civ2.MaxIma=2^Param.Civ2.ImageInfo.BitDepth;%take the max image value as upper bound by default
     4225        Param.Civ2.MaxIma=2^Param.Civ2.ImageBitDepth;%take the max image value as upper bound by default
    42324226    end
    42334227    fprintf(fid,  ['SeuilImage y' '\n' ]);
     
    42504244
    42514245%------------------------------------------------------------------------
    4252 % --- Executes on button press in CheckThreshold.
    4253 function CheckThreshold_Callback(hObject, eventdata, handles)
    4254 %------------------------------------------------------------------------
    4255 huipanel=get(hObject,'parent');
    4256 obj(1)=findobj(huipanel,'Tag','num_MinIma');
    4257 obj(2)=findobj(huipanel,'Tag','num_MaxIma');
    4258 obj(3)=findobj(huipanel,'Tag','title_Threshold');
    4259 if get(hObject,'Value')
    4260     set(obj,'Visible','on')
    4261 else
    4262     set(obj,'Visible','off')
    4263 end
    4264 
    4265 %------------------------------------------------------------------------
    42664246% --- CheckCiv1  Unified: TO ABADON
    42674247function xml_civ1_parameters=CIV1_CMD_Unified(filename,namelog,par)
     
    42704250%global CivBin%name of the executable for checkciv1 calculation
    42714251
    4272 civ1.image1=par.filename_ima_a;
    4273 civ1.image2=par.filename_ima_b;
     4252civ1.image1=par.ImageA;
     4253civ1.image2=par.ImageB;
    42744254civ1.imageSize_X=par.npx;
    42754255civ1.imageSize_Y=par.npy;
     
    42954275civ1.dt=par.Dt;
    42964276civ1.unit='pixel';
    4297 civ1.absolut_time_T0=par.T0;
    4298 civ1.pixcmx=par.pxcmx;
    4299 civ1.pixcmy=par.pxcmy;
     4277civ1.absolut_time_T0=par.Time;
     4278civ1.pixcmx='1';
     4279civ1.pixcmy='1';
    43004280civ1.convectFlow='n';
    43014281
     
    43114291filename=regexprep(filename,'.nc','');
    43124292
    4313 civ2.image1=par.filename_ima_a;
    4314 civ2.image2=par.filename_ima_b;
     4293civ2.image1=par.ImageA;
     4294civ2.image2=par.ImageB;
    43154295civ2.imageSize_X=par.npx;
    43164296civ2.imageSize_Y=par.npy;
     
    43484328civ2.dt=par.Dt;
    43494329civ2.unit='pixel';
    4350 civ2.absolut_time_T0=par.T0;
    4351 civ2.pixcmx=par.pxcmx;
    4352 civ2.pixcmy=par.pxcmy;
     4330civ2.absolut_time_T0=par.Time;
     4331civ2.pixcmx='1';
     4332civ2.pixcmy='1';
    43534333civ2.convectFlow='n';
    4354 civ2.pixcmx=par.pxcmx;
    4355 civ2.pixcmy=par.pxcmy;
    4356 civ2.convectFlow='n';
  • trunk/src/mouse_motion.m

    r309 r315  
    218218             % case of PIV correlation display
    219219                    if test_piv
    220                         %par=civ('read_param_civ1',hhciv);
    221220                        par=read_GUI(hhciv.Civ1);
    222221                        [dd,ind_pt]=min(abs(Field.X-xy(1,1))+abs(Field.Y-xy(1,2)));
    223222                        xround=Field.X(ind_pt);
    224223                        yround=Field.Y(ind_pt);
    225                         par.PointCoord=[xround size(Field.A,1)-yround+1];
     224                        par.Grid=[xround size(Field.A,1)-yround+1];
    226225                        % mark the correlation box with a rectangle
    227                         par.filename_ima_a=Field.A;
    228                         par.filename_ima_b=Field.B;
     226                        par.ImageA=Field.A;
     227                        par.ImageB=Field.B;
     228                        [par.ImageHeight,par.ImageWidth]=size(par.ImageA);
    229229                        Param.Civ1=par;
    230230                        ibx2=floor((par.Bx-1)/2);
     
    249249                            set(hhhh,'Position',[xround-isx2+shiftx yround-isy2+shifty 2*isx2 2*isy2])
    250250                        end
    251                         %[xtable, ytable, utable, vtable, ctable, typevector, result_conv] = ...
    252                          %               pivlab (Field.A,Field.B,ibx2,iby2,isx2,isy2,shiftx,shifty,[xround size(Field.A,1)-yround+1], 1, []);
    253                         [Data,errormsg,result_conv]= civ_matlab(Param)
     251                        [Data,errormsg,result_conv]= civ_matlab(Param);
    254252                        rangx(1)=-(isx2-ibx2)+shiftx;
    255253                        rangx(2)=isx2-ibx2+shiftx;
     
    268266                                set(0,'CurrentFigure',corrfig(1))
    269267                                AxeData.CurrentCorrImage=imagesc(rangx,-rangy,result_conv,[0 1]);
    270                                 AxeData.CurrentVector=line([0 Data.Civ1_U],[0 -Data.Civ1_V],'Tag','vector');
    271                                
     268                                AxeData.CurrentVector=line([0 Data.Civ1_U],[0 Data.Civ1_V],'Tag','vector');               
    272269                                colorbar
    273270                                set(haxes,'UserData',AxeData)
     
    278275                            set(AxeData.CurrentCorrImage,'XData',rangx)
    279276                            set(AxeData.CurrentCorrImage,'YData',-rangy)
    280                             set(AxeData.CurrentVector,'XData',[0 Data.Civ1_U],'YData',[0 -Data.Civ1_V])
     277                            set(AxeData.CurrentVector,'XData',[0 Data.Civ1_U],'YData',[0 Data.Civ1_V])
    281278                        end
    282279                    end
  • trunk/src/set_col_vec.m

    r313 r315  
    1010            % colcode.CName: 'ima_cor','black','white',...
    1111            % colcode.ListColorCode ='black', 'white', 'rgb','brg', '64 colors'
    12             % colcode.FixedCbounds =0; thresholds scaling relative to min and max, =1 fixed thresholds
    13             % colcode.MinC; min
    14             % colcode.MaxC; max
     12            % colcode.CheckFixVecColor =0; thresholds scaling relative to min and max, =1 fixed thresholds
     13            % colcode.MinVec; min
     14            % colcode.MaxVec; max
    1515            % colcode.ColCode1: first threshold for rgb, relative to min (0) and max (1)
    1616            % colcode.ColCode2: second threshold for rgb, relative to min (0) and max (1),
     
    1919% vec_C: matlab vector representing the scalar setting the color
    2020function [colorlist,col_vec,colcode_out]=set_col_vec(colcode,vec_C)
    21 
    2221col_vec=[];
    2322colcode_out=colcode;%default
     
    6160    col_vec=ones(size(vec_C));%all vectors at color#1
    6261elseif strcmp(colcode.ListColorCode,'rgb')|| strcmp(colcode.ListColorCode,'bgr')% 3 color representation
    63     ind1=find(vec_C < ColCode1); % =1 for red vectors
     62%    ind1=find(vec_C < ColCode1); % =1 for red vectors
    6463    ind_green=find((vec_C >= ColCode1) & (vec_C < ColCode2));% =1 for green vectors
    65     ind3=find(vec_C >= ColCode2);% =1 for blue vectors
     64%     ind3=find(vec_C >= ColCode2);% =1 for blue vectors
    6665    colorlist(2,:)=[0 1 0];%green
    67     col_vec(ind1)=1;
     66    col_vec(vec_C < ColCode1)=1;
    6867    col_vec(ind_green)=2;
    69     col_vec(ind3)=3;
     68    col_vec(vec_C >= ColCode2)=3;
    7069    if strcmp(colcode.ListColorCode,'rgb')
    7170        colorlist(1,:)=[1 0 0];%red
  • trunk/src/set_grid.m

    r84 r315  
    3232                   'gui_LayoutFcn',  [] , ...
    3333                   'gui_Callback',   []);
    34 if nargin & isstr(varargin{1})
     34% if nargin & isstr(varargin{1})
     35%     gui_State.gui_Callback = str2func(varargin{1});
     36% end
     37if nargin && ischar(varargin{1})
    3538    gui_State.gui_Callback = str2func(varargin{1});
    3639end
    37 
    3840if nargout
    3941    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
  • trunk/src/uvmat.m

    r309 r315  
    932932%% view the field 
    933933run0_Callback(hObject, eventdata, handles); %view field
    934 mask_test=get(handles.mask_test,'value');
     934mask_test=get(handles.CheckMask,'value');
    935935if mask_test
    936     MaskData=get(handles.mask_test,'UserData');
     936    MaskData=get(handles.CheckMask,'UserData');
    937937    if isfield(MaskData,'maskhandle') && ishandle(MaskData.maskhandle)
    938938          delete(MaskData.maskhandle)    %delete old mask
    939939    end
    940     mask_test_Callback(hObject, eventdata, handles)
     940    CheckMask_Callback(hObject, eventdata, handles)
    941941end
    942942
     
    14531453
    14541454%------------------------------------------------------------------------
    1455 % --- Executes on button press in mask_test.
    1456 function mask_test_Callback(hObject, eventdata, handles)
     1455% --- Executes on button press in CheckMask.
     1456function CheckMask_Callback(hObject, eventdata, handles)
    14571457%------------------------------------------------------------------------
    14581458%case of view mask selection
    1459 if isequal(get(handles.mask_test,'Value'),1)
     1459if isequal(get(handles.CheckMask,'Value'),1)
    14601460    [FF,RootPath,FileBase]=read_file_boxes(handles);
    14611461    num_i1=stra2num(get(handles.i1,'String'));
     
    14991499                set(handles.nb_slice,'String',Name(i+1:ind_mask-1));
    15001500                set(handles.nb_slice,'BackgroundColor',[1 1 0])
    1501                 set(handles.mask_test,'UserData',Mask);
    1502                 set(handles.mask_test,'BackgroundColor',[1 1 0])
     1501                set(handles.CheckMask,'UserData',Mask);
     1502                set(handles.CheckMask,'BackgroundColor',[1 1 0])
    15031503                if nbslice > 1
    15041504                    set(handles.slices,'value',1)
     
    15221522        Mask.Base=fullfile(RootDir,RootFile);
    15231523        Mask.NbSlice=1;
    1524         set(handles.mask_test,'UserData',Mask);
    1525         set(handles.mask_test,'BackgroundColor',[1 1 0])
     1524        set(handles.CheckMask,'UserData',Mask);
     1525        set(handles.CheckMask,'BackgroundColor',[1 1 0])
    15261526    end
    15271527    if isempty(errormsg)
     
    15291529    end
    15301530    if ~isempty(errormsg)
    1531             set(handles.mask_test,'Value',0)
    1532             set(handles.mask_test,'BackgroundColor',[0.7 0.7 0.7])
     1531            set(handles.CheckMask,'Value',0)
     1532            set(handles.CheckMask,'BackgroundColor',[0.7 0.7 0.7])
    15331533     end
    1534 else
    1535     MaskData=get(handles.mask_test,'UserData');
     1534else % desactivate mask display
     1535    MaskData=get(handles.CheckMask,'UserData');
    15361536    if isfield(MaskData,'maskhandle') && ishandle(MaskData.maskhandle)
    15371537          delete(MaskData.maskhandle)   
    15381538    end
    1539     set(handles.mask_test,'UserData',[])   
     1539    set(handles.CheckMask,'UserData',[])   
    15401540    UvData=get(handles.uvmat,'UserData');
    15411541    if isfield(UvData,'MaskName')
     
    15431543        set(handles.uvmat,'UserData',UvData)
    15441544    end
    1545     set(handles.mask_test,'BackgroundColor',[0.7 0.7 0.7])
     1545    set(handles.CheckMask,'BackgroundColor',[0.7 0.7 0.7])
    15461546end
    15471547
     
    15501550%------------------------------------------------------------------------
    15511551errormsg=[];%default
    1552 MaskData=get(handles.mask_test,'UserData');
     1552MaskData=get(handles.CheckMask,'UserData');
    15531553if isfield(MaskData,'maskhandle')&& ishandle(MaskData.maskhandle)
    15541554    uistack(MaskData.maskhandle,'top');
     
    15561556num_i1_mask=mod(num_i1-1,MaskData.NbSlice)+1;
    15571557MaskName=name_generator(MaskData.Base,num_i1_mask,num_j1,'.png',MaskData.NomType);
    1558 huvmat=get(handles.mask_test,'parent');
     1558huvmat=get(handles.CheckMask,'parent');
    15591559UvData=get(huvmat,'UserData');
    15601560
     
    16231623            MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*flagmask);
    16241624%             set(MaskData.maskhandle,'AlphaData',0.6*flagmask)
    1625             set(handles.mask_test,'UserData',MaskData)
     1625            set(handles.CheckMask,'UserData',MaskData)
    16261626        end
    16271627    end
     
    25562556
    25572557% second projection object (view_field display)
    2558 % IndexObj_2=get(handles.list_object_2,'Value');%selected projection object for the second view
    2559 % if IndexObj_2==0
    2560 %     IndexObj_2=1;
    2561 % end
    2562 %if isequal(get(handles.list_object_2,'Visible'),'on') && IndexObj_2 <= numel(UvData.Object)&& ~isempty(UvData.Object{IndexObj_2})
    2563  if length( IndexObj)>=2
    2564 %      IndexObj(2)=IndexObj_2;
     2558if length( IndexObj)>=2
    25652559    view_field_handle=findobj(allchild(0),'tag','view_field');%handles of the view_field GUI
    25662560    if ~isempty(view_field_handle)
     
    25792573    [ObjectData,errormsg]=proj_field(UvData.Field,UvData.Object{iobj});% project field on the object
    25802574    if testnewseries && isfield(ObjectData,'CoordUnit')&& isfield(PlotParam{imap},'Coordinates')
    2581         PlotParam{imap}=rmfield(PlotParam{imap}.Coordinates,'CheckFixEqual'); %set FixEqual to depend on the field (=1 if Data.CoordUnit=1 in plot_field)
     2575        PlotParam{imap}.Coordinates=rmfield(PlotParam{imap}.Coordinates,'CheckFixEqual'); %set FixEqual to depend on the field (=1 if Data.CoordUnit=1 in plot_field)
    25822576    end
    25832577    if ~isempty(errormsg)
     
    26512645
    26522646%% update the mask
    2653 if isequal(get(handles.mask_test,'Value'),1)%if the mask option is on
     2647if isequal(get(handles.CheckMask,'Value'),1)%if the mask option is on
    26542648   update_mask(handles,num_i1,num_i2);
    26552649end
     
    38183812     UvData.Object=UvData.Object(1);
    38193813end
    3820 list_object=get(handles.ListObject,'String');
     3814%list_object=get(handles.ListObject,'String');
    38213815set(handles.ListObject,'Value',1)
    38223816set(handles.ListObject,'String',{''})
     
    38263820
    38273821%delete mask if it is displayed
    3828 if isequal(get(handles.mask_test,'Value'),1)%if the mask option is on
     3822if isequal(get(handles.CheckMask,'Value'),1)%if the mask option is on
    38293823   UvData=rmfield(UvData,'MaskName'); %will impose mask refresh 
    38303824end
     
    38323826run0_Callback(hObject, eventdata, handles)
    38333827
    3834 %--------------------------------------------
     3828%------------------------------------------------------------------------
    38353829function histo1_menu_Callback(hObject, eventdata, handles)
    38363830%--------------------------------------------
     
    38423836update_histo(handles.histo_u,huvmat,FieldName)
    38433837
    3844 %----------------------------------------------
     3838%------------------------------------------------------------------------
    38453839function histo2_menu_Callback(hObject, eventdata, handles)
    3846 %----------------------------------------------
     3840%------------------------------------------------------------------------
    38473841%plot second histo
    38483842huvmat=get(handles.histo2_menu,'parent');
     
    38523846update_histo(handles.histo_v,huvmat,FieldName)
    38533847
    3854 
    3855 %--------------------------------------------
     3848%------------------------------------------------------------------------
    38563849%read the field .Fieldname stored in UvData and plot its histogram
    38573850function update_histo(haxes,huvmat,FieldName)
     3851%------------------------------------------------------------------------
    38583852UvData=get(huvmat,'UserData');
    38593853if ~isfield(UvData.Field,FieldName)
     
    41084102list=get(handles.ListColorCode,'String');
    41094103ichoice=get(handles.ListColorCode,'Value');
    4110 colcode.ColorCode=list{ichoice};
    4111 colcode.MinC=str2num(get(handles.num_MinVec,'String'));
    4112 colcode.MaxC=str2num(get(handles.num_MaxVec,'String'));
    4113 test3color=strcmp(colcode.ColorCode,'rgb') || strcmp(colcode.ColorCode,'bgr');
     4104colcode.ListColorCode=list{ichoice};
     4105colcode.MinVec=str2num(get(handles.num_MinVec,'String'));
     4106colcode.MaxVec=str2num(get(handles.num_MaxVec,'String'));
     4107test3color=strcmp(colcode.ListColorCode,'rgb') || strcmp(colcode.ListColorCode,'bgr');
    41144108if test3color
    4115     colcode.colcode1=str2num(get(handles.num_ColCode1,'String'));
    4116     colcode.colcode2=str2num(get(handles.num_ColCode2,'String'));
    4117 end
    4118 colcode.FixedCbounds=0;
    4119 colcode.FixedCbounds=1;
    4120 vec_C=colcode.MinC+(colcode.MaxC-colcode.MinC)*(0.5:width-0.5)/width;%sample of vec_C values from min to max
     4109    colcode.ColCode1=str2num(get(handles.num_ColCode1,'String'));
     4110    colcode.ColCode2=str2num(get(handles.num_ColCode2,'String'));
     4111end
     4112% colcode.FixedCbounds=0;
     4113%colcode.CheckFixVecColor=1;
     4114vec_C=colcode.MinVec+(colcode.MaxVec-colcode.MinVec)*(0.5:width-0.5)/width;%sample of vec_C values from min to max
    41214115[colorlist,col_vec]=set_col_vec(colcode,vec_C);
    41224116oneheight=ones(1,height);
     
    41384132write_plot_param(handles,PlotParamOut); %update the auto plot parameters
    41394133
    4140 %-------------------------------------------------------------------
    4141 % --- Executes on button press in grid.
    4142 function grid_Callback(hObject, eventdata, handles)
     4134% %-------------------------------------------------------------------
     4135% % --- Executes on button press in grid.
     4136% function grid_Callback(hObject, eventdata, handles)
    41434137
    41444138
  • trunk/src/view_field.m

    r302 r315  
    280280% --- Executes on button press in FixEqual.
    281281function CheckFixEqual_Callback(hObject, eventdata, handles)
    282 test=get(handles.FixEqual,'Value');
     282test=get(handles.CheckFixEqual,'Value');
    283283if test
    284284    set(handles.CheckFixEqual,'BackgroundColor',[1 1 0])
Note: See TracChangeset for help on using the changeset viewer.