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

Last change on this file since 76 was 76, checked in by sommeria, 14 years ago

minor bug repairs. Projection on any abject inside the main uvmat axes is now possible
aver_stat, time_series, merge_proj: set_object now called by tag instead of name (which depends on the object)

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