Changeset 1184 for trunk/src/uvmat.m
- Timestamp:
- Nov 6, 2025, 7:03:02 PM (4 weeks ago)
- File:
-
- 1 edited
-
trunk/src/uvmat.m (modified) (55 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r1183 r1184 40 40 % .FileName_1: name of the current second field (used to detect a constant field during file scanning) 41 41 % .FileType: current file type, as defined by the fct get_file_type.m) 42 % .i1_series,.i2_series,.j1_series,.j1_series: series of i1,i2,j1,j2 indices detected in the input dir,set by the fct find_file_series42 % .i1_series,.i2_series,.j1_series,.j1_series: series of num_i1,num_i2,num_j1,num_j2 indices detected in the input dir,set by the fct find_file_series 43 43 % .MovieObject: current movie object 44 44 % .TimeUnit: unit for time … … 280 280 end 281 281 if isfield(input,'TimeIndex') 282 set(handles. i1,num2str(input.TimeIndex))282 set(handles.num_i1,num2str(input.TimeIndex)) 283 283 end 284 284 if isfield(input,'FieldsString') … … 2124 2124 i1_mod=floor(i1_mod/(NbField_j -1))+1; 2125 2125 end 2126 set(handles. i1,'String',num2str(i1_mod));%update the counters2127 set(handles. j1,'String',num2str(j1));%update the counters2126 set(handles.num_i1,'String',num2str(i1_mod));%update the counters 2127 set(handles.num_j1,'String',num2str(j1));%update the counters 2128 2128 check_index=true; 2129 2129 end … … 2131 2131 end 2132 2132 if ~check_index 2133 set(handles. i1,'String',num2str(i1));%update the counters2134 set(handles. i2,'String',num2str(i2));2135 set(handles. j1,'String',num2str(j1));2136 set(handles. j2,'String',num2str(j2));2133 set(handles.num_i1,'String',num2str(i1));%update the counters 2134 set(handles.num_i2,'String',num2str(i2)); 2135 set(handles.num_j1,'String',num2str(j1)); 2136 set(handles.num_j2,'String',num2str(j2)); 2137 2137 end 2138 2138 … … 2141 2141 function NomType_Callback(hObject, eventdata, handles) 2142 2142 %------------------------------------------------------------------------ 2143 i1=str2double(get(handles. i1,'String'));2144 i2=str2double(get(handles. i2,'String'));2145 j1=str2double(get(handles. j1,'String'));2146 j2=str2double(get(handles. j2,'String'));2143 i1=str2double(get(handles.num_i1,'String')); 2144 i2=str2double(get(handles.num_i2,'String')); 2145 j1=str2double(get(handles.num_j1,'String')); 2146 j2=str2double(get(handles.num_j2,'String')); 2147 2147 NomType=get(hObject,'String'); 2148 2148 if strcmp(NomType,'level') 2149 FileIndex=str2double(get(handles. i1,'String'));2149 FileIndex=str2double(get(handles.num_i1,'String')); 2150 2150 else 2151 2151 FileIndex=fullfile_uvmat('','','','',get(handles.NomType,'String'),i1,i2,j1,j2); … … 2159 2159 function NomType_1_Callback(hObject, eventdata, handles) 2160 2160 %------------------------------------------------------------------------ 2161 i1=str2double(get(handles. i1,'String'));2162 i2=str2double(get(handles. i2,'String'));2163 j1=str2double(get(handles. j1,'String'));2164 j2=str2double(get(handles. j2,'String'));2161 i1=str2double(get(handles.num_i1,'String')); 2162 i2=str2double(get(handles.num_i2,'String')); 2163 j1=str2double(get(handles.num_j1,'String')); 2164 j2=str2double(get(handles.num_j2,'String')); 2165 2165 NomType=get(hObject,'String'); 2166 2166 if strcmp(NomType,'level') 2167 FileIndex=str2double(get(handles. i1,'String'));2167 FileIndex=str2double(get(handles.num_i1,'String')); 2168 2168 else 2169 2169 FileIndex=fullfile_uvmat('','','','',get(handles.NomType_1,'String'),i1,i2,j1,j2); … … 2174 2174 2175 2175 %------------------------------------------------------------------------ 2176 % --- Executes on button press in InputFileREFRESH.2176 % --- Executes on press in button tagged 'InputFileREFRESH'. 2177 2177 function InputFileREFRESH_Callback(hObject, eventdata, handles) 2178 2178 %------------------------------------------------------------------------ … … 2180 2180 set(handles.uvmat,'Pointer','watch') % set the mouse pointer to 'watch' 2181 2181 drawnow 2182 % get the current input file name: 2183 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 2184 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 2185 %[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]); 2182 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);% get the current input file name: 2186 2183 errormsg=''; 2187 if isempty(RootFile) 2184 if isempty(RootFile)% open the file browser if the input file is not defined 2188 2185 fileinput=uigetfile_uvmat('pick an input file',fullfile(RootPath,SubDir)); 2189 2186 hh=dir(fileinput); … … 2198 2195 end 2199 2196 end 2200 else 2201 % initiate the input file series and refresh the current field view: 2197 else % initiate the input file series and refresh the current field view: 2202 2198 [FileInfo,VideoObject]=get_file_info(fullfile(RootPath,SubDir,[RootFile FileIndices FileExt])); 2203 2199 errormsg=update_rootinfo(handles,RootPath,SubDir,[RootFile FileIndices FileExt],FileInfo,VideoObject,1); … … 2208 2204 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles); 2209 2205 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 2210 [RootPath,SubDir,~,i1_series, i2_series,j1_series,j2_series,~,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]);2206 [RootPath,SubDir,~,i1_series,~,~,~,~,FileInfo,MovieObject]=find_file_series(fullfile(RootPath,SubDir),[RootFile FileIndices FileExt]); 2211 2207 if isempty(i1_series) 2212 2208 fileinput=uigetfile_uvmat('pick an input file for the second line',fullfile(RootPath,SubDir)); … … 2311 2307 %[FilePath,FileName,FileExt]=fileparts(fileinput); 2312 2308 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 2313 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists2309 % the root name and indices may be corrected by including the first index num_i1 if a corresponding xml file exists 2314 2310 2315 2311 set(handles_RootPath,'String',RootPath); … … 2328 2324 if input_line==1 2329 2325 % fill file index counters if the first file series is opened 2330 set(handles. i1,'String',num2str(i1));2331 set(handles. i2,'String',num2str(i2));2332 set(handles. j1,'String',num2stra(j1,NomType));2333 set(handles. j2,'String',num2stra(j2,NomType));2326 set(handles.num_i1,'String',num2str(i1)); 2327 set(handles.num_i2,'String',num2str(i2)); 2328 set(handles.num_j1,'String',num2stra(j1,NomType)); 2329 set(handles.num_j2,'String',num2stra(j2,NomType)); 2334 2330 if isfield(FileInfo,'MaskFile') 2335 2331 if exist(FileInfo.MaskFile,'file') … … 2350 2346 end 2351 2347 else %read the current field index to synchronise with the first series 2352 i1_s=str2double(get(handles. i1,'String'));2353 i2_0=str2double(get(handles. i2,'String'));2348 i1_s=str2double(get(handles.num_i1,'String')); 2349 i2_0=str2double(get(handles.num_i2,'String')); 2354 2350 if ~isempty(i2_0) 2355 2351 i2_s=i2_0; … … 2357 2353 i2_s=i2; 2358 2354 end 2359 j1_0=stra2num(get(handles. j1,'String'));2355 j1_0=stra2num(get(handles.num_j1,'String')); 2360 2356 if ~isempty(j1_0) 2361 2357 j1_s=j1_0; … … 2363 2359 j1_s=j1; 2364 2360 end 2365 j2_0=stra2num(get(handles. j2,'String'));2361 j2_0=stra2num(get(handles.num_j2,'String')); 2366 2362 if ~isempty(j2_0) 2367 2363 j2_s=j2_0; … … 2444 2440 XmlFileName=find_imadoc(RootPath,SubDir);% search the appropriate ImaDoc xml file 2445 2441 [~,XmlName]=fileparts(XmlFileName); 2446 2447 2442 CheckIndexing=false;% test for virtual indexing of frames different from the file name index, false by default 2448 2443 if isempty(XmlFileName) %no ImaDoc xml file detected … … 2453 2448 set(handles.view_xml,'String','view xml') 2454 2449 drawnow 2455 [XmlData,warntext]=imadoc2struct(XmlFileName); 2450 [XmlData,warntext]=imadoc2struct(XmlFileName);% open xml file ImaDoc 2456 2451 if ~isempty(warntext) 2457 2452 msgbox_uvmat('WARNING',warntext) … … 2474 2469 end 2475 2470 if CheckIndexing 2476 set(handles.MenuRelabelFrames,'checked','on')% activate the relabel tool by default2471 set(handles.MenuRelabelFrames,'checked','on')% activate the relabel tool by default 2477 2472 else 2478 2473 set(handles.MenuRelabelFrames,'checked','off') … … 2488 2483 TimeUnit='';%default 2489 2484 TimeName='';%default 2485 state_j='off'; % no visualisation of the j index by default 2490 2486 2491 2487 %% get the file series … … 2497 2493 j1_series=[]; 2498 2494 j2_series=[]; 2499 nbfield =[];2495 nbfield_i=[]; 2500 2496 nbfield_j=[]; 2501 2497 FileInfo=XmlData.FileInfo; 2502 % if iscell(XmlData.FileSeries.FileName)(handles.i1,'String','1') 2503 set(handles.i1,'String','1')% the index does not correspond to file name index anymore 2504 set(handles.j1,'String','1') 2498 set(handles.num_i1,'String','1')% the index does not correspond to file name index anymore, set i=1, j=1 by default as s start 2499 set(handles.num_j1,'String','1') 2505 2500 else % scan the input folder to get the list of existing files and NomType 2506 2501 [~,~,~,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject]=... 2507 2502 find_file_series(fullfile(RootPath,SubDir),FileName); 2508 nbfield =max(max(max(i2_series)));% total number of fields (i index)2509 if isempty(nbfield )2510 nbfield =max(max(max(i1_series)));2503 nbfield_i=max(max(max(i2_series)));% total number of fields (i index) 2504 if isempty(nbfield_i) 2505 nbfield_i=max(max(max(i1_series))); 2511 2506 end 2512 2507 nbfield_j=max(max(max(j2_series)));% number of fields along j index … … 2515 2510 end 2516 2511 if ~isempty(j1_series)&& ~strcmp(NomType,'*')% the j index is used to label the frame in multimage series 2517 set(handles.j1,'String','1') 2512 set(handles.num_j1,'String','1') 2513 state_j='on'; 2518 2514 elseif strcmp(FileInfo.FieldType,'image') && ~isequal(FileInfo.NumberOfFrames,1) 2519 set(handles. i1,'String','1')2515 set(handles.num_i1,'String','1') 2520 2516 end 2521 2517 end … … 2525 2521 set(handles.NomType_1,'String',NomType) 2526 2522 end 2527 % if CheckIndexing2528 % % i1=str2double(get(handles.FileIndex,'String'));2529 % % if isnan(i1)2530 % % i1=1;2531 % % else2532 % % i1=(i1-XmlData.FileSeries.FirstFileIndex)*XmlData.FileSeries.NbFramePerFile+1;%frame index deduced from input file index2533 % % end2534 % % if strcmp(TimeName,'xml')% indices i and j2535 % % j1=mod(i1-1,nbfield_j)+1;2536 % % i1=floor((i1-1)/nbfield_j)+1;2537 % % set(handles.j1,'String',num2str(j1))2538 % % end2539 % % set(handles.i1,'String',num2str(i1))2540 %2541 % end2542 2523 2543 2524 … … 2562 2543 TimeName='xml';%Time possibly documented by the xml file (but priority to the opened file if available) 2563 2544 end 2564 2565 if ~CheckIndexing && isfield(FileInfo,'FrameRate')% frame rate given in the file (case of video data) 2566 TimeUnit='s'; 2567 if isempty(j1_series) %frame index along i 2568 XmlData.Time=zeros(FileInfo.NumberOfFrames+1,2); 2569 XmlData.Time(:,2)=(0:1/FileInfo.FrameRate:(FileInfo.NumberOfFrames)/FileInfo.FrameRate)'; 2570 set(handles.i1,'String','1')% set the frame index to 1 to start the movie 2545 if CheckIndexing 2546 i1=str2double(get(handles.FileIndex,'String')); 2547 if isnan(i1) 2548 i1=1; 2571 2549 else 2572 XmlData.Time=[0;ones(size(i1_series,3)-1,1)]*(0:1/FileInfo.FrameRate:(FileInfo.NumberOfFrames)/FileInfo.FrameRate); 2550 FirstFileIndex=1; 2551 if isfield(XmlData.FileSeries,'FirstFileIndex') 2552 FirstFileIndex=XmlData.FileSeries.FirstFileIndex; 2553 end 2554 i1=(i1-FirstFileIndex)*XmlData.FileSeries.NbFramePerFile+1;%frame index deduced from input file index 2555 end 2556 if isfield(XmlData,'Time') && size(XmlData.Time,2)>1% 2557 nbfield_j=size(XmlData.Time,2)-1; 2558 nbfield_i=size(XmlData.Time,1)-1; 2559 j1=mod(i1-1,nbfield_j)+1; 2560 i1=floor((i1-1)/nbfield_j)+1; 2561 set(handles.num_j1,'String',num2str(j1)) 2562 state_j='on'; 2563 end 2564 set(handles.num_i1,'String',num2str(i1)) 2565 else 2566 if isfield(FileInfo,'FrameRate')% frame rate given in the file (case of video data) 2567 TimeUnit='s'; 2568 if isempty(j1_series) %frame index along i 2569 XmlData.Time=zeros(FileInfo.NumberOfFrames+1,2); 2570 XmlData.Time(:,2)=(0:1/FileInfo.FrameRate:(FileInfo.NumberOfFrames)/FileInfo.FrameRate)'; 2571 set(handles.num_i1,'String','1')% set the frame index to 1 to start the movie 2572 else 2573 XmlData.Time=[0;ones(size(i1_series,3)-1,1)]*(0:1/FileInfo.FrameRate:(FileInfo.NumberOfFrames)/FileInfo.FrameRate); 2574 state_j='on'; 2575 end 2573 2576 end 2574 2577 end … … 2618 2621 %% store last index in handles.MaxIndex_i and .MaxIndex_j 2619 2622 last_i_cell=get(handles.MaxIndex_i,'String'); 2620 if isempty(nbfield )2623 if isempty(nbfield_i) 2621 2624 last_i_cell{input_line}=''; 2622 2625 else 2623 last_i_cell{input_line}=num2str(nbfield );2626 last_i_cell{input_line}=num2str(nbfield_i); 2624 2627 end 2625 2628 set(handles.MaxIndex_i,'String',last_i_cell) … … 2629 2632 else 2630 2633 last_j_cell{input_line}=num2str(nbfield_j); 2634 2631 2635 end 2632 2636 set(handles.MaxIndex_j,'String',last_j_cell); … … 2745 2749 end 2746 2750 otherwise 2747 set(handles_Fields,'Value',1) % set menu to 'image' 2751 set(handles_Fields,'Value',1) % set menu to 'image'j1_series 2748 2752 set(handles_Fields,'String',{'image'}) 2749 2753 %set(handles.Coord_x,'Value',1); … … 2757 2761 %% set index navigation options 2758 2762 scan_option='i';%default 2759 state_j='off'; %default2763 %state_j='off'; %default 2760 2764 if input_line==2 2761 2765 if get(handles.scan_j,'Value') 2762 2766 scan_option='j'; %keep the scan option for the second file series 2763 2767 end 2764 if strcmp(get(handles. j1,'Visible'),'on')2768 if strcmp(get(handles.num_j1,'Visible'),'on') 2765 2769 state_j='on'; 2766 2770 end … … 2799 2803 end 2800 2804 set(handles.scan_j,'Visible',state_j) 2801 set(handles. j1,'Visible',state_j)2802 set(handles. j2,'Visible',state_j)2805 set(handles.num_j1,'Visible',state_j) 2806 set(handles.num_j2,'Visible',state_j) 2803 2807 set(handles.MaxIndex_j,'Visible',state_j); 2804 2808 set(handles.j_text,'Visible',state_j); … … 2850 2854 2851 2855 %------------------------------------------------------------------------ 2852 function i1_Callback(hObject, eventdata, handles)2856 function num_i1_Callback(hObject, eventdata, handles) 2853 2857 %------------------------------------------------------------------------ 2854 2858 update_ij(handles,1) 2855 2859 2856 2860 %------------------------------------------------------------------------ 2857 function i2_Callback(hObject, eventdata, handles)2861 function num_i2_Callback(hObject, eventdata, handles) 2858 2862 %------------------------------------------------------------------------ 2859 2863 update_ij(handles,2) 2860 2864 2861 2865 %------------------------------------------------------------------------ 2862 function j1_Callback(hObject, eventdata, handles)2866 function num_j1_Callback(hObject, eventdata, handles) 2863 2867 %------------------------------------------------------------------------ 2864 2868 update_ij(handles,3) 2865 2869 2866 2870 %------------------------------------------------------------------------ 2867 function j2_Callback(hObject, eventdata, handles)2871 function num_j2_Callback(hObject, eventdata, handles) 2868 2872 %------------------------------------------------------------------------ 2869 2873 update_ij(handles,4) 2870 2874 2871 2875 %------------------------------------------------------------------------ 2872 %--- update the index display after action on edit boxes i1, i2, j1 orj22876 %--- update the index display after action on edit boxes num_i1, num_i2, num_j1 or num_j2 2873 2877 %------------------------------------------------------------------------ 2874 2878 function update_ij(handles,index_rank) … … 2878 2882 2879 2883 if strcmp(NomType,'level') 2880 index_string=get(handles. i1,'String');2884 index_string=get(handles.num_i1,'String'); 2881 2885 else 2882 2886 index_string=get(handles.FileIndex,'String'); 2883 2887 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'FileSeries') 2884 i1=str2double(get(handles. i1,'String'));2885 j1=str2double(get(handles. j1,'String'));2888 i1=str2double(get(handles.num_i1,'String')); 2889 j1=str2double(get(handles.num_j1,'String')); 2886 2890 NbField_j_cell=get(handles.MaxIndex_j,'String'); 2887 2891 NbField_j=str2double(NbField_j_cell{1}); 2888 [RootFile,index_string,FrameIndex]=index2filename(UvData.XmlData{1}.FileSeries,i1,j1,NbField_j); 2892 RootFile=index2filename(UvData.XmlData{1}.FileSeries,i1,j1,NbField_j); 2893 index_string=''; 2889 2894 set(handles.RootFile,'String',RootFile) 2890 2895 else … … 2892 2897 switch index_rank 2893 2898 case 1 2894 index_string=fullfile_uvmat('','','','',NomType,stra2num(get(handles. i1,'String')),i2,j1,j2);2899 index_string=fullfile_uvmat('','','','',NomType,stra2num(get(handles.num_i1,'String')),i2,j1,j2); 2895 2900 case 2 2896 index_string=fullfile_uvmat('','','','',NomType,i1,stra2num(get(handles. i2,'String')),j1,j2);2901 index_string=fullfile_uvmat('','','','',NomType,i1,stra2num(get(handles.num_i2,'String')),j1,j2); 2897 2902 case 3 2898 index_string=fullfile_uvmat('','','','',NomType,i1,i2,stra2num(get(handles. j1,'String')),j2);2903 index_string=fullfile_uvmat('','','','',NomType,i1,i2,stra2num(get(handles.num_j1,'String')),j2); 2899 2904 case 4 2900 index_string=fullfile_uvmat('','','','',NomType,i1,i2,j1,stra2num(get(handles. j2,'String')));2905 index_string=fullfile_uvmat('','','','',NomType,i1,i2,j1,stra2num(get(handles.num_j2,'String'))); 2901 2906 end 2902 2907 end … … 2908 2913 NomType_1=get(handles.NomType_1,'String'); 2909 2914 index_string_1=get(handles.FileIndex_1,'String'); 2910 [ tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(index_string_1);% the index_string for the second series taken from FileIndex_12915 [~,~,~,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(index_string_1);% the index_string for the second series taken from FileIndex_1 2911 2916 switch index_rank 2912 2917 case 1 2913 index_string_1=fullfile_uvmat('','','','',NomType_1,stra2num(get(handles. i1,'String')),i2_1,j1_1,j2_1);2918 index_string_1=fullfile_uvmat('','','','',NomType_1,stra2num(get(handles.num_i1,'String')),i2_1,j1_1,j2_1); 2914 2919 case 2 2915 index_string_1=fullfile_uvmat('','','','',NomType_1,i1_1,stra2num(get(handles. i2,'String')),j1_1,j2_1);2920 index_string_1=fullfile_uvmat('','','','',NomType_1,i1_1,stra2num(get(handles.num_i2,'String')),j1_1,j2_1); 2916 2921 case 3 2917 index_string_1=fullfile_uvmat('','','','',NomType_1,i1_1,i2_1,stra2num(get(handles. j1,'String')),j2_1);2922 index_string_1=fullfile_uvmat('','','','',NomType_1,i1_1,i2_1,stra2num(get(handles.num_j1,'String')),j2_1); 2918 2923 case 4 2919 index_string_1=fullfile_uvmat('','','','',NomType_1,i1_1,i2_1,j1_1,stra2num(get(handles. j2,'String')));2924 index_string_1=fullfile_uvmat('','','','',NomType_1,i1_1,i2_1,j1_1,stra2num(get(handles.num_j2,'String'))); 2920 2925 end 2921 2926 set(handles.FileIndex_1,'String',index_string_1) … … 2947 2952 %------------------------------------------------------------------------ 2948 2953 mode=get(handles.slices,'String'); 2949 nb_slice_str=get(handles.num_NbSlice,'String');2950 2954 if strcmp(mode,'volume') 2951 z=stra2num(get(handles. j1,'String'));2952 else 2953 num=str2double(get(handles. i1,'String'));2955 z=stra2num(get(handles.num_j1,'String')); 2956 else 2957 num=str2double(get(handles.num_i1,'String')); 2954 2958 nbslice=str2double(get(handles.num_NbSlice,'String')); 2955 2959 z=mod(num-1,nbslice)+1; … … 2980 2984 FileXml=fullfile(RootPath,[regexprep(SubDir,'\..+$','') '.xml']); 2981 2985 end 2982 heditxml=editxml(FileXml);2986 editxml(FileXml); 2983 2987 end 2984 2988 … … 2990 2994 if isequal(get(handles.CheckMask,'Value'),1) 2991 2995 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 2992 if isempty(regexp(RootPath,'^http://' ))2996 if isempty(regexp(RootPath,'^http://', 'once'))% not opendap input file 2993 2997 fileinput=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line) 2994 2998 else … … 3029 3033 [MaskPath,FileName,FileExt]=fileparts(filemask); 3030 3034 Mask.File=filemask; 3031 [ RootPath,SubDir,RootFile,i1_series,i2,j1,j2,NomType]=find_file_series(MaskPath,[FileName FileExt]);3035 [~,~,~,i1_series,~,~,~,NomType]=find_file_series(MaskPath,[FileName FileExt]); 3032 3036 Mask.NbSlice=[];%default 3033 3037 Mask.VolumeScan=0;% TO UPDATE *** … … 3045 3049 msgbox_uvmat(['ERROR','error in displaying mask, ' errormsg]); 3046 3050 end 3047 testmask=1;3048 3051 end 3049 3052 else % desactivate mask display … … 3073 3076 if isfield(MaskInfo,'NbSlice')&& ~isempty(MaskInfo.NbSlice) 3074 3077 if isfield(MaskInfo,'VolumeScan') && MaskInfo.VolumeScan 3075 MaskIndex_i=str2double(get(handles. j1,'String'));3078 MaskIndex_i=str2double(get(handles.num_j1,'String')); 3076 3079 else 3077 MaskIndex_i=mod(str2double(get(handles. i1,'String'))-1,MaskInfo.NbSlice)+1;3080 MaskIndex_i=mod(str2double(get(handles.num_i1,'String'))-1,MaskInfo.NbSlice)+1; 3078 3081 end 3079 3082 MaskName=[MaskInfo.File '_' num2str(MaskIndex_i) '.png']; … … 3274 3277 UvData=get(handles.uvmat,'UserData'); 3275 3278 if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'FileSeries')% case of indexing documented by the xml file 3276 i1=str2double(get(handles. i1,'String'));3277 j1=str2double(get(handles. j1,'String'));%read the field indices (for movie, it is not given by the file name)3279 i1=str2double(get(handles.num_i1,'String')); 3280 j1=str2double(get(handles.num_j1,'String'));%read the field indices (for movie, it is not given by the file name) 3278 3281 i2=[];j2=[]; 3279 3282 else 3280 3283 [~,~,~,i1,i2,j1,j2]=fileparts_uvmat(InputFile.FileIndex);% check back the indices used 3281 3284 if isempty(i1)% no i index set by the input file name 3282 i1=str2double(get(handles. i1,'String'));%read the field indices (for movie, it is not given by the file name)3283 elseif isempty(j1) && strcmp(get(handles. j1,'Visible'),'on')3284 j1=str2double(get(handles. j1,'String'));%case of indexed movie3285 i1=str2double(get(handles.num_i1,'String'));%read the field indices (for movie, it is not given by the file name) 3286 elseif isempty(j1) && strcmp(get(handles.num_j1,'Visible'),'on') 3287 j1=str2double(get(handles.num_j1,'String'));%case of indexed movie 3285 3288 end 3286 3289 end … … 3290 3293 [~,~,~,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(InputFile.FileIndex_1);% the indices for the second series taken from FileIndex_1 3291 3294 if isempty(i1_1) 3292 i1_1=str2double(get(handles. i1,'String'));%read the field indices (for movie, it is not given by the file name)3293 elseif isempty(j1_1) && strcmp(get(handles. j1,'Visible'),'on')3294 j1_1=str2double(get(handles. j1,'String'));%case of indexed movie3295 i1_1=str2double(get(handles.num_i1,'String'));%read the field indices (for movie, it is not given by the file name) 3296 elseif isempty(j1_1) && strcmp(get(handles.num_j1,'Visible'),'on') 3297 j1_1=str2double(get(handles.num_j1,'String'));%case of indexed movie 3295 3298 end 3296 3299 else … … 3302 3305 set(handles.CheckFixPair,'Value',0) 3303 3306 end 3304 %CheckFixPair=get(handles.CheckFixPair,'Value')||(isempty( i2)&& isempty(j2));3305 3306 % the pair i1-i2 or j1-j2 is imposed (check box CheckFixPair selected)3307 %CheckFixPair=get(handles.CheckFixPair,'Value')||(isempty(num_i2)&& isempty(num_j2)); 3308 3309 % the pair num_i1-num_i2 or num_j1-num_j2 is imposed (check box CheckFixPair selected) 3307 3310 if isnumeric(increment) 3308 3311 if get(handles.scan_i,'Value')==1 % case of scanning along index i … … 3322 3325 end 3323 3326 3324 % the pair i1-i2 or j1-j2 is free (check box CheckFixPair not selected): the list of existing indices recorded in UvData is used3327 % the pair num_i1-num_i2 or num_j1-num_j2 is free (check box CheckFixPair not selected): the list of existing indices recorded in UvData is used 3325 3328 else 3326 3329 ref_i=i1; … … 3465 3468 3466 3469 %% update the index counters if the index move is successfull 3467 3468 3470 if isempty(errormsg) 3469 set(handles. i1,'String',num2stra(i1,NomType,1));3471 set(handles.num_i1,'String',num2stra(i1,NomType,1)); 3470 3472 if isequal(i2,i1) 3471 set(handles. i2,'String','');3473 set(handles.num_i2,'String',''); 3472 3474 else 3473 set(handles. i2,'String',num2stra(i2,NomType,1));3474 end 3475 set(handles. j1,'String',num2stra(j1,NomType,2));3475 set(handles.num_i2,'String',num2stra(i2,NomType,1)); 3476 end 3477 set(handles.num_j1,'String',num2stra(j1,NomType,2)); 3476 3478 if isequal(j2,j1) 3477 set(handles. j2,'String','');3479 set(handles.num_j2,'String',''); 3478 3480 else 3479 set(handles. j2,'String',num2stra(j2,NomType,2));3481 set(handles.num_j2,'String',num2stra(j2,NomType,2)); 3480 3482 end 3481 3483 if strcmp(NomType,'level') … … 3496 3498 set(handles.FileIndex_1,'String',indices_1); 3497 3499 end 3498 if isempty(i2), set(handles. i2,'String',''); end % suppress the second index display if not used3499 if isempty(j2), set(handles. j2,'String',''); end3500 if isempty(i2), set(handles.num_i2,'String',''); end % suppress the second index display if not used 3501 if isempty(j2), set(handles.num_j2,'String',''); end 3500 3502 end 3501 3503 … … 3508 3510 if ~get(handles.movie_pair,'value') 3509 3511 set(handles.movie_pair,'BusyAction','Cancel')%stop movie pair if button is 'off' 3510 set(handles. i2,'String','')% the second i index display is suppressed3511 set(handles. j2,'String','')% the second j index display is suppressed3512 set(handles.num_i2,'String','')% the second i index display is suppressed 3513 set(handles.num_j2,'String','')% the second j index display is suppressed 3512 3514 set(handles.Dt_txt,'String','')% the time interval indication is suppressed 3513 3515 return … … 3523 3525 3524 3526 %% make movie until movie speed is set to 0 or STOP is activated 3525 hima=findobj(handles.PlotAxes,'Tag','ima');% %handles.PlotAxes =main plotting window (A GENERALISER)3526 3527 set(handles.STOP,'Visible','on') 3527 3528 set(handles.speed,'Visible','on') … … 3541 3542 end 3542 3543 pause(1.02-get(handles.speed,'Value'));% wait for next image 3543 get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue')3544 3544 end 3545 3545 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 3546 3546 set(handles.movie_pair,'Value',0) 3547 3547 set(handles.Dt_txt,'String','') 3548 3549 3548 set(handles.runplus,'BackgroundColor',[1 0 0])%paint the command button back in red 3550 3549 3551 3550 3552 3551 %------------------------------------------------------------------------ 3553 % --- Executes on button press in InputFileREFRESH.3552 % --- Executes on press in button tagged 'REFRESH'. 3554 3553 function REFRESH_Callback(hObject, eventdata, handles) 3555 3554 %------------------------------------------------------------------------ … … 3558 3557 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);%read the features of the input file name (first line) 3559 3558 [~,~,~,~,i2,~,j2]=fileparts_uvmat(FileIndex);% check back the indices used 3560 if isempty(i2), set(handles. i2,'String',''); end % suppress the second i index display if not used3561 if isempty(j2), set(handles. j2,'String',''); end % suppress the second j index display if not used3562 if isempty(regexp(RootPath,'^http://','once')) 3559 if isempty(i2), set(handles.num_i2,'String',''); end % suppress the second i index display if not used 3560 if isempty(j2), set(handles.num_j2,'String',''); end % suppress the second j index display if not used 3561 if isempty(regexp(RootPath,'^http://','once'))% if the input is not opendap 3563 3562 filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line) 3564 3563 else … … 3571 3570 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; %build the input file name (second line) 3572 3571 end 3573 num_i1=stra2num(get(handles. i1,'String'));3574 num_i2=stra2num(get(handles. i2,'String'));3575 num_j1=stra2num(get(handles. j1,'String'));3576 num_j2=stra2num(get(handles. j2,'String'));3577 [ tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndex_1);% get the indices of the second series from the string FileIndex_13572 num_i1=stra2num(get(handles.num_i1,'String')); 3573 num_i2=stra2num(get(handles.num_i2,'String')); 3574 num_j1=stra2num(get(handles.num_j1,'String')); 3575 num_j2=stra2num(get(handles.num_j2,'String')); 3576 [~,~,~,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndex_1);% get the indices of the second series from the string FileIndex_1 3578 3577 if isempty(j1_1)% case of movies, the index is not given by file index 3579 3578 j1_1=num_j1; 3580 3579 end 3581 % in case of movies the index is set by edit boxes i1 orj1 (case of movies indexed by index i)3580 % in case of movies the index is set by edit boxes num_i1 or num_j1 (case of movies indexed by index i) 3582 3581 errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1); 3583 3582 ResizeFcn(handles.uvmat,[],handles) … … 3661 3660 frame_index=1;%default 3662 3661 if UvData.FileInfo{1}.NumberOfFrames>1 3662 % if strcmp(NomType,'*') 3663 % if num_i1>UvData.FileInfo{1}.NumberOfFrames 3664 % errormsg='specified frame index exceeds file content'; 3665 % return 3666 % else 3667 % frame_index=num_i1;%frame index from a single movies or multimage 3668 % end 3669 % else 3670 % if num_j1>UvData.FileInfo{1}.NumberOfFrames 3671 % errormsg='specified frame index exceeds file content'; 3672 % return 3673 % else 3674 % frame_index=num_j1;% frame index from a set of indexed movies 3675 % end 3676 % end 3663 3677 if strcmp(NomType,'*') 3664 if num_i1>UvData.FileInfo{1}.NumberOfFrames 3665 errormsg='specified frame index exceeds file content'; 3666 return 3667 else 3668 frame_index=num_i1;%frame index from a single movies or multimage 3669 end 3678 frame_index=num_i1;%frame index from a single movies or multimage 3670 3679 else 3671 if num_j1>UvData.FileInfo{1}.NumberOfFrames 3672 errormsg='specified frame index exceeds file content'; 3673 return 3674 else 3675 frame_index=num_j1;% frame index from a set of indexed movies 3676 end 3680 frame_index=num_j1;% frame index from a set of indexed movies 3677 3681 end 3678 3682 end … … 3988 3992 % TODO: look for time unit attribute 3989 3993 elseif ~isempty(regexp(TimeName,'^dim:', 'once')) 3990 abstime=str2double(get(handles. i1,'String'));3994 abstime=str2double(get(handles.num_i1,'String')); 3991 3995 TimeUnit='index'; 3992 3996 end … … 4873 4877 set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])% put file index in the root name 4874 4878 set(handles.NomType,'String','') 4875 set(handles. i1,'String','1')% set counter to 1 (now the time index in the input matrix)4879 set(handles.num_i1,'String','1')% set counter to 1 (now the time index in the input matrix) 4876 4880 MaxIndex_i=get(handles.MaxIndex_i,'String'); 4877 4881 MaxIndex_i{1}=num2str(GetFieldData.Time.TimeDimension); … … 4885 4889 set(handles.NomType,'String','*') 4886 4890 set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')]) 4887 set(handles. i1,'String','1')% set counter to 1 (now the time index in the input matrix)4891 set(handles.num_i1,'String','1')% set counter to 1 (now the time index in the input matrix) 4888 4892 MaxIndex_i=get(handles.MaxIndex_i,'String'); 4889 4893 MaxIndex_i{1}=num2str(GetFieldData.Time.TimeDimension); … … 5208 5212 UvData.FileName_1='';% desactivate the use of a constant second file 5209 5213 set(handles.uvmat,'UserData',UvData) 5210 num_i1=stra2num(get(handles. i1,'String'));5211 num_i2=stra2num(get(handles. i2,'String'));5212 num_j1=stra2num(get(handles. j1,'String'));5213 num_j2=stra2num(get(handles. j2,'String'));5214 num_i1=stra2num(get(handles.num_i1,'String')); 5215 num_i2=stra2num(get(handles.num_i2,'String')); 5216 num_j1=stra2num(get(handles.num_j1,'String')); 5217 num_j2=stra2num(get(handles.num_j2,'String')); 5214 5218 [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(['xx' FileIndex_1]); 5215 5219 errormsg=refresh_field(handles,FileName,FileName_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1); … … 6297 6301 % Hints: contents = cellstr(get(hObject,'String')) returns LogLinHisto contents as cell array 6298 6302 % contents{get(hObject,'Value')} returns selected item from LogLinHisto 6299 6300 6301 6302
Note: See TracChangeset
for help on using the changeset viewer.
