Changeset 1078 for trunk/src/uvmat.m


Ignore:
Timestamp:
Mar 30, 2020, 3:48:19 PM (4 years ago)
Author:
sommeria
Message:

various updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r1077 r1078  
    640640
    641641%------------------------------------------------------------------------
     642% function called by the upper bar menu item Export/make movie
    642643% --------------------------------------------------------------------
    643644function MenuExportMovie_Callback(hObject, eventdata, handles)
     
    645646set(handles.MenuExportMovie,'BusyAction','queue')% activate the button
    646647
    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
    649649
    650650%% create a fig and axis for movies
    651 figure_movie=findobj(allchild(0),'name','figure_movie');
    652 
     651figure_movie=findobj(allchild(0),'name','figure_movie');% find existing movie figure
    653652if ~isempty(figure_movie)
    654653    delete(figure_movie)%delete existing figure_movie
    655654end
    656 figure_movie=figure;
     655figure_movie=figure;% create a new movie figure
    657656nbpix=[640 480];% resolution VGA
    658657set(figure_movie,'name','figure_movie','Position',[1 1 nbpix])
     
    671670
    672671%% 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 right
    675672Position=get(figure_movie,'Position');
    676673Position(2)=Position(2)+1.2*Position(4);
     
    678675Position(4)=Position(4)/2;
    679676hfig=findobj(allchild(0),'Tag','set_movie');
    680 if ~isempty(hfig),delete(hfig), end; %delete existing version of the GUI
     677if ~isempty(hfig),delete(hfig), end %delete existing version of the GUI
    681678hfig=figure('name','set_movie','tag','set_movie','MenuBar','none','NumberTitle','off','Units','pixels',...
    682679    'Position',Position);
     
    787784    end
    788785end
    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%
    792802aviobj = VideoWriter(MovieName,'Motion JPEG AVI');
    793803open(aviobj)
     
    11801190    'Callback',@(hObject,eventdata)set_slice_CheckRefraction_Callback(hObject,eventdata),...
    11811191    '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.75*hh ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Refraction_title',...
     1192uicontrol('Style','text','Units','normalized', 'Position', [2*ii+2*ww 0.95-3*ii-1.7*hh ww hh/2],'BackgroundColor',BackgroundColor,'Tag','Refraction_title',...
    11831193    'String','index','Visible','off','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right');%title
    11841194uicontrol('Style','edit','Units','normalized', 'Position', [4*ii+3*ww 0.95-3*ii-2*hh ww hh],'tag','num_RefractionIndex','BackgroundColor',[1 1 1],...
    11851195    'String',num2str(RefractionIndex),'Visible','off','FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''num_RefractionIndex'': refraction index of water');
    11861196%  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',...
     1197uicontrol('Style','text','Units','normalized', 'Position', [ii 0.95-4*ii-3.0*hh ww hh],'BackgroundColor',BackgroundColor,'Tag','NbSlice_title',...
    11881198    '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],...
     1199uicontrol('Style','edit','Units','normalized', 'Position', [2*ii+ww 0.95-4*ii-2.8*hh ww hh],'tag','num_NbSlice','BackgroundColor',[1 1 1],...
    11901200    '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,...
     1201uicontrol('Style','checkbox','Units','normalized', 'Position', [3*ii+2*ww 0.95-4*ii-2.7*hh 2*ww hh],'tag','CheckVolumeScan','BackgroundColor',BackgroundColor,...
    11921202    'String','volume scan','Value',CheckVolumeScan,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''CheckVolumeScan'':=1 for volume scan (z varies with j index)');
    11931203%  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
     1204uicontrol('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
     1206uicontrol('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
     1208uicontrol('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
     1211uicontrol('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
     1213uicontrol('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
     1216uicontrol('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
     1218uicontrol('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
    12021220%  raw 6 of the GUI
    12031221uicontrol('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],...
     
    12701288end
    12711289GeometryCalib.SliceCoord=Z_plane'*[0 0 1];
     1290GeometryCalib.SliceCoord(:,1)=SliceData.SliceCoord(1);
     1291GeometryCalib.SliceCoord(:,2)=SliceData.SliceCoord(2);
    12721292GeometryCalib.SliceAngle=zeros(GeometryCalib.NbSlice,3);
    12731293Angle_1=linspace(SliceData.SliceAngle_1(1),SliceData.SliceAngle_1(2),SliceData.NbSlice);
     
    35543574end
    35553575switch UvData.FileInfo{1}.FieldType
    3556     case {'civdata','netcdf'};
     3576    case {'civdata','netcdf'}
    35573577        list_fields=get(handles.FieldName,'String');% list menu fields
    35583578        FieldName= list_fields{get(handles.FieldName,'Value')}; % selected field
     
    36873707            end
    36883708    end
    3689     %     switch UvData.FileType{2}
    3690     %         case {'civx','civdata','netcdf'};
    3691     %             list_fields=get(handles.FieldName_1,'String');% list menu fields
    3692     %             if ischar(list_fields),list_fields={list_fields};end
    3693     %             FieldName_1= list_fields{get(handles.FieldName_1,'Value')}; % selected field
    3694     %             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     %                 end
    3699     %             end
    3700     %             if isempty(FieldName_1)
    3701     %                 FieldName_1=FieldName;% if blank reproduce the field name of the first field
    3702     %             end
    3703     %             if ~isempty(regexp(FieldName_1,'^vel', 'once'))&& strcmp(get(handles.ColorCode,'Visible'),'on')
    3704     %                 list_code=get(handles.ColorCode,'String');% list menu fields
    3705     %                 index_code=get(handles.ColorCode,'Value');% selected string index
    3706     %                 if  ~strcmp(list_code{index_code},'black') &&  ~strcmp(list_code{index_code},'white')
    3707     %                     list_code=get(handles.ColorScalar,'String');% list menu fields
    3708     %                     index_code=get(handles.ColorScalar,'Value');% selected string index
    3709     %                     ParamIn_1.ColorVar= list_code{index_code}; % selected field for vector color display
    3710     %                 end
    3711     %             end
    3712     %         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 multimage
    3716     %             else
    3717     %                 frame_index_1=i1_1;
    3718     %             end
    3719     %          case 'multimage'
    3720     %             if strcmp(NomType_1,'*')%frame index for movies or multimage
    3721     %                 frame_index_1=i1_1;
    3722     %             else
    3723     %                 frame_index_1=j1_1;
    3724     %             end
    3725     %         case 'vol' %TODO: update
    3726     %             if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx')
    3727     %                 ParamIn_1.Npy=UvData.XmlData.Npy;
    3728     %                 ParamIn_1.Npx=UvData.XmlData.Npx;
    3729     %             else
    3730     %                 errormsg='Npx and Npy need to be defined in the xml file for volume images .vol';
    3731     %                 return
    3732     %             end
    3733     %     end
    37343709   
    37353710    test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged
     
    39513926    if numel(Field)==2
    39523927        UvData.Field=sub_field(Field{1},[],Field{2});
    3953        % UvData.Field.(FieldName)=Field{1}.(FieldName)-Field{2}.(FieldName_1);
    39543928    end     
    39553929else
     
    40243998    UvData.Field=tps_coeff_field(UvData.Field,check_proj_tps);
    40253999
    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')
    40344003    %if no projection object exists, create a default one
    40354004    if isempty(UvData.ProjObject{1})
     
    54615430%------------------------------------------------------------------------
    54625431set(handles.CheckFixLimits,'Value',1) %suppress auto mode
    5463 % set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
    54645432update_plot(handles);
    54655433
     
    54715439%------------------------------------------
    54725440set(handles.CheckFixScalar,'Value',1) %suppress auto mode
    5473 % set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
    54745441MinA=str2double(get(handles.num_MinA,'String'));
    54755442MaxA=str2double(get(handles.num_MaxA,'String'));
Note: See TracChangeset for help on using the changeset viewer.