Changeset 41


Ignore:
Timestamp:
Mar 10, 2010, 11:03:36 AM (11 years ago)
Author:
sommeria
Message:

-relabel_i_j: improve the question dlg box for image transform
-aver_stat,time_series,merge_proj: include modification of field transform and call of set_object.
-series: introduce a browser for set_object
-ima2vol: create volume images (png images of a slice concacened along y) for PIV 3D
-set_object: suppress TITLE, introduce Tooltip helps for parameters
-civ: fixed bug on BATCH sequences

Location:
trunk/src
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r39 r41  
    721721
    722722        %%%%%%%%%%%  set the menus of image pairs and default selection for civ   %%%%%%%%%%%%%%%%%%%
    723 if isequal(nom_type_ima,'_i')| isequal(nom_type_nc,'_i1-i2')|~exist('nbfield2','var')|(nbfield2==1)
     723if isequal(nom_type_ima,'_i')|| isequal(nom_type_nc,'_i1-i2')||~(exist('nbfield2','var')&&(nbfield2~=1))
    724724    set(handles.mode,'String',{'series(Di)'})
    725725    set(handles.mode,'Value',1)
    726 elseif isequal(nom_type_ima,'png_old')|isequal(nom_type_nc,'netc_old')
     726elseif isequal(nom_type_ima,'png_old')||isequal(nom_type_nc,'netc_old')
    727727    set(handles.mode,'String',{'pair j1-j2'})
    728728    set(handles.mode,'Value',1)
     
    732732else
    733733    set(handles.mode,'String',{'pair j1-j2';'series(Dj)';'series(Di)'})%multiple choice
    734     if isequal(mode,'volume')
    735         set(handles.mode,'Value',3)
    736     elseif nbfield2 <= 5
    737         set(handles.mode,'Value',1)% advice 'pair j1-j2' for small bursts
    738     else
    739         set(handles.mode,'Value',2)% advice series Dj for long bursts, not volume
    740     end
     734    if nbfield2 <= 5
     735         set(handles.mode,'Value',1)% advice 'pair j1-j2' for small burst
     736    end
     737%     else
     738%     if isequal(mode,'volume')
     739%         set(handles.mode,'Value',3)
     740%     elseif nbfield2 <= 5
     741%         set(handles.mode,'Value',1)% advice 'pair j1-j2' for small bursts
     742%     else
     743%         set(handles.mode,'Value',2)% advice series Dj for long bursts, not volume
     744%     end
    741745end
    742746
     
    13311335list_civ1=get(handles.list_pair_civ1,'String');
    13321336index_civ1=get(handles.list_pair_civ1,'Value');
    1333 [num_i,num_j]=meshgrid(num_i,num_j);
    13341337str_civ1=list_civ1{index_civ1};%string defining the image pairs for civ1
    13351338if isempty(str_civ1)||isequal(str_civ1,'')
     
    14571460end
    14581461
     1462
    14591463%------------------------------------------------------------------------
    14601464% --- Executes on selection change in list_pair_civ1.
     
    16601664[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]=...
    16611665       set_civ_filenames(handles,compare,box_test);
    1662 nbfield=size(num1_civ1,2);
    1663 nbslice=size(num1_civ1,1);
     1666nbfield=numel(num1_civ1);
     1667nbslice=size(num_a_civ1);
    16641668
    16651669if isempty(filecell)
     
    21792183[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]=...
    21802184       set_civ_filenames(handles,compare,box_test);
     2185 
    21812186display('files OK, processing...') 
    2182 nbfield=size(num1_civ1,2);
    2183 nbslice=size(num1_civ1,1);
     2187nbfield=numel(num1_civ1);
     2188nbslice=numel(num_a_civ1);
    21842189
    21852190%GET PARAMETERS:
     
    23142319time=get(handles.displ_filebase,'UserData'); %get the set of times
    23152320civAll=get(handles.Experimental,'Value'); % Boolean for new civ excution method
     2321'TESTbatch'
     2322size(filecell.nc.civ1)
     2323nbslice
     2324nbfield
    23162325for ifile=1:nbfield
    23172326    for j=1:nbslice
     
    23302339        end
    23312340%         filecell.nc.civ1
    2332         filename_cmx=cell2mat(filecell.nc.civ1(ifile,j));%output netcdf file
    2333         filename_cmx([end-1:end])='cm';%name of cmx file
     2341        filename_cmx=filecell.nc.civ1{ifile,j}%output netcdf file
     2342        filename_cmx(end-1:end)='cm';%name of cmx file
    23342343        filename_cmx=[filename_cmx 'x'];
    23352344       
    23362345   %CIV1
    23372346        if box_test(1)==1
    2338             par_civ1.filename_ima_a=cell2mat(filecell.ima1.civ1(ifile,j));
     2347            par_civ1.filename_ima_a=filecell.ima1.civ1{ifile,j};
    23392348           % par_civ1.filename_ima_a([end-3:end])=[];%remove .png extension
    2340             par_civ1.filename_ima_b=cell2mat(filecell.ima2.civ1(ifile,j));
     2349            par_civ1.filename_ima_b=filecell.ima2.civ1{ifile,j};
    23412350           % par_civ1.filename_ima_b([end-3:end])=[];%remove .png extension
    23422351         
     
    27412750%         .ncA.civ1{i,j}, .ncA.civ2{i,j}; set of nc files for PIV results with camA (then .nc corresponds to camB)
    27422751%         .st{i,j};   set of nc files for the combined stereo fields
     2752% num1_civ1(i),num2_civ1(i): lists of first and last i indices for civ1
     2753% num_a_civ1(j),num_b_civ1(j): lists of first and last j indices for civ1
     2754% num1_civ2(i),num2_civ2(i): lists of first and last i indices for civ2
     2755% num_a_civ2(j),num_b_civ2(j): lists of first and last j indices for civ2
     2756% nom_type_nc: nomenclature type for velocity files
     2757% file_ref_fix1,file_ref_fix2: reference files possibly used by Fix1 and 2
    27432758function [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]=...
    27442759    set_civ_filenames(handles,compare,box_test)
  • trunk/src/series.m

    r39 r41  
    12951295        end
    12961296end
    1297 %---------------------------------------------------
     1297
     1298%------------------------------------------------------------------------
    12981299% --- Executes on button press in RUN.
    1299 %------------------------------------------------------
    13001300function RUN_Callback(hObject, eventdata, handles)
    1301 
     1301%------------------------------------------------------------------------
    13021302%read root name and field type
    13031303set(handles.RUN,'BusyAction','queue');
     
    13111311end
    13121312SeriesData=get(handles.figure1,'UserData');
    1313 if isfield(SeriesData,'sethandles')
    1314     if iscell(SeriesData.sethandles)
    1315         Series.sethandles=SeriesData.sethandles{1};
    1316     else
    1317         Series.sethandles=SeriesData.sethandles;%retrieve the handles of the set_object interface (to define projection objects)
    1318     end
    1319 end
     1313% if isfield(SeriesData,'sethandles')
     1314%     if iscell(SeriesData.sethandles)
     1315%         Series.sethandles=SeriesData.sethandles{1};
     1316%     else
     1317%         Series.sethandles=SeriesData.sethandles;%retrieve the handles of the set_object interface (to define projection objects)
     1318%     end
     1319% end
    13201320
    13211321%reinitiate waitbar position
     
    13581358Series.CoordType='';%default
    13591359if isequal(menu_coord_state,'on')
    1360     menu_coord=get(handles.transform_fct,'String');
     1360%     menu_coord=get(handles.transform_fct,'String');
    13611361    menu_index=get(handles.transform_fct,'Value');
    1362     Series.CoordType=menu_coord{menu_index};
    1363 end
    1364 Series.hseries=get(hObject,'Parent');
    1365 if isequal(get(handles.ParamVal,'Visible'),'on')
    1366     ParamKey=get(handles.ParamKey,'String');
    1367     if ischar(ParamKey)
    1368         ParamKey{1}=ParamKey;
    1369     end
    1370     ParamString=get(handles.ParamVal,'String');
    1371     if ischar(ParamString)
    1372         for ilist=1:size(ParamString,1)
    1373             ParamVal{ilist}=ParamString(ilist,:);
    1374         end
    1375     else
    1376         ParamVal=ParamString;
    1377     end   
    1378 end
     1362    transform_list=get(handles.transform_fct,'UserData');
     1363    Series.transform_fct=transform_list{menu_index};% transform function handles
     1364end
     1365Series.hseries=handles.figure1; % handles to the series GUI
     1366% if isequal(get(handles.ParamVal,'Visible'),'on')
     1367%     ParamKey=get(handles.ParamKey,'String');
     1368%     if ischar(ParamKey)
     1369%         ParamKey{1}=ParamKey;
     1370%     end
     1371%     ParamString=get(handles.ParamVal,'String');
     1372%     if ischar(ParamString)
     1373%         for ilist=1:size(ParamString,1)
     1374%             ParamVal{ilist}=ParamString(ilist,:);
     1375%         end
     1376%     else
     1377%         ParamVal=ParamString;
     1378%     end   
     1379% end
    13791380
    13801381%read the set of field numbers
     
    14821483end
    14831484
    1484 % RUN RUN'
     1485% defining the ACTION function handle
    14851486path_series=which('series');
    14861487list_path=get(handles.ACTION,'UserData');
     
    14891490if ~isequal(fct_path,path_series)
    14901491    eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION
    1491     if ~isequal(spath,fct_path)& exist(fct_path,'dir')
     1492    if ~exist(fct_path,'dir')
     1493        msgbox_uvmat('ERROR',['The prescibed function path ' fct_path ' does not exist'])
     1494        return
     1495    end
     1496    if ~isequal(spath,fct_path)
    14921497        addpath(fct_path)% add the prescribed path if not the current one
    14931498    end
    14941499end
    1495 % fct_path
    1496 eval(['h_fun=@' action ';'])
     1500eval(['h_fun=@' action ';'])%create a function handle for ACTION
    14971501if ~isequal(fct_path,path_series)
    14981502        rmpath(fct_path)% add the prescribed path if not the current one   
    14991503end
    15001504
     1505% RUN ACTION
    15011506Series.Action=action;%name of the processing programme
    15021507set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
    15031508drawnow
    15041509if length(RootPath)>1
    1505 %    feval(action,num_i1_cell,num_i2_cell,num_j1_cell,num_j2_cell,Series);
    15061510    h_fun(num_i1_cell,num_i2_cell,num_j1_cell,num_j2_cell,Series);
    15071511else
    15081512    h_fun(num_i1,num_i2,num_j1,num_j2,Series);
    1509 %     feval(action,num_i1,num_i2,num_j1,num_j2,Series);
    15101513end
    15111514set(handles.RUN,'BackgroundColor',[1 0 0])
     
    15251528% saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER  .xml)
    15261529
    1527 %----------------------------------------------------
     1530%------------------------------------------------------------------------
    15281531function STOP_Callback(hObject, eventdata, handles)
     1532%------------------------------------------------------------------------
    15291533set(handles.RUN, 'BusyAction','cancel')
    15301534set(handles.RUN,'BackgroundColor',[1 0 0])
    15311535
    1532 %----------------------------------------------
    1533 
    1534 %----------------------------------------------------
     1536
     1537%------------------------------------------------------------------------
    15351538function first_i_Callback(hObject, eventdata, handles)
     1539%------------------------------------------------------------------------
    15361540last_i_Callback(hObject, eventdata, handles)
    15371541
    1538 %----------------------------------------------
     1542%------------------------------------------------------------------------
    15391543function last_i_Callback(hObject, eventdata, handles)
     1544%------------------------------------------------------------------------
    15401545%     hseries=get(handles.last_i,'parent');
    15411546first_i=str2num(get(handles.first_i,'String'));
     
    15501555displ_time(handles,SeriesData.Time{1});
    15511556
    1552 %-------------------------------------------------------
     1557%------------------------------------------------------------------------
    15531558function first_j_Callback(hObject, eventdata, handles)
     1559%------------------------------------------------------------------------
    15541560 last_j_Callback(hObject, eventdata, handles)
    15551561
    1556 %-------------------------------------------------------
     1562%------------------------------------------------------------------------
    15571563function last_j_Callback(hObject, eventdata, handles)
    1558    % hseries=get(handles.last_i,'parent');
     1564%------------------------------------------------------------------------
    15591565first_j=str2num(get(handles.first_j,'String'));
    15601566last_j=str2num(get(handles.last_j,'String'));
    15611567ref_j=ceil((first_j+last_j)/2);
    15621568set(handles.ref_j,'String', num2str(ref_j))
    1563 
    15641569ref_j_Callback(hObject, eventdata, handles)
    15651570SeriesData=get(handles.figure1,'UserData');
     
    15701575
    15711576
    1572 
    1573 
    1574 %-------------------------------------------------------
     1577%------------------------------------------------------------------------
    15751578function ref_i_Callback(hObject, eventdata, handles)
     1579%------------------------------------------------------------------------
    15761580mode_list=get(handles.mode,'String');
    15771581mode_value=get(handles.mode,'Value');
     
    15931597end
    15941598
    1595 %----------------------------------------------------
     1599%------------------------------------------------------------------------
    15961600function ref_j_Callback(hObject, eventdata, handles)
     1601%------------------------------------------------------------------------
    15971602mode_list=get(handles.mode,'String');
    15981603mode_value=get(handles.mode,'Value');
     
    16111616end
    16121617
    1613 %----------------------------------------------------
     1618%------------------------------------------------------------------------
    16141619% --- Executes on selection change in ACTION.
    16151620function ACTION_Callback(hObject, eventdata, handles)
     1621%------------------------------------------------------------------------
    16161622global nb_builtin
    16171623list_ACTION=get(handles.ACTION,'String');% list menu fields
     
    17101716set(handles.transform_fct,'Enable','off')
    17111717%set the displayed GUI item needed for input parameters
    1712 %list_input=feval(ACTION);% input list asked by the selected function
    17131718if ~isequal(path_series,PathName)
    17141719    addpath(PathName)
     
    17201725
    17211726varargout=h_function();
    1722 %varargout=feval(ACTION);% input list asked by the selected function
    17231727Param_list={};
    1724 % RootPath=get(handles.RootPath,'String');
    1725 % RootFile=get(handles.RootFile,'String');
    17261728
    17271729%nb_series=length(RootFile);
     
    18391841end
    18401842
    1841 %-------------------------------------------------------------------
     1843%------------------------------------------------------------------------
    18421844% --- Executes on selection change in FieldMenu.
    1843 %-------------------------------------------------------------------
    18441845function FieldMenu_Callback(hObject, eventdata, handles)
    1845 
     1846%------------------------------------------------------------------------
    18461847field_str=get(handles.FieldMenu,'String');
    18471848field_index=get(handles.FieldMenu,'Value');
     
    18681869end
    18691870
    1870 %------------------------------------------------------
     1871%------------------------------------------------------------------------
    18711872% --- Executes on selection change in FieldMenu_1.
    1872 %-----------------------------------------------------
    18731873function FieldMenu_1_Callback(hObject, eventdata, handles)
     1874%------------------------------------------------------------------------
    18741875field_str=get(handles.FieldMenu_1,'String');
    18751876field_index=get(handles.FieldMenu_1,'Value');
     
    18961897     update_menu(handles.FieldMenu_1,scalar)
    18971898end   
    1898 
    1899 
    1900 % %group the variables (fields of 'FieldData') in cells of variables with the same dimensions
    1901 % %%%%%%%%%%%%%%%%%%%%%%% Function independante maintenant
    1902 % %-----------------------------------------------------------------
    1903 % [CellVarIndex,NbDim,VarTypeCell]=find_field_indices(Data{1});
    1904 % %LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS
    1905 % % CellVarIndex=cells of variable index arrays
    1906 % ivar_new=0; % index of the current variable in the projected field
    1907 % icoord=0;
    1908 % for icell=1:length(CellVarIndex)
    1909 %     if NbDim(icell)==1
    1910 %         continue
    1911 %     end
    1912 %     VarIndex=CellVarIndex{icell};%  indices of the selected variables in the list FieldData.ListVarName
    1913 %     VarType=VarTypeCell{icell};
    1914 %     ivar_X=VarType.coord_x;
    1915 %     ivar_Y=VarType.coord_y;
    1916 %     ivar_FF=VarType.errorflag;
    1917 %     if isempty(ivar_X)
    1918 %         test_grid=1;%test for input data on regular grid (e.g. image)coordinates
    1919 %     else
    1920 %         if length(ivar_Y)~=1
    1921 %                 warndlg_uvmat('y coordinate missing in proj_field.m','ERROR')
    1922 %                 return
    1923 %         end
    1924 %         test_grid=0;
    1925 %     end
    1926 % %    DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell)
    1927 %     %case of input fields with unstructured coordinates
    1928 %     if ~test_grid
    1929 %         for ivar=VarIndex
    1930 %             VarName=MergeData.ListVarName{ivar};
    1931 %             for iview=1:nbview
    1932 %                 eval(['MergeData.' VarName '=[MergeData.' VarName '; Data{iview}.' VarName ';'])
    1933 %             end
    1934 %         end
    1935 %     %case of fields defined on a structured  grid
    1936 %     else 
    1937 % %        DimValue=MergeData.DimValue(DimIndices);%set of dimension values
    1938 %         testFF=0;
    1939 %         for iview=2:nbview
    1940 % %             if ~isequal(DimValue,Data{iview}.DimValue(DimIndices))
    1941 % %                 MergeData.Txt='ERROR: attempt at merging structured fields with different sizes';
    1942 % %                 return
    1943 % %             end
    1944 %             for ivar=VarIndex
    1945 %                 VarName=MergeData.ListVarName{ivar};
    1946 %                 if isfield(MergeData,'VarAttribute')
    1947 %                     if length(MergeData.VarAttribute)>=ivar && isfield(MergeData.VarAttribute{ivar},'Role') && isequal(MergeData.VarAttribute{ivar}.Role,'errorflag')
    1948 %                         testFF=1;
    1949 %                     end
    1950 %                 end
    1951 %                 eval(['MergeData.' VarName '=MergeData.' VarName '+ Data{iview}.' VarName ';'])
    1952 %             end
    1953 %         end
    1954 %         if testFF
    1955 %             nbaver=nbview-MergeData.FF;
    1956 %             indgood=find(nbaver>0);
    1957 %             for ivar=VarIndex
    1958 %                 VarName=MergeData.ListVarName{ivar};
    1959 %                 eval(['MergeData.' VarName '(indgood)=double(MergeData.' VarName '(indgood))./nbaver(indgood);'])
    1960 %             end
    1961 %         else
    1962 %             for ivar=VarIndex
    1963 %                 VarName=MergeData.ListVarName{ivar};
    1964 %                 eval(['MergeData.' VarName '=double(MergeData.' VarName ')./nbview;'])
    1965 %             end   
    1966 %         end
    1967 %     end
    1968 % end
    1969 %     
    19701899
    19711900%-----------------------------
     
    20451974end
    20461975
    2047  
    2048 %-----------------------------------------------------------
    2049 % find the times corresponding to the first and last indices of a series
    2050 %
     1976%------------------------------------------------------------------------
     1977% ---- find the times corresponding to the first and last indices of a series
    20511978function displ_time(handles,times)
     1979%------------------------------------------------------------------------
    20521980hseries=get(handles.last_i,'parent');
    20531981SeriesData=get(hseries,'UserData');%
     
    21462074set(handles.time_last,'String',time_last_cell);
    21472075
    2148 %--------------------------------------------------------------------
    2149 % --- Executes on selection change in VelTypeMenu.
    2150 function VelTypeMenu_Callback(hObject, eventdata, handles)
    2151 % VelTypeList=get(handles.VelTypeMenu,'String');
    2152 % VelTypeIndex=get(handles.VelTypeMenu,'Value');
    2153 % VelTypeCell=get(handles.VelType,'String');
    2154 % VelTypeCell{1}=VelTypeList{VelTypeIndex};
    2155 % set(handles.VelType,'String',VelTypeCell)
    2156 
    2157 
    2158 %--------------------------------------------------------------------
     2076%------------------------------------------------------------------------
    21592077% --- Executes on button press in GetObject.
    21602078function GetObject_Callback(hObject, eventdata, handles)
     2079%------------------------------------------------------------------------
    21612080hseries=get(handles.GetObject,'parent');
    21622081SeriesData=get(hseries,'UserData');
     
    21692088         [SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface
    21702089     else
    2171          DataInit.TITLE='POINTS';%default option
    2172          [SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface
     2090         %get the object file
     2091         defaultname=get(handles.RootPath,'String');
     2092        [FileName, PathName, filterindex] = uigetfile( ...
     2093       {'*.xml;*.mat', ' (*.xml,*.mat)';
     2094       '*.xml',  '.xml files '; ...
     2095        '*.mat',  '.mat matlab files '}, ...
     2096        'Pick a file',defaultname{1});
     2097        fileinput=[PathName FileName];%complete file name
     2098        testblank=findstr(fileinput,' ');%look for blanks
     2099        if ~isempty(testblank)
     2100            msgbox_uvmat('ERROR','forbidden input file name: contain blanks')
     2101            return
     2102        end
     2103        sizf=size(fileinput);
     2104        if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
     2105        %read the file
     2106        t=xmltree(fileinput);
     2107        data=convert(t);
     2108        if ~isfield(data,'Style')
     2109             data.Style='points';
     2110        end
     2111        if ~isfield(data,'ProjMode')
     2112             data.ProjMode='projection';
     2113        end
     2114        transform_menu=get(handles.transform_fct,'String');
     2115        ichoice=get(handles.transform_fct,'Value');
     2116        if isequal(transform_menu{ichoice},'px');
     2117            data.CoordType='px';
     2118        else
     2119            data.CoordType='phys';
     2120        end
     2121        data.desable_plot=1;
     2122        [SeriesData.hset_object,SeriesData.sethandles]=set_object(data);% call the set_object interface
    21732123     end
    21742124else
    21752125    set(handles.GetObject,'BackgroundColor',[0 1 0])%put activated buttons to green
    2176     if isfield(SeriesData,'hset_object')&& ishandle(SeriesData.hset_object)
    2177         close(SeriesData.hset_object)
    2178     end
     2126%     if isfield(SeriesData,'hset_object')&& ishandle(SeriesData.hset_object)
     2127%         close(SeriesData.hset_object)
     2128%     end
    21792129end
    21802130set(hseries,'UserData',SeriesData)
     
    21842134value=get(handles.GetMask,'Value');
    21852135if value
    2186     errordlg('not implemented yet')
     2136    msgbox_uvmat('ERROR','not implemented yet')
    21872137end
    21882138%--------------------------------------------------------------
    21892139
    2190 %--------------------------------------------------------------------------
     2140%-------------------------------------------------------------------
    21912141%'uv_ncbrowser': interactively calls the netcdf file browser 'get_field.m'
    21922142function ncbrowser_uvmat(hObject, eventdata)
     2143%-------------------------------------------------------------------
    21932144     bla=get(gcbo,'String');
    21942145     ind=get(gcbo,'Value');
     
    21982149     get_field(filename)
    21992150
    2200 % --------------------------------------------------------------------
     2151% ------------------------------------------------------------------
    22012152function MenuHelp_Callback(hObject, eventdata, handles)
    2202 
     2153%-------------------------------------------------------------------
    22032154path_to_uvmat=which ('uvmat');% check the path of uvmat
    22042155pathelp=fileparts(path_to_uvmat);
     
    22102161end
    22112162
    2212 
     2163%-------------------------------------------------------------------
    22132164% --- Executes on selection change in transform_fct.
    22142165function transform_fct_Callback(hObject, eventdata, handles)
    2215 
     2166%-------------------------------------------------------------------
    22162167global nb_transform
    22172168
  • trunk/src/series/aver_stat.m

    r38 r41  
    3232WaitbarPos=get(hseries.waitbar_frame,'Position');
    3333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     34
     35%projection object
     36test_object=get(hseries.GetObject,'Value');
     37if test_object%isfield(Series,'sethandles')
     38    hset_object=findobj(allchild(0),'Name','set_object');
     39    ProjObject=read_set_object(guidata(hset_object));
     40    %answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]});
     41    answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' ProjObject.Style ' before averaging']);
     42    if ~isequal(answeryes,'Yes')
     43        return
     44    end
     45end
     46
    3447%root input file and type
    3548if ~iscell(Series.RootPath)% case of a single input field series
     
    145158end
    146159if ~isequal(FieldName,{'get_field...'})
     160    if isequal(FieldName,{''}) && ~testima
     161        msgbox_uvmat('ERROR','an input field needs to be selected')
     162        return
     163    end
    147164    testcivx=testnc;
    148165end
     
    235252% Root name of output files (TO GENERALISE FOR TWO INPUT SERIES)
    236253subdir_result='aver_stat';
    237 % filebasesub=fullfile(RootPath{1},subdir_result,RootFile{1});
    238 % if isempty(SubDir{1}) % create a subdirectory '/aver_stat'
    239 %     subdir_result='aver_stat';
    240 %     filebasemean=fullfile(RootPath{1},subdir_result);
    241254if ~exist(fullfile(RootPath{1},subdir_result),'dir')
    242255    dircur=pwd; %record current working directory
     
    249262end
    250263filebase_out=filebase{1};
    251 % else
    252 %    subdir_result=SubDir{1};
    253 %    filebase_out=[filebase{1} '_mean'];% output root name obtained by adding the suffix _mean to the input
    254 % end
    255 %output nomtype (to generalise)
    256264NomTypeOut=nomtype2pair(NomType{1},num_i2{end}(end)-num_i1{1}(1),num_j2{end}(end)-num_j1{1}(1));
    257    
    258 % if NbSlice==1 
    259 %     filebase_out=[filebasesub '_mean'];
    260 % else
    261 %     filebase_out=[filebasesub '_' NbSlice_name 'mean'];
    262 %     answeryes=questdlg({['will make average in ' num2str(NbSlice) ' slices'];['results stored as files ' filebase_out ' ...']});
    263 %     if ~isequal(answeryes,'Yes')
    264 %         return
    265 %     end
    266 % end
    267265
    268266% coordinate transform or other user defined transform
    269 Coord_menu=get(hseries.CoordType,'String');
    270 menu_val=get(hseries.CoordType,'Value');
    271 usrfct=Coord_menu{menu_val};
    272 testfct=~isequal(usrfct,'');
     267transform_fct=[];%default
     268if isfield(Series,'transform_fct')
     269    transform_fct=Series.transform_fct;
     270end
    273271
    274272%slice loop
     
    312310             end   
    313311             % coordinate transform (or other user defined transform)
    314              if ~isequal(Series.CoordType,'')
     312             if ~isempty(transform_fct)
    315313                 % z index
    316314                if ~isempty(NbSlice_calib)
     
    318316                end
    319317                if nbview==2
    320                     [Data{1},Data{2}]=feval(Series.CoordType,Data{1},XmlData{1},Data{2},XmlData{2});
     318                    [Data{1},Data{2}]=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});
    321319                    if isempty(Data{2})
    322320                        Data(2)=[];
    323321                    end
    324322                else
    325                     Data{1}=feval(Series.CoordType,Data{1},XmlData);
     323                    Data{1}=transform_fct(Data{1},XmlData);
    326324                end
    327325             end     
     
    338336                Field=Data{1};
    339337            end
    340             if isfield(Series,'ProjObject')
    341                 [Field,errormsg]=proj_field(Field,Series.ProjObject);
     338            if test_object
     339                [Field,errormsg]=proj_field(Field,ProjObject);
    342340                 if ~isempty(errormsg)
    343341                    msgbox_uvmat('ERROR',['error in aver_stat/proj_field:' errormsg])
  • trunk/src/series/merge_proj.m

    r29 r41  
    2323WaitbarPos=get(hseries.waitbar_frame,'Position'); %positiopn of waitbar frame
    2424%-------------------------------------------------
     25
     26%projection object
     27test_object=get(hseries.GetObject,'Value');
     28if test_object
     29    hset_object=findobj(allchild(0),'Name','set_object');
     30    ProjObject=read_set_object(guidata(hset_object));
     31    if ~isfield(ProjObject,'Style')
     32            msgbox_uvmat('ERROR','Undefined projection object style')
     33            return
     34    end
     35    if ~isequal(ProjObject.Style,'plane')
     36            msgbox_uvmat('ERROR','The projection object must be a plane')
     37            return
     38    end
     39    %answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]});
     40    answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' ProjObject.Style]);
     41    if ~isequal(answeryes,'Yes')
     42        return
     43    end
     44end
    2545
    2646%numbers of view fields (nbre of inputs in RootPath)
     
    125145end
    126146
     147% coordinate transform or other user defined transform
     148transform_fct=[];%default
     149if isfield(Series,'transform_fct')
     150    transform_fct=Series.transform_fct;
     151end
     152
    127153% Field and velocity type (the same for all views)
    128154Field_str=get(hseries.FieldMenu,'String');
     
    170196    testcivx=testnc;
    171197end
     198
    172199%name of output files and directory:
    173200% res_subdir=fullfile(Series.RootPath{1},[Series.SubDir{1} '_STAT']);
     
    178205if isequal(length(RootPath),1)
    179206    fulldir=RootPath{1};
    180     subdir='GRID';
     207    subdir='merge_proj';
    181208    res_subdir=fullfile(fulldir,subdir);
    182209else
     
    209236filebasesub=fullfile(res_subdir,Series.RootFile{1});
    210237filebase_merge=fullfile(res_subdir,'merged');%root name for the merged files
    211 
    212 %projection object
    213 if isfield(Series,'sethandles')
    214     if ishandle(Series.sethandles.set_object)
    215         Series.ProjObject=read_set_object(Series.sethandles);
    216         if ~isfield(Series.ProjObject,'Style')
    217             msgbox_uvmat('ERROR','Undefined projection object style')
    218             return
    219         end
    220         if ~isequal(Series.ProjObject.Style,'plane')
    221             msgbox_uvmat('ERROR','The projection object must be a plane')
    222             return
    223         end
    224     end
    225 end
    226238
    227239    %MAIN LOOP
     
    271283                Field{iview}.ZIndex=mod(num_i1{iview}(ifile)-1,NbSlice_calib{1})+1;
    272284            end
    273             if ~isequal(transform,'')
    274                 Field{iview}=feval(Series.CoordType,Field{iview},XmlData{iview});%transform to phys if requested
     285            if ~isempty(transform_fct)
     286                Field{iview}=transform_fct(Field{iview},XmlData{iview});%transform to phys if requested
    275287            end
    276288            if testcivx
     
    279291
    280292            %projection on object (gridded plane)
    281             if isfield(Series,'ProjObject')
    282                 Field{iview}=proj_field(Field{iview},Series.ProjObject);
     293            if test_object
     294                Field{iview}=proj_field(Field{iview},ProjObject);
    283295            end
    284296        end   
  • trunk/src/series/relabel_i_j.m

    r40 r41  
    2929nbfield2=size(XmlData.Time,2)
    3030
    31 answer=msgbox_uvmat('CONFIRMATION','apply image rescaling function levels.m')
     31answer=msgbox_uvmat('INPUT_Y-N','apply image rescaling function levels.m')
    3232test_level=isequal(answer,'Yes')
    3333
  • trunk/src/series/time_series.m

    r38 r41  
    3434%projection object
    3535test_object=get(hseries.GetObject,'Value');
    36 if test_object%isfield(Series,'sethandles')
    37     Series.ProjObject=read_set_object(Series.sethandles);
     36if test_object
     37    hset_object=findobj(allchild(0),'Name','set_object');
     38    ProjObject=read_set_object(guidata(hset_object));
    3839    %answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]});
    39     answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' Series.ProjObject.Style]);
     40    answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' ProjObject.Style]);
    4041    if ~isequal(answeryes,'Yes')
    4142        return
     
    170171
    171172% Root name of output files (TO GENERALISE FOR TWO INPUT SERIES)
    172 filebasesub=fullfile(RootPath{1},RootFile{1});
    173 if NbSlice==1
    174     filebase_out=[filebasesub '_time'];
    175 else
    176     filebase_out=[filebasesub '_' NbSlice_name 'mtim'];
    177     increment=num_i1{1}(2)-num_i1{1}(1);
    178     if ~isequal(increment,1) % if an increment is set
    179         answeryes=msgbox_uvmat('INPUT_Y-N',['will take time series in ' num2str(NbSlice) 'slices with increment = ' num2str(increment) '!']);
    180     else   
    181         answeryes=msgbox_uvmat('INPUT_Y-N',{['will take time series in ' num2str(NbSlice) ' slices'];['results stored as files ' filebase_out ' ...']});
    182     end
    183     if ~isequal(answeryes,'Yes')
    184         return
    185     end
    186 end
     173% filebasesub=fullfile(RootPath{1},RootFile{1});
     174% if NbSlice==1
     175%     filebase_out=[filebasesub '_time'];
     176% else
     177%     filebase_out=[filebasesub '_' NbSlice_name 'mtim'];
     178%     increment=num_i1{1}(2)-num_i1{1}(1);
     179%     if ~isequal(increment,1) % if an increment is set
     180%         answeryes=msgbox_uvmat('INPUT_Y-N',['will take time series in ' num2str(NbSlice) 'slices with increment = ' num2str(increment) '!']);
     181%     else   
     182%         answeryes=msgbox_uvmat('INPUT_Y-N',{['will take time series in ' num2str(NbSlice) ' slices'];['results stored as files ' filebase_out ' ...']});
     183%     end
     184%     if ~isequal(answeryes,'Yes')
     185%         return
     186%     end
     187% end
    187188VelType_str=get(hseries.VelTypeMenu,'String');
    188189VelType_val=get(hseries.VelTypeMenu,'Value');
     
    269270end
    270271
    271 % image or scalar processing programme set by user
    272 Coord_menu=get(hseries.CoordType,'String');
    273 menu_val=get(hseries.CoordType,'Value');
    274 usrfct=Coord_menu{menu_val};
    275 testfct=~isequal(usrfct,'');
     272% Root name of output files (TO GENERALISE FOR TWO INPUT SERIES)
     273subdir_result='time_series';
     274% filebasesub=fullfile(RootPath{1},subdir_result,RootFile{1});
     275% if isempty(SubDir{1}) % create a subdirectory '/aver_stat'
     276%     subdir_result='aver_stat';
     277%     filebasemean=fullfile(RootPath{1},subdir_result);
     278if ~exist(fullfile(RootPath{1},subdir_result),'dir')
     279    dircur=pwd; %record current working directory
     280    cd(RootPath{1})% goes to the iamge directory
     281    [m1,m2,m3]=mkdir(subdir_result);
     282    if ~isequal(m2,'')
     283         msgbox_uvmat('CONFIRMATION',m2);%error message for directory creation
     284    end
     285    cd(dircur) %back to the initial working directory
     286end
     287filebase_out=filebase{1};
     288NomTypeOut=nomtype2pair(NomType{1},num_i2{end}(end)-num_i1{1}(1),num_j2{end}(end)-num_j1{1}(1));
     289
     290% coordinate transform or other user defined transform
     291transform_fct=[];%default
     292if isfield(Series,'transform_fct')
     293    transform_fct=Series.transform_fct;
     294end
    276295
    277296% to update:
     
    331350                end
    332351             end
    333             % geometry transform or other user defined transform
    334             if ~isequal(Series.CoordType,'')           
     352             
     353             % coordinate transform (or other user defined transform)
     354            if ~isempty(transform_fct)
     355                 % z index
     356                if ~isempty(NbSlice_calib)
     357                    Data{iview}.ZIndex=mod(num_i1{iview}(ifile)-1,NbSlice_calib{1})+1;%Zindex for phys transform
     358                end
    335359                if nbview==2
    336                     [Data{1},Data{2}]=feval(Series.CoordType,Data{1},XmlData{1},Data{2},XmlData{2});
     360                    [Data{1},Data{2}]=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});
    337361                    if isempty(Data{2})
    338362                        Data(2)=[];
    339363                    end
    340364                else
    341                     Data{1}=feval(Series.CoordType,Data{1},XmlData{1});
    342                 end
    343             end
     365                    Data{1}=transform_fct(Data{1},XmlData);
     366                end
     367            end     
    344368            if testcivx
    345369                    Data{iview}=calc_field(FieldName,Data{iview});%calculate field (vort..)
     
    354378                Field=Data{1};
    355379            end
    356             if isfield(Series,'ProjObject')
    357                 Series.ProjObject
    358                 [Field,errormsg]=proj_field(Field,Series.ProjObject);
     380            if test_object
     381                [Field,errormsg]=proj_field(Field,ProjObject);
    359382                if ~isempty(errormsg)
    360383                    msgbox_uvmat('ERROR',['error in time_series/proj_field:' errormsg])
     
    393416                                end
    394417                                % check whether the variable ivar is a dimension variable
    395                                 %index=Field.VarDimIndex{ivar};%dimension indices of the variable #ivar
    396418                                DimCell=Field.VarDimName{ivar};
    397419                                if ischar(DimCell)
     
    416438                    if testsum(ivar)==2% test for recorded variable
    417439                        eval(['VarVal=Field.' VarName ';']);
    418                         if isequal(Series.ProjObject.ProjMode,'inside')% take the average in the domain for 'inside' mode
     440                        if isequal(ProjObject.ProjMode,'inside')% take the average in the domain for 'inside' mode
    419441                            if isempty(VarVal)
    420442                                msgbox_uvmat('ERROR',['empty result at frame index ' num2str(num_i1{iview}(ifile))])
  • trunk/src/set_object.m

    r40 r41  
    6767% parameters on the uvmat interface (obtained by 'get_plot_handle.m')
    6868function set_object_OpeningFcn(hObject, eventdata, handles, data, PlotHandles,ZBounds)
    69 
     69%-------------------------------------------------------------------
    7070% Choose default command line output for set_object
    7171handles.output = hObject;
     
    9494% fill the interface as set in the input data:
    9595if exist('data','var')
    96     if isfield(data,'desable_open')
    97         desable_open=data.desable_open;%test to desable button OPEN (edit or display mode)
    98     end
     96%     if isfield(data,'desable_open')
     97%         desable_open=data.desable_open;%test to desable button OPEN (edit or display mode)
     98%     end
    9999    if isfield(data,'desable_plot')
    100100        desable_plot=data.desable_plot;%test to desable button PLOT (display mode)
     
    110110        end
    111111    end
    112     if isfield(data,'ProjMode') && isfield(data,'Style')
    113         data.TITLE=set_title(data.Style,data.ProjMode);% define TITLE in set_object (POINTS, LINE, PATCH,...)
    114     end
    115     if isfield(data,'TITLE')
    116         menutitle=get(handles.TITLE,'String');
    117         for iline=1:length(menutitle)
    118             strmenu=menutitle{iline};
    119             if isequal(data.TITLE,strmenu)
    120                 set(handles.TITLE,'Value',iline)
    121                 break
    122             end
    123         end
    124         TITLE_Callback(hObject, eventdata, handles)% enable edit boxes depending on TITLE
    125     end
    126     if isfield(data,'fixedtitle')&isequal(data.fixedtitle,1)
    127         set(handles.TITLE,'enable','off')
    128     end
     112%     if isfield(data,'ProjMode') && isfield(data,'Style')
     113%         data.TITLE=set_title(data.Style,data.ProjMode);% define TITLE in set_object (POINTS, LINE, PATCH,...)
     114%     end
     115%     if isfield(data,'TITLE')
     116%         menutitle=get(handles.TITLE,'String');
     117%         for iline=1:length(menutitle)
     118%             strmenu=menutitle{iline};
     119%             if isequal(data.TITLE,strmenu)
     120%                 set(handles.TITLE,'Value',iline)
     121%                 break
     122%             end
     123%         end
     124%         TITLE_Callback(hObject, eventdata, handles)% enable edit boxes depending on TITLE
     125%     end
     126%     if isfield(data,'fixedtitle')&isequal(data.fixedtitle,1)
     127%         set(handles.TITLE,'enable','off')
     128%     end
    129129    if isfield(data,'Style')
    130130        menu=get(handles.ObjectStyle,'String');
     
    136136        end
    137137    end
     138    ObjectStyle_Callback(hObject, eventdata, handles)
    138139    if isfield(data,'ProjMode')
    139140        menu=get(handles.ProjMode,'String');
     
    145146        end
    146147    end
     148    ProjMode_Callback(hObject, eventdata, handles)
    147149    if isfield(data,'Coord') & size(data.Coord,2)>=2
    148150        sizcoord=size(data.Coord);
     
    226228    end
    227229end
    228 if desable_open
    229     set(handles.OPEN,'Visible','off')
    230 else
    231     set(handles.OPEN,'Visible','on')
    232 end
     230% if desable_open
     231%     set(handles.OPEN,'Visible','off')
     232% else
     233%     set(handles.OPEN,'Visible','on')
     234% end
    233235if desable_plot
    234236   set(handles.PLOT,'Visible','off')
     
    252254% --- Executes on selection change in ObjectStyle.
    253255function ObjectStyle_Callback(hObject, eventdata, handles)
    254 style_prev=get(handles.ObjectStyle,'UserData');
     256style_prev=get(handles.ObjectStyle,'UserData');%previous object style
    255257str=get(handles.ObjectStyle,'String');
    256258val=get(handles.ObjectStyle,'Value');
     259style=str{val};
    257260% make correspondance between different object styles
    258261% if ~isequal(str{val},style_prev)
     
    287290    z_new{1}=Zcolumn{1};
    288291end
    289 if isequal(str{val},'line')
     292if isequal(style,'line')
    290293    if isequal(style_prev,'rectangle')|isequal(style_prev,'ellipse')
    291294        XMax=get(handles.XMax,'String');
     
    297300        set(handles.ZObject,'String',z_new)
    298301    end
    299 elseif isequal(str{val},'polyline')
    300 elseif isequal(str{val},'rectangle')| isequal(str{val},'ellipse')
     302elseif isequal(style,'polyline')
     303elseif isequal(style,'rectangle')| isequal(style,'ellipse')
    301304     set(handles.XObject,'String',x_new)
    302305     set(handles.YObject,'String',y_new)
     
    304307end
    305308% end
    306            
    307            
    308 
     309switch style
     310    case {'points','line','polyline','plane'}
     311        menu_proj={'projection';'interp';'filter';'none'};
     312    case {'polygon','rectangle','ellipse'}
     313        menu_proj={'inside';'outside';'mask_inside';'mask_outside'};
     314    case 'volume'
     315        menu_proj={'none'};
     316end   
     317proj_index=get(handles.ProjMode,'Value');
     318if proj_index<numel(menu_proj)
     319    set(handles.ProjMode,'Value',1);% value index must not exceed the menu length
     320end
     321set(handles.ProjMode,'String',menu_proj)
    309322ProjMode_Callback(hObject, eventdata, handles)
    310323%store the current option
    311324str=get(handles.ObjectStyle,'String');
    312325val=get(handles.ObjectStyle,'Value');
    313 set(handles.ObjectStyle,'UserData',str{val})
     326set(handles.ObjectStyle,'UserData',style)
    314327
    315328%----------------------------------------------
     
    334347ObjectStyle=menu{value};
    335348test3D=isequal(get(handles.ZObject,'Visible'),'on');%3D case
    336 if isequal(ObjectStyle,'plane')|isequal(ObjectStyle,'volume')
    337     set(handles.Phi,'Visible','on')
    338     if test3D%3D case
    339         set(handles.Theta,'Visible','on')
    340         set(handles.Psi,'Visible','on')
    341     end
    342     set(handles.XMin,'Visible','on')
     349
     350%default setting
     351set(handles.Phi,'Visible','off')
     352set(handles.Theta,'Visible','off')
     353set(handles.Psi,'Visible','off')
     354set(handles.XMin,'Visible','off')
     355set(handles.XMax,'Visible','off')
     356set(handles.YMin,'Visible','off')
     357if isequal(ProjMode,'interp')
     358    set(handles.YMax,'Visible','off')
     359else
     360    set(handles.YMax,'Visible','on')
     361end
     362if isequal(ObjectStyle,'rectangle')|isequal(ObjectStyle,'ellipse')
    343363    set(handles.XMax,'Visible','on')
    344     set(handles.YMin,'Visible','on')
    345     set(handles.YMax,'Visible','on')
    346     if test3D
    347         set(handles.Theta,'Visible','on')
    348         set(handles.Psi,'Visible','on')
    349         set(handles.ZMin,'Visible','on')
    350         set(handles.ZMax,'Visible','on')
    351     end
    352364else
    353     set(handles.Phi,'Visible','off')
    354     set(handles.Theta,'Visible','off')
    355     set(handles.Psi,'Visible','off')
    356     set(handles.XMin,'Visible','off')
    357     set(handles.XMax,'Visible','off')
    358     set(handles.YMin,'Visible','off')
    359     if isequal(ProjMode,'interp')
    360         set(handles.YMax,'Visible','off')
    361     else
    362         set(handles.YMax,'Visible','on')
    363     end
    364     if isequal(ObjectStyle,'rectangle')|isequal(ObjectStyle,'ellipse')
    365         set(handles.XMax,'Visible','on')
    366     else
    367        set(handles.XMax,'Visible','off')
    368     end
    369     set(handles.ZMin,'Visible','off')
    370     set(handles.ZMax,'Visible','off')
    371 end
    372 TITLE_list=get(handles.TITLE,'String');
    373 val=get(handles.TITLE,'Value');
    374 TITLE=TITLE_list{val};
    375 switch TITLE
    376     case {'POINTS','PATCH','MASK'}
    377         set(handles.DX,'Visible','off')
    378         set(handles.DY,'Visible','off')
    379         set(handles.DZ,'Visible','off')
    380     case {'LINE'}
     365   set(handles.XMax,'Visible','off')
     366end
     367set(handles.ZMin,'Visible','off')
     368set(handles.ZMax,'Visible','off')
     369set(handles.DX,'Visible','off')
     370set(handles.DY,'Visible','off')
     371set(handles.DZ,'Visible','off')
     372
     373switch ObjectStyle
     374    case 'points'
     375        set(handles.YMax,'TooltipString','YMax: range of averaging around each point')
     376        set(handles.XObject,'TooltipString','XObject: set of x coordinates of the points')
     377        set(handles.YObject,'TooltipString','YObject: set of y coordinates of the points')
     378        set(handles.ZObject,'TooltipString','ZObject: set of z coordinates of the points')
     379    case {'line','polyline','polygon'}
     380        set(handles.YMax,'TooltipString','YMax: range of averaging around the line')
     381        set(handles.XObject,'TooltipString','XObject: set of x coordinates defining the line')
     382        set(handles.YObject,'TooltipString','YObject: set of y coordinates defining the line')
     383        set(handles.ZObject,'TooltipString','ZObject: set of z coordinates defining the line')
    381384        if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter')
    382385            set(handles.DX,'Visible','on')
    383         else
    384             set(handles.DX,'Visible','off')
    385         end
    386     case {'PLANE'} 
     386            set(handles.DX,'TooltipString','DX: mesh for the interpolated field along the line')
     387        end       
     388    case {'rectangle','ellipse'}
     389        set(handles.XMax,'TooltipString',['XMax: half length of the ' ObjectStyle])
     390        set(handles.YMax,'TooltipString',['YMax: half width of the ' ObjectStyle])
     391        set(handles.XObject,'TooltipString',['XObject:  x coordinate of the ' ObjectStyle ' centre'])
     392        set(handles.YObject,'TooltipString',['YObject:  y coordinate of the ' ObjectStyle ' centre'])
     393    case {'plane','volume'} 
     394        set(handles.Phi,'Visible','on')
     395        set(handles.XMin,'Visible','on')
     396        set(handles.XMax,'Visible','on')
     397        set(handles.YMin,'Visible','on')
     398        set(handles.YMax,'Visible','on')
     399        set(handles.XObject,'TooltipString',['XObject:  x coordinate of the axis origin for the ' ObjectStyle])
     400        set(handles.YObject,'TooltipString',['YObject:  y coordinate of the axis origin for the ' ObjectStyle])
     401        if test3D
     402            set(handles.Theta,'Visible','on')
     403            set(handles.Psi,'Visible','on')
     404            set(handles.ZMin,'Visible','on')
     405            set(handles.ZMax,'Visible','on')
     406        end
    387407        if isequal(ProjMode,'interp')|| isequal(ProjMode,'filter')
    388408            set(handles.DX,'Visible','on')
     
    392412            set(handles.DY,'Visible','off')
    393413        end
    394     case {'VOLUME'}
    395         if isequal(ProjMode,'interp')
    396             set(handles.DX,'Visible','on')
    397             set(handles.DY,'Visible','on')
    398             set(handles.DZ,'Visible','on')
    399         else
    400             set(handles.DX,'Visible','off')
    401             set(handles.DY,'Visible','off')
    402             set(handles.DZ,'Visible','off')   
    403         end
    404 end
    405 
    406 %---------------------------------------------
    407 % --- Executes on selection change in TITLE.
    408 function TITLE_Callback(hObject, eventdata, handles)
    409 %---------------------------------------------
    410 hsetobject=get(handles.TITLE,'parent');
    411 SetData=get(hsetobject,'UserData');%get the hidden interface data
    412 %      function named CALLBACK in UNTITLED.M with the given input arguments.
    413 menu=get(handles.TITLE,'String');
    414 value=get(handles.TITLE,'Value');
    415 titl=menu{value};
    416 if isequal(titl,'POINTS');
    417      menu_style={'points'};
    418      menu_proj={'projection';'interp';'filter';'none'};
    419 elseif isequal(titl,'LINE')
    420      menu_style={'line';'polyline';'rectangle';'polygon';'ellipse'};%'line' =default
    421      menu_proj={'projection';'interp';'filter';'none'};
    422 elseif isequal(titl,'PATCH')
    423      menu_style={'rectangle';'polygon';'ellipse'};%'line' =default
    424      menu_proj={'inside';'outside'};
    425 elseif isequal(titl,'MASK')
    426      menu_style={'polygon'};%'line' =default
    427      menu_proj={'mask_inside';'mask_outside'};
    428 elseif isequal(titl,'PLANE')
    429      menu_style={'plane'};
    430      menu_proj={'projection';'interp';'filter';'none'};
    431 elseif isequal(titl,'VOLUME')
    432      menu_style={'volume'};
    433      menu_proj={'none'};
    434  
    435 end
    436 old_menu=get(handles.ObjectStyle,'String');
    437 value=get(handles.ObjectStyle,'Value');
    438 old_style=old_menu{value};
    439 teststyle=0;
    440 for iline=1:length(menu_style)
    441     if isequal(menu_style{iline},old_style)
    442         styleval=iline;
    443         teststyle=1;
    444         break
    445     end
    446 end
    447 if ~teststyle
    448     new_style=[];%default
    449     switch old_style
    450         case 'polyline'
    451             new_style='polygon';
    452         case 'polygon'
    453             new_style='polyline';
    454     end
    455     if ~isempty(new_style)
    456         for iline=1:length(menu_style)
    457             if isequal(menu_style{iline},new_style)
    458                 styleval=iline;
    459                 teststyle=1;
    460                 break
    461             end
    462         end
    463     end
    464 end
    465 if ~teststyle
    466     styleval=1;
    467 end
    468 set(handles.ObjectStyle,'String',menu_style)
    469 set(handles.ObjectStyle,'Value',styleval)
    470 set(handles.ProjMode,'String',menu_proj)
    471 set(handles.ProjMode,'Value',1)
    472 ObjectStyle_Callback(hObject, eventdata, handles) 
     414        if isequal(ObjectStyle,'volume') && isequal(ProjMode,'interp')
     415            set(handles.DZ,'Visible','on') 
     416        end
     417end
     418%
     419% %---------------------------------------------
     420% % --- Executes on selection change in TITLE.
     421% function TITLE_Callback(style, handles)
     422% %---------------------------------------------
     423% switch style
     424%     case {'points','line','polyline','plane'}
     425%         menu_proj={'projection';'interp';'filter';'none'};
     426%     case {'polygon','rectangle','ellipse'}
     427%         menu_proj={'inside';'outside';'mask_inside';'mask_outside'};
     428%     case 'volume'
     429%         menu_proj={'none'};
     430% end
     431%
     432%
     433% old_menu=get(handles.ObjectStyle,'String');
     434% value=get(handles.ObjectStyle,'Value');
     435% old_style=old_menu{value};
     436% teststyle=0;
     437% for iline=1:length(menu_style)
     438%     if isequal(menu_style{iline},old_style)
     439%         styleval=iline;
     440%         teststyle=1;
     441%         break
     442%     end
     443% end
     444% if ~teststyle
     445%     new_style=[];%default
     446%     switch old_style
     447%         case 'polyline'
     448%             new_style='polygon';
     449%         case 'polygon'
     450%             new_style='polyline';
     451%     end
     452%     if ~isempty(new_style)
     453%         for iline=1:length(menu_style)
     454%             if isequal(menu_style{iline},new_style)
     455%                 styleval=iline;
     456%                 teststyle=1;
     457%                 break
     458%             end
     459%         end
     460%     end
     461% end
     462% if ~teststyle
     463%     styleval=1;
     464% end
     465% set(handles.ObjectStyle,'String',menu_style)
     466% set(handles.ObjectStyle,'Value',styleval)
     467% set(handles.ProjMode,'String',menu_proj)
     468% set(handles.ProjMode,'Value',1)
     469% ObjectStyle_Callback(hObject, eventdata, handles) 
    473470
    474471%---------------------------------------------
     
    546543 end
    547544%Display title
    548 title=set_title(s.Style,s.ProjMode);%update the title
    549 if ~isempty(huvmat)
    550     hhuvmat=guidata(huvmat);
    551 end
    552 menu=get(handles.TITLE,'String');
    553 for iline=1:length(menu)
    554      if isequal(menu{iline},title)
    555          set(handles.TITLE,'Value',iline)
    556          break
    557      end
    558 end
    559 TITLE_Callback(hObject, eventdata, handles)
     545% title=set_title(s.Style,s.ProjMode);%update the title
     546% if ~isempty(huvmat)
     547%     hhuvmat=guidata(huvmat);
     548% end
     549% menu=get(handles.TITLE,'String');
     550% for iline=1:length(menu)
     551%      if isequal(menu{iline},title)
     552%          set(handles.TITLE,'Value',iline)
     553%          break
     554%      end
     555% end
     556%TITLE_Callback(hObject, eventdata, handles)
    560557teststyle=0;
    561 % if isfield(s,'Style')
     558
     559switch s.Style
     560    case {'points','line','polyline','plane'}
     561        menu_proj={'projection';'interp';'filter';'none'};
     562    case {'polygon','rectangle','ellipse'}
     563        menu_proj={'inside';'outside';'mask_inside';'mask_outside'};
     564    case 'volume'
     565        menu_proj={'none'};
     566end
     567set(handles.ObjectStyle,'String',menu_proj)
    562568menu=get(handles.ObjectStyle,'String');
    563569for iline=1:length(menu)
     
    569575end
    570576testmode=0;
    571 menu=get(handles.ProjMode,'String');
    572 for iline=1:length(menu)
    573     if isequal(menu{iline},s.ProjMode)
     577%menu=get(handles.ProjMode,'String');
     578for iline=1:length(menu_proj)
     579    if isequal(menu_proj{iline},s.ProjMode)
    574580        set(handles.ProjMode,'Value',iline)
    575581        testmode=1;
     
    754760set(huvmat,'UserData',UvData)%update the data in the uvmat interface
    755761list_str=get(hlist_object,'String');
    756 TITLE=set_title(ObjectData.Style,ObjectData.ProjMode);
    757 list_str{IndexObj}=[num2str(IndexObj) '-' TITLE];
     762% TITLE=set_title(ObjectData.Style,ObjectData.ProjMode);
     763% list_str{IndexObj}=[num2str(IndexObj) '-' TITLE];
     764list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style];
    758765if isequal(length(list_str),IndexObj)
    759766    list_str{IndexObj+1}='more...';
     
    849856end
    850857msgbox_uvmat('CONFIRMATION',[answer{1}  ' saved'])
     858
    851859%---------------------------------------------------------
    852860% --- Executes on slider movement.
     
    872880
    873881
    874 
    875 function XObject_Callback(hObject, eventdata, handles)
    876 
    877 
    878 function YObject_Callback(hObject, eventdata, handles)
    879 
    880 
    881 
    882 
    883 function ZObject_Callback(hObject, eventdata, handles)
    884 
    885 
    886882% --- Executes on button press in HELP.
    887883function HELP_Callback(hObject, eventdata, handles)
    888884path_to_uvmat=which ('uvmat');% check the path of uvmat
    889885pathelp=fileparts(path_to_uvmat);
    890 helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html');
    891 if isempty(dir(helpfile)), errordlg('Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC')
     886helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');
     887if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package')
    892888else
    893     web([helpfile '#set_object'])   
    894 end
    895 
    896 
    897 
    898 
     889    addpath (fullfile(pathelp,'uvmat_doc'))
     890    web([helpfile '#set_object'])
     891end
     892
     893
     894
  • trunk/src/uvmat.m

    r40 r41  
    202202guidata(hObject, handles);
    203203
    204 dircur=pwd %current working directory
     204dircur=pwd; %current working directory
    205205dir_opening=dircur;
    206206
Note: See TracChangeset for help on using the changeset viewer.