Changeset 1078 for trunk/src/uvmat.m
- Timestamp:
- Mar 30, 2020, 3:48:19 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r1077 r1078 640 640 641 641 %------------------------------------------------------------------------ 642 % function called by the upper bar menu item Export/make movie 642 643 % -------------------------------------------------------------------- 643 644 function MenuExportMovie_Callback(hObject, eventdata, handles) … … 645 646 set(handles.MenuExportMovie,'BusyAction','queue')% activate the button 646 647 647 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 648 FileBase=fullfile(RootPath,RootFile); 648 [RootPath,SubDir,RootFile]=read_file_boxes(handles);%read input file path from the GUI uvmat 649 649 650 650 %% create a fig and axis for movies 651 figure_movie=findobj(allchild(0),'name','figure_movie'); 652 651 figure_movie=findobj(allchild(0),'name','figure_movie');% find existing movie figure 653 652 if ~isempty(figure_movie) 654 653 delete(figure_movie)%delete existing figure_movie 655 654 end 656 figure_movie=figure; 655 figure_movie=figure;% create a new movie figure 657 656 nbpix=[640 480];% resolution VGA 658 657 set(figure_movie,'name','figure_movie','Position',[1 1 nbpix]) … … 671 670 672 671 %% create the GUI set_movie 673 %set(0,'Units','points')674 %ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right675 672 Position=get(figure_movie,'Position'); 676 673 Position(2)=Position(2)+1.2*Position(4); … … 678 675 Position(4)=Position(4)/2; 679 676 hfig=findobj(allchild(0),'Tag','set_movie'); 680 if ~isempty(hfig),delete(hfig), end ;%delete existing version of the GUI677 if ~isempty(hfig),delete(hfig), end %delete existing version of the GUI 681 678 hfig=figure('name','set_movie','tag','set_movie','MenuBar','none','NumberTitle','off','Units','pixels',... 682 679 'Position',Position); … … 787 784 end 788 785 end 789 %create avi open 790 %aviobj=avifile(MovieName,'Compression','None','fps',fps); 791 786 787 %% create movie 788 % duration = 2*FrameNumber/60; 789 % [~,name,~] = fileparts(MovieName); 790 % ffmpegcmd = ['ffmpeg -i ' ' ' MovieName ' ' '-filter:v "setpts=(',... 791 % num2str(fps/duration),')*PTS"' ' ' strcat(MovieDir,... 792 % strcat('/',name,'.mkv'))]; 793 % [ffmpeg_err,~] = system(ffmpegcmd); 794 % if ffmpeg_err 795 % disp_uvmat('ERROR',['ERROR: Errors in conversion to mkv, close MATLAB and run "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab" in terminal'],1 ) 796 % return 797 % end 798 % msgbox_uvmat('CONFIRMATION',{['movie ' MovieName ' created '];['with ' num2str(FrameNumber) ' frames']}) 799 800 801 % 792 802 aviobj = VideoWriter(MovieName,'Motion JPEG AVI'); 793 803 open(aviobj) … … 1180 1190 'Callback',@(hObject,eventdata)set_slice_CheckRefraction_Callback(hObject,eventdata),... 1181 1191 'String','refraction','Value',CheckRefraction,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''CheckRefraction'':=1 to provide refraction correction'); 1182 uicontrol('Style','text','Units','normalized', 'Position', [2*ii+2*ww 0.95-3*ii-1.7 5*hh ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Refraction_title',...1192 uicontrol('Style','text','Units','normalized', 'Position', [2*ii+2*ww 0.95-3*ii-1.7*hh ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Refraction_title',... 1183 1193 'String','index','Visible','off','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');%title 1184 1194 uicontrol('Style','edit','Units','normalized', 'Position', [4*ii+3*ww 0.95-3*ii-2*hh ww hh],'tag','num_RefractionIndex','BackgroundColor',[1 1 1],... 1185 1195 'String',num2str(RefractionIndex),'Visible','off','FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_RefractionIndex'': refraction index of water'); 1186 1196 % raw 4 of the GUI 1187 uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-4*ii-3. 25*hh ww hh],'BackgroundColor',BackgroundColor,'Tag','NbSlice_title',...1197 uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-4*ii-3.0*hh ww hh],'BackgroundColor',BackgroundColor,'Tag','NbSlice_title',... 1188 1198 'String','NbSlice','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');%title 1189 uicontrol('Style','edit','Units','normalized', 'Position', [2*ii+ww 0.95-4*ii- 3*hh ww hh],'tag','num_NbSlice','BackgroundColor',[1 1 1],...1199 uicontrol('Style','edit','Units','normalized', 'Position', [2*ii+ww 0.95-4*ii-2.8*hh ww hh],'tag','num_NbSlice','BackgroundColor',[1 1 1],... 1190 1200 'String',num2str(NbSlice),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_NbSlice'':number of slices');%edit box 1191 uicontrol('Style','checkbox','Units','normalized', 'Position', [3*ii+2*ww 0.95-4*ii- 3*hh 2*ww hh],'tag','CheckVolumeScan','BackgroundColor',BackgroundColor,...1201 uicontrol('Style','checkbox','Units','normalized', 'Position', [3*ii+2*ww 0.95-4*ii-2.7*hh 2*ww hh],'tag','CheckVolumeScan','BackgroundColor',BackgroundColor,... 1192 1202 'String','volume scan','Value',CheckVolumeScan,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''CheckVolumeScan'':=1 for volume scan (z varies with j index)'); 1193 1203 % raw 5 of the GUI 1194 uicontrol('Style','text','Units','normalized', 'Position', [2*ii+2*ww 0.95-3*ii-3.5*hh ww hh/2],'BackgroundColor',BackgroundColor,... 1195 'String','first','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title 1196 uicontrol('Style','text','Units','normalized', 'Position', [3*ii+3*ww 0.95-3*ii-3.5*hh ww hh/2],'BackgroundColor',BackgroundColor,... 1197 'String','last','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title 1198 uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-5*ii-4*hh 2*ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Angle_title_1',... 1199 'String','tild angle x axis','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title 1200 uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-6*ii-5*hh 2*ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Angle_title_2',... 1201 'String','tild angle y axis','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title 1204 uicontrol('Style','text','Units','normalized', 'Position', [2*ii+1*ww 0.95-2*ii-3.9*hh ww hh],'BackgroundColor',BackgroundColor,... 1205 'String','origin','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title 1206 uicontrol('Style','text','Units','normalized', 'Position', [2*ii+2*ww 0.95-2*ii-3.5*hh ww hh],'BackgroundColor',BackgroundColor,... 1207 'String',{'first';'angle'},'FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title 1208 uicontrol('Style','text','Units','normalized', 'Position', [3*ii+3*ww 0.95-2*ii-3.5*hh ww hh],'BackgroundColor',BackgroundColor,... 1209 'String',{'last';'angle'},'FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title 1210 1211 uicontrol('Style','edit','Units','normalized', 'Position', [3*ii+ww 0.95-5*ii-4.2*hh ww hh],'tag','num_SliceCoord_1','BackgroundColor',[1 1 1],... 1212 'String',num2str(SliceCoord(1)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceCoord_1'':x position of the tild origin');%edit box 1213 uicontrol('Style','edit','Units','normalized', 'Position', [3*ii+ww 0.95-6*ii-5.2*hh ww hh],'tag','num_SliceCoord_2','BackgroundColor',[1 1 1],... 1214 'String',num2str(SliceCoord(2)),'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_SliceCoord_2'':y position of the tild origin');%edit box 1215 1216 uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-5*ii-4*hh 1.3*ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Angle_title_1',... 1217 'String','tild x axis','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title 1218 uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-6*ii-5*hh 1.3*ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Angle_title_2',... 1219 'String','tild y axis','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center');%title 1202 1220 % raw 6 of the GUI 1203 1221 uicontrol('Style','edit','Units','normalized', 'Position', [3*ii+2*ww 0.95-5*ii-4.2*hh ww hh],'tag','num_SliceAngle_1_1','BackgroundColor',[1 1 1],... … … 1270 1288 end 1271 1289 GeometryCalib.SliceCoord=Z_plane'*[0 0 1]; 1290 GeometryCalib.SliceCoord(:,1)=SliceData.SliceCoord(1); 1291 GeometryCalib.SliceCoord(:,2)=SliceData.SliceCoord(2); 1272 1292 GeometryCalib.SliceAngle=zeros(GeometryCalib.NbSlice,3); 1273 1293 Angle_1=linspace(SliceData.SliceAngle_1(1),SliceData.SliceAngle_1(2),SliceData.NbSlice); … … 3554 3574 end 3555 3575 switch UvData.FileInfo{1}.FieldType 3556 case {'civdata','netcdf'} ;3576 case {'civdata','netcdf'} 3557 3577 list_fields=get(handles.FieldName,'String');% list menu fields 3558 3578 FieldName= list_fields{get(handles.FieldName,'Value')}; % selected field … … 3687 3707 end 3688 3708 end 3689 % switch UvData.FileType{2}3690 % case {'civx','civdata','netcdf'};3691 % list_fields=get(handles.FieldName_1,'String');% list menu fields3692 % if ischar(list_fields),list_fields={list_fields};end3693 % FieldName_1= list_fields{get(handles.FieldName_1,'Value')}; % selected field3694 % if ~strcmp(FieldName_1,'get_field...')3695 % if get(handles.FixVelType,'Value')3696 % VelTypeList=get(handles.VelType_1,'String');3697 % VelType_1=VelTypeList{get(handles.VelType_1,'Value')};% read the velocity type.3698 % end3699 % end3700 % if isempty(FieldName_1)3701 % FieldName_1=FieldName;% if blank reproduce the field name of the first field3702 % end3703 % if ~isempty(regexp(FieldName_1,'^vel', 'once'))&& strcmp(get(handles.ColorCode,'Visible'),'on')3704 % list_code=get(handles.ColorCode,'String');% list menu fields3705 % index_code=get(handles.ColorCode,'Value');% selected string index3706 % if ~strcmp(list_code{index_code},'black') && ~strcmp(list_code{index_code},'white')3707 % list_code=get(handles.ColorScalar,'String');% list menu fields3708 % index_code=get(handles.ColorScalar,'Value');% selected string index3709 % ParamIn_1.ColorVar= list_code{index_code}; % selected field for vector color display3710 % end3711 % end3712 % case {'video','mmreader','cine_phantom'}3713 % ParamIn_1=UvData.MovieObject{2};3714 % if ~strcmp(NomType_1,'*')3715 % frame_index_1=j1_1;%frame index for movies or multimage3716 % else3717 % frame_index_1=i1_1;3718 % end3719 % case 'multimage'3720 % if strcmp(NomType_1,'*')%frame index for movies or multimage3721 % frame_index_1=i1_1;3722 % else3723 % frame_index_1=j1_1;3724 % end3725 % case 'vol' %TODO: update3726 % if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx')3727 % ParamIn_1.Npy=UvData.XmlData.Npy;3728 % ParamIn_1.Npx=UvData.XmlData.Npx;3729 % else3730 % errormsg='Npx and Npy need to be defined in the xml file for volume images .vol';3731 % return3732 % end3733 % end3734 3709 3735 3710 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged … … 3951 3926 if numel(Field)==2 3952 3927 UvData.Field=sub_field(Field{1},[],Field{2}); 3953 % UvData.Field.(FieldName)=Field{1}.(FieldName)-Field{2}.(FieldName_1);3954 3928 end 3955 3929 else … … 4024 3998 UvData.Field=tps_coeff_field(UvData.Field,check_proj_tps); 4025 3999 4026 %% reset the min and max of scalar if only the mask is displayed(TODO: check the need) 4027 % if isfield(UvData,'Mask')&& ~isfield(UvData,'A') 4028 % set(handles.num_MinA,'String','0') 4029 % set(handles.num_MaxA,'String','255') 4030 % end 4031 set(handles.Objects,'Visible','on') 4032 4033 %% Plot the projections on the selected projection objects 4000 4001 %% Plot the projections on the selected projection objects 4002 set(handles.Objects,'Visible','on') 4034 4003 %if no projection object exists, create a default one 4035 4004 if isempty(UvData.ProjObject{1}) … … 5461 5430 %------------------------------------------------------------------------ 5462 5431 set(handles.CheckFixLimits,'Value',1) %suppress auto mode 5463 % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])5464 5432 update_plot(handles); 5465 5433 … … 5471 5439 %------------------------------------------ 5472 5440 set(handles.CheckFixScalar,'Value',1) %suppress auto mode 5473 % set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])5474 5441 MinA=str2double(get(handles.num_MinA,'String')); 5475 5442 MaxA=str2double(get(handles.num_MaxA,'String'));
Note: See TracChangeset
for help on using the changeset viewer.