source: trunk/src/series/time_series.m @ 381

Last change on this file since 381 was 381, checked in by sommeria, 12 years ago

read_get_field suppressed, replaced by read_GUI

File size: 24.6 KB
RevLine 
[169]1%'time_series': extract a time series, used with series.fig
2%------------------------------------------------------------------------
[374]3% function GUI_input=time_series(Param)
[169]4%
5%OUTPUT
6% GUI_input=list of options in the GUI series.fig needed for the function
7%
8%INPUT:
[27]9%num_i1: series of first indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ)
[374]10%i2_series: series of second indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ)
[27]11%num_j1: series of first indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ )
12%num_j2: series of second indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ)
[169]13%Series: Matlab structure containing information set by the series interface
14%
[374]15function GUI_input=time_series(Param)
[27]16
[330]17%% requests for the visibility of input windows in the GUI series  (activated directly by the selection in the menu ACTION)
[374]18if ~exist('Param','var')
[27]19    GUI_input={'RootPath';'two';...%nbre of possible input series (options 'on'/'two'/'many', default:'one')
20        'SubDir';'on';... % subdirectory of derived files (PIV fields), ('on' by default)
21        'RootFile';'on';... %root input file name ('on' by default)
22        'FileExt';'on';... %input file extension ('on' by default)
23        'NomType';'on';...%type of file indexing ('on' by default)
24        'NbSlice';'on'; ...%nbre of slices ('off' by default)
25        'VelTypeMenu';'two';...% menu for selecting the velocity type (civ1,..) options 'off'/'one'/'two', 'off' by default)
26        'FieldMenu';'two';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
27        'CoordType';'on';...%can use a transform function 'off' by default
28        'GetObject';'on';...%can use projection object ,'off' by default
29        %'GetMask';'on'...%can use mask option   ,'off' by default
30        %'PARAMETER'; options: name of the user defined parameter',repeat a line for each parameter
31               ''};
32    return %exit the function
33end
34
[374]35%% input parameters
36% read the xml file for batch case
37if ischar(Param) && ~isempty(find(regexp('Param','.xml$')))
38    Param=xml2struct(Param);
39else %  RUN case: parameters introduced as the input structure Param
40    hseries=guidata(Param.hseries);%handles of the GUI series
41    WaitbarPos=get(hseries.waitbar_frame,'Position');
42end
43[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
[27]44
[374]45
46%% coordinate transform or other user defined transform (TODO: case BATCH ?)
47transform_fct='';%default
48if isfield(Param,'transform_fct') % transform function handle
49    transform_fct=Param.transform_fct;
50end
51
[190]52%% projection object
[27]53test_object=get(hseries.GetObject,'Value');
[41]54if test_object
[76]55    hset_object=findobj(allchild(0),'tag','set_object');
[381]56%     ProjObject=read_set_object(guidata(hset_object));
57    ProjObject=read_GUI(hset_object);
[41]58    answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' ProjObject.Style]);
[27]59    if ~isequal(answeryes,'Yes')
60        return
61    end
62else
63    msgbox_uvmat('ERROR','a projection object is needed');
64    return
65end
66
[374]67%% features of the input fields
68    RootPath=Param.InputTable(:,1);
69    RootFile=Param.InputTable(:,3);
70    SubDir=Param.InputTable(:,2);
71    NomType=Param.InputTable(:,4);
72    FileExt=Param.InputTable(:,5);
73ext=FileExt{1};
[330]74form=imformats(ext(2:end));%test valid Matlab image formats
[374]75nbfield=size(i1_series{1},1)*size(i1_series{1},2); %number of fields in the time series
[27]76
[330]77%% determine image type
[27]78hhh=which('mmreader');
[259]79testnetcdf=0;
[374]80nbview=length(RootPath);%Number of input series: this function  accepts only one or two input file series (sub_field is used in the latter case)
[27]81for iview=1:nbview
[374]82    if isequal(FileExt{iview},'.nc')||isequal(FileExt{iview},'.cdf')
[44]83        FileType{iview}='netcdf';
[259]84        testnetcdf=1;
[374]85    elseif isequal(lower(FileExt{iview}),'.avi')
[330]86        if ~isequal(hhh,'')%&& mmreader.isPlatformSupported()
[374]87            MovieObject{iview}=mmreader(fullfile(RootPath{iview},[RootFile{iview} FileExt{iview}]));
[44]88            FileType{iview}='movie';
89        else
90            FileType{iview}='avi';
[27]91        end
[374]92    elseif isequal(lower(FileExt{iview}),'.vol')
[44]93        FileType{iview}='vol';
94    else
[374]95       form=imformats(FileExt{iview}(2:end));
[44]96       if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
[374]97           if isequal(NomType{iview},'*');
[44]98               FileType{iview}='multimage';
99           else
100               FileType{iview}='image';
101           end
102       end
103    end
[27]104end
[374]105filebase{1}=fullfile(RootPath{1},RootFile{1});
[27]106
[330]107%% number of slices
[374]108NbSlice=Param.NbSlice;
[27]109
[330]110%% Field and velocity type (the same for the two views)
[374]111FieldName={''};
112
113if isfield(Param,'InputFields')&&isfield(Param.InputFields,'FieldMenu') 
114    FieldName=Param.InputFields.FieldMenu;%the same set of fields for all views
115    VelType{1}=Param.InputFields.VelTypeMenu;
[27]116end
[374]117if isempty(FieldName) && testnetcdf
[259]118    msgbox_uvmat('ERROR','A field must be defined as input')
119    return
120end
[374]121if isequal(FieldName,'get_field...')
[27]122    hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI
123    if numel(hget_field)>1
124        delete(hget_field(2:end)) % delete multiple occurerence of the GUI get_fioeld
125    elseif isempty(hget_field)
[374]126        filename=filecell{1,1};
127      % filename=name_generator(filebase{1},i1_series{1}(1),j1_series{1}(1),FileExt{1},NomType{1},1,i2_series{1}(1),num_j2{1}(1),SubDir{1});
[27]128       idetect(iview)=exist(filename,'file');
129       hget_field=get_field(filename);
130       return
131    end
[102]132    SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
[27]133    if isempty(SubField)
134        delete(hget_field)
[374]135        filename=filecell{1,1};
136       %filename=name_generator(filebase{1},i1_series{1}(1),j1_series{1}(1),FileExt{1},NomType{1},1,i2_series{1}(1),j2_series{1}(1),SubDir{1});
[27]137        hget_field=get_field(filename);
138        SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
139    end
140end
141
[330]142%% detect whether the two files are 'images' or 'netcdf'
[27]143testcivx=0;
[330]144% FileExt=get(hseries.FileExt,'String');
[27]145if ~isequal(FieldName,{'get_field...'})
[44]146    testcivx=isequal(FileType{1},'netcdf');
[27]147end
[374]148% VelType_str=get(hseries.VelTypeMenu,'String');
149% VelType_val=get(hseries.VelTypeMenu,'Value');
150% VelType{1}=VelType_str{VelType_val};
151% if nbview==2
152%     VelType_str=get(hseries.VelTypeMenu_1,'String');
153%     VelType_val=get(hseries.VelTypeMenu_1,'Value');
154%     VelType{2}=VelType_str{VelType_val};
155% end
[27]156
[190]157%% Calibration data and timing: read the ImaDoc files
[330]158% mode=''; %default
[27]159timecell={};
160XmlData={};
161itime=0;
162NbSlice_calib={};
163for iview=1:nbview%Loop on views
164    XmlData{iview}=[];%default
[374]165    filebase{iview}=fullfile(RootPath{iview},RootFile{iview});
[27]166    if exist([filebase{iview} '.xml'],'file')
167        [XmlData{iview},error]=imadoc2struct([filebase{iview} '.xml']);
168        if isfield(XmlData{iview},'Time')
169            itime=itime+1;
170            timecell{itime}=XmlData{iview}.Time;
171        end
172        if isfield(XmlData{iview},'GeometryCalib') && isfield(XmlData{iview}.GeometryCalib,'SliceCoord')
173            NbSlice_calib{iview}=size(XmlData{iview}.GeometryCalib.SliceCoord,1);%nbre of slices for Zindex in phys transform
174            if ~isequal(NbSlice_calib{iview},NbSlice_calib{1})
175                msgbox_uvmat('WARNING','inconsistent number of Z indices for the field series');
176            end
177        end
[330]178    elseif exist([filebase{iview} '.civ'],'file')%old convention .civ text file
[27]179        [error,time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([filebase{iview} '.civ']);
180        itime=itime+1;
181        timecell{itime}=time;
182        XmlData{iview}.Time=time;
183        GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0];
184        GeometryCalib.Tx=0;
185        GeometryCalib.Ty=0;
186        GeometryCalib.Tz=1;
187        GeometryCalib.dpx=1;
188        GeometryCalib.dpy=1;
189        GeometryCalib.sx=1;
190        GeometryCalib.Cx=0;
191        GeometryCalib.Cy=0;
192        GeometryCalib.f=1;
193        GeometryCalib.kappa1=0;
194        GeometryCalib.CoordUnit='cm';
195        XmlData{iview}.GeometryCalib=GeometryCalib;
196        if error==1
197            msgbox_uvmat('WARNING','inconsistent number of fields in the .civ file');
198        end
199    end
200end
[330]201time=[];%default
202if ~isempty(timecell)
203    if numel(timecell{1})<nbfield
204       msgbox_uvmat('WARNING','time array from ImaDoc to short')
205    else
206        time=timecell{1}; %time defined from ImaDoc file (image series)
207    end
208end
[27]209
[190]210%% check coincidence in time
[330]211if length(timecell)>1
212    for icell=2:length(timecell)
213        if isequal(size(timecell{icell}),size(time))
214            diff_time=max(abs(timecell{icell}-time));
215            if diff_time>0
216                msgbox_uvmat('WARNING',['times of series differ by more than ' num2str(diff_time)])
217                break
218            end
219        else
[38]220            msgbox_uvmat('WARNING','inconsistent time array dimensions in ImaDoc fields, the time for the first series is used')
[27]221            break
222        end
223    end
224end
[330]225if ~isempty(time)
226    display(['time is read from ' filebase{iview} '.xml'])
[27]227end
228
[190]229%%  Root name of output files (TO GENERALISE FOR TWO INPUT SERIES)
[41]230subdir_result='time_series';
[374]231pathdir=fullfile(RootPath{1},subdir_result);
[190]232while exist(pathdir,'dir')
[218]233    subdir_result=[subdir_result '.0'];
[374]234    pathdir=fullfile(RootPath{1},subdir_result);
[41]235end
[190]236[m1,m2,m3]=mkdir(pathdir);
237if ~isequal(m2,'')
238     msgbox_uvmat('CONFIRMATION',m2);%error message for directory creation
239end
240[xx,msg2] = fileattrib(pathdir,'+w','g'); %yield writing access (+w) to user group (g)
241if ~strcmp(msg2,'')
[218]242    msgbox_uvmat('ERROR',['pb of permission for ' pathdir ': ' msg2])%error message for directory creation
[190]243    return
244end
[41]245filebase_out=filebase{1};
[374]246 i21=i1_series{end}(end);
247 if ~isempty(i2_series{end})
248     i21=i2_series{end}(end)-i1_series{1}(1);
249 end
250 j21=1;
251 if ~isempty(j1_series{1})
252     j21=j1_series{end}(end);
253      if ~isempty(j2_series{end})
254          j21=j2_series{end}(end)-j21;
255      end
256 end
257NomTypeOut=nomtype2pair(NomType{1},i21,j21);
[27]258
[41]259
[190]260%% velocity type
[27]261VelType_str=get(hseries.VelTypeMenu,'String');
262VelType_val=get(hseries.VelTypeMenu,'Value');
263VelType{1}=VelType_str{VelType_val};
264if nbview==2
265    VelType_str=get(hseries.VelTypeMenu_1,'String');
266    VelType_val=get(hseries.VelTypeMenu_1,'Value');
267    VelType{2}=VelType_str{VelType_val};
268end
269
[190]270%% LOOP ON SLICES
[330]271nbmissing=0; %number of undetected files
[27]272for i_slice=1:NbSlice
[330]273    dt=[];
274    %%%%%%%%%%%%%%%%%%%%%%%%%%%%  LOOP ON FIELDS WITHIN  A SLICE
275    filecounter=0;
276    for ifile=i_slice:NbSlice:nbfield
[27]277        stopstate=get(hseries.RUN,'BusyAction');
[330]278        errormsg='';
[27]279        if isequal(stopstate,'queue')% enable STOP command
[330]280            update_waitbar(hseries.waitbar,WaitbarPos,ifile/nbfield) % update the waitbar
281            % loop on views (in case of multiple input series)
282            for iview=1:nbview
[374]283                filename=filecell{iview,ifile};
284               % filename=name_generator(filebase{iview},...
285                %    i1_series{iview}(ifile),j1_series{iview}(ifile),FileExt{iview},NomType{iview},1,i2_series{iview}(ifile),j2_series{iview}(ifile),SubDir{iview});
[330]286                if exist(filename,'file')
287                    try
288                        Data{iview}=[]; %default
289                        if ~isequal(FileType{iview},'netcdf')
290                            Data{iview}.ListVarName={'A'};
291                            Data{iview}.AName='image';
292                            switch FileType{iview}
293                                case 'movie'
[374]294                                    A=read(MovieObject{iview},i1_series{iview}(ifile));
[330]295                                case 'avi'
[374]296                                    mov=aviread(filename,i1_series{iview}(ifile));
[330]297                                    A=frame2im(mov(1));
298                                case 'vol'
299                                    A=imread(filename);
300                                case 'multimage'
[374]301                                    A=imread(filename,i1_series{iview}(ifile));
[330]302                                case 'image'
303                                    A=imread(filename);
304                            end
305                            Data{iview}.ListVarName={'AY','AX','A'}; %
306                            npy=size(A,1);
307                            npx=size(A,2);
308                            nbcolor=size(A,3);
309                            if nbcolor==3
310                                Data{iview}.VarDimName={'AY','AX',{'AY','AX','rgb'}};
311                            else
312                                Data{iview}.VarDimName={'AY','AX',{'AY','AX'}};
313                            end
314                            Data{iview}.AY=[npy-0.5 0.5];
315                            Data{iview}.AX=[0.5 npx-0.5];
316                            Data{iview}.A=double(A);
317                            Data{iview}.CoordUnit='pixel';
318                        elseif testcivx
319                            [Data{iview},VelTypeOut]=read_civxdata(filename,FieldName,VelType);
320                            if ~isequal(FieldName,{''})
321                                Data{iview}=calc_field(FieldName,Data{iview});%calculate field (vort..)
322                            end
323                        else
324                            [Data{iview},var_detect]=nc2struct(filename,SubField.ListVarName); %read the corresponding input data
325                            Data{iview}.VarAttribute=SubField.VarAttribute;
326                        end
327                        if ~isempty(NbSlice_calib)  % z index
[374]328                            Data{iview}.ZIndex=mod(i1_series{iview}(ifile)-1,NbSlice_calib{1})+1;
[330]329                        end
330                    catch ME
331                        errormsg=ME.message;
332                    end
[27]333                else
[330]334                    errormsg=[filename ' is missing'];
[27]335                end
[330]336                if isempty(errormsg)
337                    % coordinate transform (or other user defined transform)
338                    if ~isempty(transform_fct)
339                        if nbview==2
340                            [Data{1},Data{2}]=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});
341                            if isempty(Data{2})
342                                Data(2)=[];
343                            end
344                        else
345                            Data{1}=transform_fct(Data{1},XmlData{1});
346                        end
347                    end
348                    if length(Data)==2
349                        [Field,errormsg]=sub_field(Data{1},Data{2}); %substract the two fields
350                    else
351                        Field=Data{1};
352                    end
353                    if test_object
354                        [Field,errormsg]=proj_field(Field,ProjObject);
355                    end
[27]356                end
[330]357                filecounter=filecounter+1;
358               
359                % initiate the time series at the first iteration
360                if filecounter==1
361                    % stop program if the first field reading is in error
362                    if ~isempty(errormsg)
363                        msgbox_uvmat('ERROR',['error in time_series/sub_field:' errormsg])
364                        return
[27]365                    end
366                    RecordData=Field;%default
[330]367                    RecordData.NbDim=Field.NbDim+1; %add the time dimension for plots
[27]368                    nbvar=length(Field.ListVarName);
369                    if nbvar==0
370                        msgbox_uvmat('ERROR','no input variable selected in get_field')
371                        return
372                    end
373                    testsum=2*ones(1,nbvar);%initiate flag for action on each variable
[330]374                    if isfield(Field,'VarAttribute') % look for coordinate and flag variables
[27]375                        for ivar=1:nbvar
376                            if length(Field.VarAttribute)>=ivar && isfield(Field.VarAttribute{ivar},'Role')
377                                var_role=Field.VarAttribute{ivar}.Role;%'role' of the variable
378                                if isequal(var_role,'errorflag')
379                                    msgbox_uvmat('ERROR','do not handle error flags in time series')
[330]380                                    return
[27]381                                end
[330]382                                if isequal(var_role,'warnflag')
383                                    testsum(ivar)=0;  % not recorded variable
[27]384                                    eval(['RecordData=rmfield(RecordData,''' Field.ListVarName{ivar} ''');']);%remove variable
[330]385                                end
[27]386                                if isequal(var_role,'coord_x')| isequal(var_role,'coord_y')|...
[330]387                                        isequal(var_role,'coord_z')|isequal(var_role,'coord')
[27]388                                    testsum(ivar)=1; %constant coordinates, record without time evolution
389                                end
390                            end
[107]391                            % check whether the variable ivar is a dimension variable
392                            DimCell=Field.VarDimName{ivar};
393                            if ischar(DimCell)
394                                DimCell={DimCell};
395                            end
396                            if numel(DimCell)==1 && isequal(Field.ListVarName{ivar},DimCell{1})%detect dimension variables
[330]397                                testsum(ivar)=1;
[107]398                            end
[27]399                        end
400                    end
401                    for ivar=1:nbvar
[330]402                        if testsum(ivar)==2
[27]403                            eval(['RecordData.' Field.ListVarName{ivar} '=[];'])
404                        end
405                    end
406                    RecordData.ListVarName=[{'Time'} RecordData.ListVarName];
407                end
[330]408               
409                % add data to the current field
[27]410                for ivar=1:length(Field.ListVarName)
411                    VarName=Field.ListVarName{ivar};
[330]412                    VarVal=Field.(VarName);
413                    if testsum(ivar)==2% test for recorded variable
414                        if isempty(errormsg)
415                            if isequal(ProjObject.ProjMode,'inside')% take the average in the domain for 'inside' mode
416                                if isempty(VarVal)
[374]417                                    msgbox_uvmat('ERROR',['empty result at frame index ' num2str(i1_series{iview}(ifile))])
[330]418                                    return
419                                end
420                                VarVal=mean(VarVal,1);
[27]421                            end
[330]422                            VarVal=shiftdim(VarVal,-1); %shift dimension
423                            RecordData.(VarName)=cat(1,RecordData.(VarName),VarVal);%concanete the current field to the time series
424                        else
425                            RecordData.(VarName)=cat(1,RecordData.(VarName),0);% put each variable to 0 in case of input reading error
[27]426                        end
427                    elseif testsum(ivar)==1% variable representing fixed coordinates
428                        eval(['VarInit=RecordData.' VarName ';']);
[330]429                        if isempty(errormsg) && ~isequal(VarVal,VarInit)
[27]430                            msgbox_uvmat('ERROR',['time series requires constant coordinates ' VarName])
431                            return
432                        end
[330]433                    end
[27]434                end
[330]435               
436                % record the time:
[27]437                if isempty(time)% time read in ncfiles
[330]438                    if isfield(Field,'Time')
439                        RecordData.Time(filecounter,1)=Field.Time;
440                    else
441                        RecordData.Time(filecounter,1)=ifile;%default
442                    end
[374]443                else % time from ImaDoc prevails  TODO: correct
444                  %  RecordData.Time(filecounter,1)=time{1}(i1_series{1})(ifile),j1_series{1}(ifile))+time(end,i2_series{end}(ifile),j2_series{end}(ifile)))/2;
445                  RecordData.Time(filecounter,1)=i1_series{1}(ifile);% TODO : generalise
[27]446                end
[330]447               
448                % record the number of missing input fields
449                if ~isempty(errormsg)
450                    nbmissing=nbmissing+1;
451                    display(['ifile=' num2str(ifile) ':' errormsg])
452                end
[27]453            end
454        end
455    end
[330]456    %%%%%%% END OF LOOP WITHIN A SLICE
457   
[27]458    %remove time for global attributes if exists
[330]459    for iattr=1:numel(RecordData.ListGlobalAttribute)
[27]460        if strcmp(RecordData.ListGlobalAttribute{iattr},'Time')
461            RecordData.ListGlobalAttribute(iattr)=[];
462            break
463        end
464    end
465    for ivar=1:numel(RecordData.ListVarName)
466        VarName=RecordData.ListVarName{ivar};
467        eval(['RecordData.' VarName '=squeeze(RecordData.' VarName ');']) %remove singletons
468    end
[330]469   
470    % add time dimension
471    for ivar=1:length(Field.ListVarName)
472        DimCell=Field.VarDimName(ivar);
473        if testsum(ivar)==2%variable used as time series
474            RecordData.VarDimName{ivar}=[{'Time'} DimCell];
475        elseif testsum(ivar)==1
476            RecordData.VarDimName{ivar}=DimCell;
[27]477        end
[330]478    end
[27]479    indexremove=find(~testsum);
480    if ~isempty(indexremove)
481        RecordData.ListVarName(1+indexremove)=[];
482        RecordData.VarDimName(indexremove)=[];
[330]483        if isfield(RecordData,'Role') && ~isempty(RecordData.Role{1})%generaliser aus autres attributs
[27]484            RecordData.Role(1+indexremove)=[];
485        end
486    end
[330]487   
[27]488    %shift variable attributes
489    if isfield(RecordData,'VarAttribute')
490        RecordData.VarAttribute=[{[]} RecordData.VarAttribute];
[330]491    end
[27]492    RecordData.VarDimName=[{'Time'} RecordData.VarDimName];
[374]493    RecordData.Action=Param.Action;%name of the processing programme
[330]494    test_time=diff(RecordData.Time)>0;% test that the readed time is increasing (not constant)
495    if ~test_time
496        RecordData.Time=[1:filecounter];
497    end
[107]498   
[330]499    % display nbmissing
500    if ~isequal(nbmissing,0)
501        msgbox_uvmat('WARNING',[num2str(nbmissing) ' files skipped: missing files or bad input, see command window display'])
502    end
503   
[27]504    %name of result file
[374]505   % [filemean]=...
506    %    name_generator(filebase_out,i1_series{1}(i_slice),j1_series{1}(i_slice),'.nc','_i1-i2_j1-j2',1,i2_series{end}(ifile),j2_series{end}(ifile),subdir_result);
507    filemean=fullfile_uvmat(RootPath{1},subdir_result,RootFile{1},'.nc','_1',i1_series{1}(i_slice));
[27]508    errormsg=struct2nc(filemean,RecordData); %save result file
509    if isempty(errormsg)
510        display([filemean ' written'])
511    else
[259]512        msgbox_uvmat('ERROR',['error in Series/struct2nc: ' errormsg])
[27]513    end
514end
[107]515
[330]516%% plot the time series (the last one in case of multislices)
[27]517figure
518haxes=axes;
[330]519plot_field(RecordData,haxes)
[27]520
[330]521%% display the result file using the GUI get_field
[27]522hget_field=findobj(allchild(0),'name','get_field');
523if ~isempty(hget_field)
524    delete(hget_field)
525end
526get_field(filemean,RecordData)
527   
[330]528%------------------------------------------------------------------------
[27]529% --- Executes on selection change in CoordType.
530function CoordType_Callback(hObject, eventdata, handles)
[330]531%------------------------------------------------------------------------
[27]532menu_str=get(handles.CoordType,'String');
533ind_coord=get(handles.CoordType,'Value');
534coord_option=menu_str{ind_coord};
535if isequal(coord_option,'more...');
536    fct_name='';
537    if exist('./TMP/current_usr_fct.mat','file')% if a file is found
538        h=load('./TMP/current_usr_fct.mat');
539        if isfield(h,'fct_name');
540            fct_name=h.fct_name;
541        end
542    end
543    prompt = {'Enter the name of the transform function'};
544    dlg_title = 'user defined transform';
545    num_lines= 1;
546    [FileName, PathName, filterindex] = uigetfile( ...
547       {'*.m', ' (*.m)';
548        '*.m',  '.m files '; ...
549        '*.*', 'All Files (*.*)'}, ...
550        'Pick a file', fct_name);
551    fct_name=fullfile(PathName,FileName);
552    addpath(PathName);%add the path to the selected fct
553    [errormsg,date_str]=check_functions;%check whether new functions can oversed the uvmat package A UTILISER
554    if ~exist(fct_name,'file')
555           warndlg(['image procesing fct ' fct_name ' not found'])
556    else
557        transform=FileName(1:end-2);%
558        update_menu(handles.CoordType,transform)%add the selected fct to the menu
559  %      set(handles.mouse_coord,'String',menu([1:end-1])')%update the mouse coord menu
560      %save ('./TMP/current_usr_fct.mat','fct_name');
561    end   
562end
563ind_coord=get(handles.CoordType,'Value');   
564
565%---------------------------------------------------------------------
[44]566% % --- Executes on selection change in ProjObject.
567% function ProjObject_Callback(hObject, eventdata, handles)
568%
569% list_object=get(handles.ProjObject,'String');
570% index=get(handles.ProjObject,'Value');
571% hseries=get(handles.ProjObject,'Parent');
572% SeriesData=get(hseries,'UserData');
573% Obj=SeriesData.ProjObject{index};
574% [SeriesData.hset_object,SeriesData.sethandles]=set_object(SeriesData.ProjObject{index});
575% set(hseries,'UserData',SeriesData);
[27]576
Note: See TracBrowser for help on using the repository browser.