Changeset 334 for trunk/src/uvmat.m


Ignore:
Timestamp:
Dec 14, 2011, 1:33:18 PM (9 years ago)
Author:
sommeria
Message:

bugs corrected in fileparts_uvmat and find_file_series
name2dispaly replaced by fileparts_uvmat in uvmat, but not in other functions
bug corrected in plot_field, introduction of FileType? in read_field

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r332 r334  
    468468function display_file_name(hObject, eventdata, handles,fileinput)
    469469%------------------------------------------------------------------------
     470%% analyse the input file
    470471if ~exist(fileinput,'file')
    471472    msgbox_uvmat('ERROR',['input file ' fileinput  ' does not exist'])
    472473    return
    473474end
    474 [RootPath,RootFile,i1,i2,str_a,str_b,ext,NomType,SubDir]=name2display(fileinput);%extract information from the file name
    475 ext_test=''; %default
    476 if ~isempty(ext) % if a file extension is detected
    477     form=imformats(ext(2:end));%test valid Matlab image formats
    478     if ~isempty(form)
    479         ext_test='.image';
    480         imainfo=imfinfo(fileinput); 
    481         if length(imainfo) >1 %case of image with multiple frames
    482             i1='1'; % set the frame counter to 1 by default
    483             i2='';
    484             str_a='';
    485             str_b='';
    486             NomType='*'; %indicate a set of indexed frames within a single file
    487             [RootPath,RootFile]=fileparts(fileinput); %include the indices in the root file
    488         end
    489     elseif isequal(lower(ext),'.avi')%case of avi movie file
    490         ext_test='.image';
    491         i1='1'; % set the frame counter to 1 by default
    492         i2='';
    493         str_a='';
    494         str_b='';
    495         NomType='*'; %indicate a set of indexed frames within a single file
    496         [RootPath,RootFile]=fileparts(fileinput); %include the indices in the root file
    497     else
    498         ext_test=lower(ext);
    499     end
    500 end
    501 switch ext_test
    502     case {'.civ','.log','.cmx','.cmx2','.txt','.bat'}  %display text file
     475% detect root name, nomenclature and indices in the input file name:
     476[RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput);
     477% detect the file type, get the movie object if relevant, and look for the corresponding file series:
     478[i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput);
     479
     480% open the file or fill the GUI uvmat according to the detected file type
     481switch FileType
     482    case ''
     483       msgbox_uvmat('ERROR','invalid input file type')
     484    case 'txt'
    503485        edit(fileinput) 
    504     case '.fig'                           %display matlab figure
     486    case 'figure'                           %display matlab figure
    505487        hfig=open(fileinput);
    506488        set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action functio
    507489        set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse click action function
    508490        set(hfig,'WindowButtonUpFcn','mouse_down')%set mouse click action function
    509     case {'.xml','.xls'}                % edit xml or Excel files
     491    case {'xml','xls'}                % edit xml or Excel files
    510492       editxml(fileinput);
    511     case {'.avi','.image','.vol','.nc','.cdf'}   
     493    otherwise
    512494        set(handles.RootPath,'String',RootPath);
    513495        if  isequal(SubDir,'')
     
    520502        set(handles.RootFile,'String',['/' RootFile]); %display the separator
    521503        indices=fileinput(length(rootname)+1:end);
    522         indices(end-length(ext)+1:end)=[]; %remove extension
     504        indices(end-length(FileExt)+1:end)=[]; %remove extension
    523505        set(handles.FileIndex,'String',indices);       
    524506%         set(handles.FileIndex,'UserData',NomType);
    525 set(handles.NomType,'String',NomType);
    526         set(handles.FileExt,'String',ext);
     507        set(handles.NomType,'String',NomType);
     508        set(handles.FileExt,'String',FileExt);
    527509        % fill file index counters
    528         set(handles.i1,'String',i1);   
    529         set(handles.i2,'String',i2);
    530         set(handles.j1,'String',str_a);
    531         set(handles.j2,'String',str_b);
     510        set(handles.i1,'String',num2str(i1));   
     511        set(handles.i2,'String',num2str(i2));
     512        set(handles.j1,'String',num2str(j1));
     513        set(handles.j2,'String',num2str(j2));
    532514       
    533515        % synchronise indices of the second  input file if it exists
     
    536518            NomType_1=get(handles.NomType_1,'String');
    537519%             NomType_1=get(handles.FileIndex_1,'UserData');     
    538             FileName_1=name_generator(FileBase_1,str2double(i1),str2double(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);
     520            FileName_1=name_generator(FileBase_1,i1,i2,FileExt_1,NomType_1,1,j1,j2,SubDir_1);
    539521            if exist(FileName_1,'file')
    540                 FileIndex_1=name_generator('',str2double(i1),str2double(i2),'',NomType_1,1,stra2num(str_a),stra2num(str_b),'');
     522                FileIndex_1=name_generator('',i1,i2,'',NomType_1,1,j1,j2,'');
    541523                set(handles.FileIndex_1,'String',FileIndex_1)
    542524            else
     
    561543        set(handles.ListObject,'Visible','on')
    562544        set(handles.frame_object,'Visible','on')
    563          %%%%%% initiate input file:
    564         update_rootinfo(hObject,eventdata,handles); 
    565     otherwise
    566        msgbox_uvmat('ERROR',['invalid input file extension' ext])
     545       
     546         % initiate input file series and refresh the current field view:
     547        update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject); 
    567548end
    568549
     
    571552function RootPath_Callback(hObject,eventdata,handles)
    572553%------------------------------------------------------------------------
    573 update_rootinfo(hObject,eventdata,handles);
     554% read the current input file name:
     555fileinput=read_file_boxes(handles);
     556% detect the file type, get the movie object if relevant, and look for the corresponding file series:
     557[i1_series,i2_series,j1_series,j2_series,~,FileType,MovieObject]=find_file_series(fileinput);
     558% initiate the input file series and refresh the current field view:
     559update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject);
    574560
    575561%------------------------------------------------------------------------
     
    579565%refresh the menu of input fields
    580566Fields_Callback(hObject, eventdata, handles);
    581 % refresh the current field
     567% refresh the current field view
    582568run0_Callback(hObject, eventdata, handles);
    583569
     
    586572function RootFile_Callback(hObject, eventdata, handles)
    587573%------------------------------------------------------------------------
    588 update_rootinfo(hObject,eventdata,handles)
     574RootPath_Callback(hObject,eventdata,handles)
    589575
    590576%------------------------------------------------------------------------
     
    592578function FileIndex_Callback(hObject, eventdata, handles)
    593579%------------------------------------------------------------------------
    594 FileIndices=get(handles.FileIndex,'String');
    595 if isempty(str2num(FileIndices))
    596     [pp,ff,str1,str2,str_a,str_b]=name2display(FileIndices);
    597 else
    598     str1=FileIndices;
    599     str2='';
    600     str_a='';
    601     str_b='';
    602 end
    603 set(handles.i1,'String',str1);
    604 set(handles.i2,'String',str2);
    605 set(handles.j1,'String',str_a);
    606 set(handles.j2,'String',str_b);
     580[~,~,~,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String'));
     581set(handles.i1,'String',num2str(i1));
     582set(handles.i2,'String',num2str(i2));
     583set(handles.j1,'String',num2str(j1));
     584set(handles.j2,'String',num2str(j2));
     585
     586% refresh the current field view
    607587run0_Callback(hObject, eventdata, handles)
    608588
     
    610590% --- Update information about a new field series (indices to scan, timing,
    611591%     calibration from an xml file, then refresh current plots
    612 function update_rootinfo(hObject,eventdata,handles)
     592function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject)
    613593%------------------------------------------------------------------------
    614594set(handles.RootPath,'BackgroundColor',[1 1 0])
     
    618598UvData.NewSeries=1; %flag for run0: begin a new series
    619599UvData.TestInputFile=1;
     600UvData.FileType=FileType;
    620601set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window
    621602set(handles.FixVelType,'Value',0); %desactivate fixed veltype
    622603[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles);
     604
    623605if ~exist(FileName,'file')
    624606   msgbox_uvmat('ERROR',['input file ' FileName ' not found']);
     
    626608end
    627609nbfield=[];%default
    628 nburst=[];%default
     610nbfield_j=[];%default
    629611
    630612% read timing and total frame number from the current file (movie files) !! may be overrid by xml file
     
    640622    imainfo=aviinfo([FileBase FileIndices FileExt]);
    641623    nbfield=imainfo.NumFrames;
    642     nburst=1;
     624    nbfield_j=1;
    643625    set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
    644626    XmlData.Time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)';
     
    657639    if length(imainfo) >1 %case of image with multiple frames
    658640        nbfield=length(imainfo);
    659         nburst=1;
     641        nbfield_j=1;
    660642    end
    661643end
     
    748730end
    749731
    750 % store last index in handles.lat_i and .last_j
     732%% store last index in handles.lat_i and .last_j
     733nbfield=max(i2_series);
     734if isempty(nbfield)
     735    nbfield=max(i1_series);
     736end
     737nbfield_j=max(j2_series);
     738if isempty(nbfield_j)
     739    nbfield_j=max(j1_series);
     740end
    751741if ~isempty(XmlData.Time)
    752742    nbfield=size(XmlData.Time,1);
    753     nburst=size(XmlData.Time,2);
     743    nbfield_j=size(XmlData.Time,2);
    754744    %transform .Time to a column vector if it is a line vector the nomenclature uses a single index
    755     if isequal(nbfield,1) && ~isequal(nburst,1)% .Time is a line vector
     745    if isequal(nbfield,1) && ~isequal(nbfield_j,1)% .Time is a line vector
    756746        NomType=get(handles.NomType,'String');
    757747%         NomType=get(handles.FileIndex,'UserData');
    758748        if numel(NomType)>=2 &&(strcmp(NomType,'_i')||strcmp(NomType(1:2),'%0')||strcmp(NomType(1:2),'_%'))
    759749            XmlData.Time=(XmlData.Time)';
    760             nbfield=nburst;
    761             nburst=1;
     750            nbfield=nbfield_j;
     751            nbfield_j=1;
    762752        end
    763753    end
     
    771761set(handles.last_i,'String',last_i_cell)
    772762last_j_cell=get(handles.last_j,'String');
    773 if isempty(nburst)
     763if isempty(nbfield_j)
    774764     last_j_cell{1}='';
    775765else
    776      last_j_cell{1}=num2str(nburst);
     766     last_j_cell{1}=num2str(nbfield_j);
    777767end
    778768set(handles.last_j,'String',last_j_cell);
     
    812802               set(handles.nb_slice,'String',num2str(NbSlice))
    813803           end
    814            slices_Callback(hObject, eventdata, handles)
     804           slices_Callback([],[], handles)
    815805        end           
    816806    end
     
    824814UvData.XmlData=XmlData;
    825815UvData.NewSeries=1;
    826 
     816UvData.MovieObject=MovieObject;
    827817
    828818%display warning message
     
    862852set(handles.RootPath,'BackgroundColor',[1 1 1])
    863853drawnow
    864 set_scan_options(hObject, eventdata, handles)
     854set_scan_options(handles)
    865855
    866856%% update list of recent files in the menubar
     
    886876%--- Set index navigation options for new series input and refresh plot
    887877%------------------------------------------------------------------------
    888 function set_scan_options(hObject, eventdata, handles)
     878function set_scan_options(handles)
    889879
    890880%  set the corresponding index navigation options
     
    918908if isequal(scan_option,'i')
    919909     set(handles.scan_i,'Value',1)
    920      scan_i_Callback(hObject, eventdata, handles);
     910     scan_i_Callback([],[], handles);
    921911else
    922912     set(handles.scan_j,'Value',1)
    923      scan_j_Callback(hObject, eventdata, handles);
     913     scan_j_Callback([],[], handles);
    924914end
    925915set(handles.scan_j,'Visible',state_j)
     
    936926
    937927%% view the field 
    938 run0_Callback(hObject, eventdata, handles); %view field
     928run0_Callback([],[], handles); %view field
    939929mask_test=get(handles.CheckMask,'value');
    940930if mask_test
     
    943933          delete(MaskData.maskhandle)    %delete old mask
    944934    end
    945     CheckMask_Callback(hObject, eventdata, handles)
     935    CheckMask_Callback([],[],handles)
    946936end
    947937
     
    10511041
    10521042%[path,name,ext]=fileparts(fileinput_1);
    1053 [RootPath_1,RootFile_1,field_count,str2,str_a,str_b,FileExt_1,NomType_1,SubDir_1]=name2display(fileinput_1);
    1054 nbfield_1=1; %default
    1055 ext_test=FileExt_1;%default
    1056 form=imformats(FileExt_1(2:end));
    1057 if ~isempty(form) % if the extension corresponds to an image format recognized by Matlab
    1058     imainfo=imfinfo(fileinput_1); 
    1059     nbfield_1=length(imainfo);
    1060     ext_test='.image';
    1061 elseif isequal(lower(FileExt_1),'.avi')
    1062     info=aviinfo(fileinput_1);
    1063     nbfield_1=info.NumFrames;
    1064     ext_test='.image';
    1065 end
    1066 
    1067 %open directly fig or text files
    1068 switch ext_test
    1069     case {'.civ','.log','.cmx','.cmx2','.txt'}  %display text file
     1043[RootPath_1,SubDir_1,RootFile_1,i1,i2,j1,j2,FileExt_1]=fileparts_uvmat(fileinput_1);
     1044[i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput_1);
     1045% [RootPath_1,RootFile_1,field_count,str2,str_a,str_b,FileExt_1,NomType_1,SubDir_1]=name2display(fileinput_1);
     1046switch FileType
     1047    case ''
     1048       msgbox_uvmat('ERROR','invalid input file type')
     1049    case 'txt'
    10701050        edit(fileinput) 
    1071         return
    1072     case '.fig'                           %display matlab figure
     1051    case 'figure'                           %display matlab figure
    10731052        hfig=open(fileinput);
    10741053        set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action functio
    10751054        set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse click action function
    10761055        set(hfig,'WindowButtonUpFcn','mouse_down')%set mouse click action function
    1077         return
    1078     case {'.xml','.xls'}                % edit xml or Excel files
    1079        heditxml=editxml(fileinput);
    1080        return
    1081     case {'.image','.nc','.cdf'}       
    1082 %         set(handles.FileIndex,'UserData',NomType_1);
     1056    case {'xml','xls'}                % edit xml or Excel files
     1057       editxml(fileinput);
     1058%     case {'.avi','.image','.vol','.nc','.cdf'} 
    10831059    otherwise
    1084         msgbox_uvmat(['invalid input file extension ' FileExt_1 ' for uvmat'],'ERROR')
    1085         return
    1086 end
     1060        set(handles.RootPath,'String',RootPath);
     1061        if  isequal(SubDir,'')
     1062            rootname=fullfile(RootPath,RootFile);
     1063        else
     1064            rootname=fullfile(RootPath,SubDir,RootFile);
     1065            SubDir=['/' SubDir]; %display the separator
     1066        end
     1067        set(handles.SubDir,'String',SubDir);
     1068        set(handles.RootFile,'String',['/' RootFile]); %display the separator
     1069        indices=fileinput(length(rootname)+1:end);
     1070        indices(end-length(FileExt)+1:end)=[]; %remove extension
     1071        set(handles.FileIndex,'String',indices);       
     1072%         set(handles.FileIndex,'UserData',NomType);
     1073        set(handles.NomType,'String',NomType);
     1074        set(handles.FileExt,'String',FileExt);
     1075        % fill file index counters
     1076        set(handles.i1,'String',num2str(i1));   
     1077        set(handles.i2,'String',num2str(i2));
     1078        set(handles.j1,'String',num2str(j1));
     1079        set(handles.j2,'String',num2str(j2));
     1080       
     1081        % synchronise indices of the second  input file if it exists
     1082        if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers
     1083            [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
     1084            NomType_1=get(handles.NomType_1,'String');
     1085%             NomType_1=get(handles.FileIndex_1,'UserData');     
     1086            FileName_1=name_generator(FileBase_1,i1,i2,FileExt_1,NomType_1,1,j1,j2,SubDir_1);
     1087            if exist(FileName_1,'file')
     1088                FileIndex_1=name_generator('',i1,i2,'',NomType_1,1,j1,j2,'');
     1089                set(handles.FileIndex_1,'String',FileIndex_1)
     1090            else
     1091                set(handles.SubField,'Value',0)
     1092                SubField_Callback(hObject, eventdata, handles)
     1093            end
     1094        end 
     1095end
     1096%
     1097%
     1098% nbfield_1=1; %default
     1099% ext_test=FileExt_1;%default
     1100% form=imformats(FileExt_1(2:end));
     1101% if ~isempty(form) % if the extension corresponds to an image format recognized by Matlab
     1102%     imainfo=imfinfo(fileinput_1); 
     1103%     nbfield_1=length(imainfo);
     1104%     ext_test='.image';
     1105% elseif isequal(lower(FileExt_1),'.avi')
     1106%     info=aviinfo(fileinput_1);
     1107%     nbfield_1=info.NumFrames;
     1108%     ext_test='.image';
     1109% end
     1110%
     1111% %open directly fig or text files
     1112% switch ext_test
     1113%     case {'.civ','.log','.cmx','.cmx2','.txt'}  %display text file
     1114%         edit(fileinput) 
     1115%         return
     1116%     case '.fig'                           %display matlab figure
     1117%         hfig=open(fileinput);
     1118%         set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action functio
     1119%         set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse click action function
     1120%         set(hfig,'WindowButtonUpFcn','mouse_down')%set mouse click action function
     1121%         return
     1122%     case {'.xml','.xls'}                % edit xml or Excel files
     1123%        heditxml=editxml(fileinput);
     1124%        return
     1125%     case {'.image','.nc','.cdf'}       
     1126% %         set(handles.FileIndex,'UserData',NomType_1);
     1127%     otherwise
     1128%         msgbox_uvmat(['invalid input file extension ' FileExt_1 ' for uvmat'],'ERROR')
     1129%         return
     1130% end
    10871131
    10881132% test for image series in a single file and synchronise file indices of the two series
     
    11861230set(handles.FixVelType,'Value',0); %desactivate fixed veltype
    11871231nbfield_1=[];%default
    1188 nburst_1=[];%default
     1232nbfield_j_1=[];%default
    11891233XmlData.Time=[];
    11901234XmlData.GeometryCalib=[];%default
     
    11991243    imainfo=aviinfo([FileBase FileIndices FileExt]);
    12001244    nbfield_1=imainfo.NumFrames;
    1201     nburst_1=1;
     1245    nbfield_j_1=1;
    12021246    set(handles.Dt_txt,'String',['Dt=' num2str(1000/info.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
    12031247    time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)';
     
    12141258    if length(imainfo) >1 %case of image with multiple frames
    12151259        nbfield_1=length(imainfo);
    1216         nburst_1=1;
     1260        nbfield_j_1=1;
    12171261    end
    12181262end
     
    12811325if ~isempty(XmlData.Time)
    12821326    nbfield_1=size(XmlData.Time,1);
    1283     nburst_1=size(XmlData.Time,2);   
     1327    nbfield_j_1=size(XmlData.Time,2);   
    12841328end
    12851329last_i_cell=get(handles.last_i,'String');
     
    12911335set(handles.last_i,'String',last_i_cell)
    12921336last_j_cell=get(handles.last_j,'String');
    1293 if isempty(nburst_1)
     1337if isempty(nbfield_j_1)
    12941338     last_j_cell{2}='';
    12951339else
    1296      last_j_cell{2}=num2str(nburst_1);
     1340     last_j_cell{2}=num2str(nbfield_j_1);
    12971341end
    12981342set(handles.last_j,'String',last_j_cell);
     
    13321376drawnow
    13331377
    1334 set_scan_options(hObject, eventdata, handles)
     1378set_scan_options(handles)
    13351379
    13361380%------------------------------------------------------------------------
     
    13861430set(handles.FileIndex,'BackgroundColor',[0.7 0.7 0.7])
    13871431if get(handles.SubField,'Value')==1
    1388     NomType_1=get(handles.FileIndex_1,'String');
    1389      FileExt_1=get(handles.FileExt_1,'String');
    1390     [P,F,str1,str2,str_a,str_b,Ext,NomType_1]=name2display(['xx' NomType_1 FileExt_1]);
     1432    NomType_1=get(handles.NomType_1,'String');
     1433%      FileExt_1=get(handles.FileExt_1,'String');
     1434%     [P,F,str1,str2,str_a,str_b,Ext,NomType_1]=name2display(['xx' NomType_1 FileExt_1]);
    13911435     indices=name_generator('',num1,num_a,'',NomType_1,1,num2,num_b,'');
    13921436     set(handles.FileIndex_1,'String',indices)
     
    14781522        for ilist=1:length(maskfiles)
    14791523            maskname=maskfiles(ilist).name;% take the first mask file in the list
    1480             [rr,ff,x1,x2,xa,xb,xext,Mask_NomType{ilist}]=name2display(maskname);
    1481             [Path2,Name,ext]=fileparts(maskname);
     1524            [~,~,~,~,~,~,~,MaskExt,Mask_NomType{ilist}]=fileparts_uvmat(maskname);
     1525%             [rr,ff,x1,x2,xa,xb,xext,Mask_NomType{ilist}]=name2display(maskname);
     1526             [~,Name]=fileparts(maskname);
    14821527            Namedouble=double(Name);
    14831528            val=(48>Namedouble)|(Namedouble>57);% select the non-numerical characters
     
    15281573            errormsg='no file browsed';
    15291574        end
    1530         [RootDir,RootFile,x1,x2,xa,xb,xext,Mask.NomType]=name2display(maskname);
     1575        [RootDir,~,RootFile,~,~,~,~,~,Mask.NomType]=fileparts_uvmat(maskname);
     1576%         [RootDir,RootFile,x1,x2,xa,xb,xext,Mask.NomType]=name2display(maskname);
    15311577        Mask.Base=fullfile(RootDir,RootFile);
    15321578        Mask.NbSlice=1;
     
    17961842if sub_value % a second input file has been entered
    17971843    [FileName_1,RootPath_1,filebase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
    1798     [pp,ff,i1_1_str,i2_1_str,j1_1_str,j2_1_str]=name2display(FileIndices_1);
    1799     i1_1=stra2num(i1_1_str);%current set of indices for the second field (may be set different than the main indices)
    1800     i2_1=stra2num(i2_1_str);
    1801     j1_1=stra2num(j1_1_str);
    1802     j2_1=stra2num(j2_1_str);
     1844    [~,~,~,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndices_1);
     1845  %  [pp,ff,i1_1_str,i2_1_str,j1_1_str,j2_1_str]=name2display(FileIndices_1);
     1846%     i1_1=stra2num(i1_1_str);%current set of indices for the second field (may be set different than the main indices)
     1847%     i2_1=stra2num(i2_1_str);
     1848%     j1_1=stra2num(j1_1_str);
     1849%     j2_1=stra2num(j2_1_str);
    18031850    NomType_1=get(handles.NomType_1,'String');
    18041851%     NomType_1=get(handles.FileIndex_1,'UserData');
     
    20902137    VelType=[];%default
    20912138    Ext=get(handles.FileExt,'String');
    2092     if strcmp(Ext,'.nc')||strcmp(Ext,'.cdf')
    2093         FileType='netcdf';
    2094         list_fields=get(handles.Fields,'String');% list menu fields
    2095         index_fields=get(handles.Fields,'Value');% selected string index
    2096         FieldName= list_fields{index_fields}; % selected field
    2097         if ~strcmp(FieldName,'get_field...')
    2098            TestVelType=get(handles.FixVelType,'Value');
    2099            if TestVelType
    2100                VelType=setfield(handles);% read the velocity type.
    2101            end
    2102         end
    2103         if strcmp(FieldName,'velocity')
    2104             list_code=get(handles.ListColorCode,'String');% list menu fields
    2105             index_code=get(handles.ListColorCode,'Value');% selected string index
    2106             if  ~strcmp(list_code{index_code},'black') &&  ~strcmp(list_code{index_code},'white')
    2107                 list_code=get(handles.ListColorScalar,'String');% list menu fields
    2108                 index_code=get(handles.ListColorScalar,'Value');% selected string index
    2109                 ParamIn.ColorVar= list_code{index_code}; % selected field
     2139    FileType=UvData.FileType;
     2140    switch FileType
     2141        %     if strcmp(Ext,'.nc')||strcmp(Ext,'.cdf')
     2142        case {'civx','civdata','netcdf'};
     2143            list_fields=get(handles.Fields,'String');% list menu fields
     2144            index_fields=get(handles.Fields,'Value');% selected string index
     2145            FieldName= list_fields{index_fields}; % selected field
     2146            if ~strcmp(FieldName,'get_field...')
     2147                TestVelType=get(handles.FixVelType,'Value');
     2148                if TestVelType
     2149                    VelType=setfield(handles);% read the velocity type.
     2150                end
    21102151            end
    2111         end
    2112     elseif isfield(UvData,'MovieObject')
    2113         ObjectName=UvData.MovieObject;
    2114         FileType='movie';
    2115     elseif isequal(lower(Ext),'.avi')
    2116         FileType='avi';
    2117     elseif isequal(lower(Ext),'.vol')
    2118         FileType='vol';
    2119         if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx')
    2120             ParamIn.Npy=UvData.XmlData.Npy;
    2121             ParamIn.Npx=UvData.XmlData.Npx;
    2122         else
    2123             errormsg='Npx and Npy need to be defined in the xml file for volume images .vol';
    2124             return
    2125         end
    2126     else
    2127        form=imformats(Ext(2:end));
    2128        if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
    2129            if isequal(NomType,'*');
    2130                FileType='multimage';
    2131            else
    2132                FileType='image';
    2133            end
    2134        end
     2152            if strcmp(FieldName,'velocity')
     2153                list_code=get(handles.ListColorCode,'String');% list menu fields
     2154                index_code=get(handles.ListColorCode,'Value');% selected string index
     2155                if  ~strcmp(list_code{index_code},'black') &&  ~strcmp(list_code{index_code},'white')
     2156                    list_code=get(handles.ListColorScalar,'String');% list menu fields
     2157                    index_code=get(handles.ListColorScalar,'Value');% selected string index
     2158                    ParamIn.ColorVar= list_code{index_code}; % selected field
     2159                end
     2160            end
     2161        case 'video'
     2162            ObjectName=UvData.MovieObject;
     2163           
     2164        case 'vol' %TODO: update
     2165            if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx')
     2166                ParamIn.Npy=UvData.XmlData.Npy;
     2167                ParamIn.Npx=UvData.XmlData.Npx;
     2168            else
     2169                errormsg='Npx and Npy need to be defined in the xml file for volume images .vol';
     2170                return
     2171            end
    21352172    end
    21362173    ParamIn.FieldName=FieldName;
     
    25782615%PlotParam{1}=read_plot_param(handles);%read plotting parameters on the uvmat interfac
    25792616PlotParam{1}=read_GUI(handles.uvmat);
     2617PlotParam{1}.Coordinates
    25802618if ~isfield(PlotParam{1},'Vectors')
    25812619    PlotParam{1}.Vectors.MaxVec=1;
     
    27842822end
    27852823if isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'Time')
    2786     [P,F,str1,str2,str_a,str_b,E]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);
    2787     num_i2=str2double(str2);
    2788     if isnan(num_i2)
     2824    [~,~,~,num_i1,num_i2,num_j1,num_j2]=fileparts_uvmat(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);
     2825  %  [P,F,str1,str2,str_a,str_b,E]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);
     2826    if isempty(num_i2)
    27892827        num_i2=num_i1;
    27902828    end
    2791     num_j1=str2double(str_a);
    2792     if isnan(num_j1)
     2829    if isempty(num_j1)
    27932830        num_j1=1;
    27942831    end
    2795     num_j2=str2double(str_b);
    2796     if isnan(num_j2)
     2832    if isempty(num_j2)
    27972833        num_j2=num_j1;
    27982834    end
    2799     num_i1=str2double(str1);
    28002835    siz=size(UvData.XmlData_1.Time);
    28012836    if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2)
     
    31463181%read the rootfile input display
    31473182[FileName,RootPath,FileBase,FileIndices,FileExt]=read_file_boxes(handles);
    3148 [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt]);
     3183[~,~,~,i1,i2,j1,j2,~,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]);
     3184% [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt]);
    31493185NomTypeNew=NomType;%default
    31503186if isequal(field,'image')
     
    31563192        NomTypeNew='_1';
    31573193    end
    3158     imagename=name_generator(FileBase,str2double(str1),str2double(str_a),'.png',NomTypeNew,1,str2double(str2),str2double(str_b),'');
     3194    imagename=name_generator(FileBase,i1,j1,'.png',NomTypeNew,1,i2,j2,'');
    31593195    if ~exist(imagename,'file')
    31603196        [FileName,PathName] = uigetfile( ...
     
    31863222    end
    31873223end
    3188 indices=name_generator('',str2double(str1),str2double(str_a),'',NomTypeNew,1,str2double(str2),str2double(str_b),'');
     3224indices=name_generator('',i1,j1,'',NomTypeNew,1,i2,j2,'');
    31893225set(handles.FileIndex,'String',indices)
    31903226set(handles.NomType,'String',NomTypeNew)
     
    32263262%read the rootfile input display
    32273263[FileName,RootPath,FileBase,FileIndices,FileExt_1]=read_file_boxes_1(handles);
    3228 [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]);
     3264[~,~,~,i1,i2,j1,j2,~,NomType_1]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt_1]);
     3265% [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]);
    32293266if isempty(NomType_1)|| strcmp(NomType_1,'')
    32303267    [FileName,RootPath,FileBase,FileIndices,FileExt_1]=read_file_boxes(handles);
    3231     [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]);
     3268    [~,~,~,i1,i2,j1,j2,~,NomType_1]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt_1]);
     3269 %   [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]);
    32323270end
    32333271NomTypeNew=NomType_1;%default
     
    32803318        end 
    32813319    end
    3282     imagename=name_generator(FileBase,str2double(str1),str2double(str_a),'.png',NomTypeNew,1,str2double(str2),str2double(str_b),'');
     3320    imagename=name_generator(FileBase,i1,j1,'.png',NomTypeNew,1,i2,j2,'');
    32833321    if ~exist(imagename,'file')
    32843322        [FileName,PathName] = uigetfile( ...
Note: See TracChangeset for help on using the changeset viewer.