Changeset 183


Ignore:
Timestamp:
Jan 26, 2011, 5:03:40 PM (13 years ago)
Author:
sommeria
Message:

small bug repair: reading movies in read_fields, plotting rectangles and ellipes

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r182 r183  
    17241724        end
    17251725    end
    1726     %test_interp=get(handles.test_interp,'Value');
    1727 
    17281726    if  isfield(sparam,'PatchBin')
    17291727        if ~exist(sparam.PatchBin,'file')
     
    17311729        end
    17321730    end
    1733     % if test_interp && isfield(sparam,'PatchNewBin')
    1734     %     if ~exist(sparam.PatchNewBin,'file')
    1735     %          sparam.PatchNewBin=fullfile(path_UVMAT,sparam.PatchNewBin);
    1736     %     end
    1737     % end
    17381731    if isfield(sparam,'FixBin')
    17391732        if ~exist(sparam.FixBin,'file')
     
    17461739        batch_mode=sparam.BatchMode;
    17471740    end
    1748 else
    1749 %     MaxCivProcesses=50;
    1750 %     if isfield(sparam,'MaxCivProcesses')
    1751 %         MaxCivProcesses=str2double(sparam.MaxCivProcesses);
    1752 %     end
    17531741end
    17541742
     
    17561744%% get civ1 parameters:
    17571745display('files OK, processing...')
    1758 %get civ parameters
    17591746if box_test(1)==1
    17601747    par_civ1=read_param_civ1(handles,filecell.ima1.civ1{1,1});
     
    18631850        cmd='';
    18641851        if isunix % check: necessaire aussi en RUN?
    1865             %fid=fopen([filename '.cmx'],'w')
    18661852            cmd='#!/bin/bash \n';
    18671853            cmd=[cmd '#$ -cwd \n'];
     
    18741860            civAllxml=set(civAllxml,1,'name','CivDoc');
    18751861        end
    1876         %filename_cur=filecell.nc.civ1{ifile,j};%output netcdf file
    18771862        [Rootbat,Filebat]=fileparts(filecell.nc.civ1{ifile,j});%output netcdf file (without extention)
    18781863        flname=fullfile(Rootbat,Filebat);
    1879         %filename_cmx(end-1:end+6)='civ1.cmx';%name of cmx file
    18801864        if batch
    1881 %             [Rootbat,Filebat,extbat]=fileparts(filename_cmx);
    18821865            filename_bat=fullfile(Rootbat,['job_' Filebat]);
    18831866         else
     
    18901873            par_civ1.filename_ima_a=filecell.ima1.civ1{ifile,j};
    18911874            par_civ1.filename_ima_b=filecell.ima2.civ1{ifile,j};
    1892             %namelog=[fullfile(Rootbat,Filebat) '.civ1.log'];
    18931875            par_civ1.Dt=num2str(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j)));
    18941876            par_civ1.T0=num2str((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2);
     
    19431925            i_cmd=i_cmd+1;
    19441926            if isequal(civAll,0)
    1945                 cmd=[cmd CIV1_CMD(fullfile(Rootbat,Filebat),'',par_civ1,handles,sparam) '\n'];
     1927                if(isunix)
     1928                     cmd=[cmd 'cp -f ' flname '.civ1.cmx ' flname '.cmx\n'];
     1929                else
     1930                    flname=regexprep(flname,'\\','\\\\');
     1931                    cmd=[cmd 'copy /Y "' flname '.civ1.cmx" "' flname '.cmx"\n'];
     1932                end
     1933                cmd=[cmd CIV1_CMD(fullfile(Rootbat,Filebat),'',par_civ1,handles,sparam) '\n']
    19461934            else
    19471935                civAllCmd=[civAllCmd ' civ1 '];
     
    20542042            filename_cmx=filecell.nc.civ2{ifile,j};%output netcdf file
    20552043            filename_cmx([end-1:end+1])=[ 'cmx'];%name of cmx file
    2056 %             filename_cmx=[filename_cmx 'x'];
    20572044        end
    20582045       
    20592046        if box_test(4)==1
    20602047            par_civ2.filename_ima_a=filecell.ima1.civ2{ifile,j};
    2061             %par_civ2.filename_ima_a([end-3:end])=[];%remove .png extension
    20622048            par_civ2.filename_ima_b=filecell.ima2.civ2{ifile,j};
    2063             %par_civ2.filename_ima_b([end-3:end])=[];%remove .png extension
    20642049            [Rootbat,Filebat]=fileparts(filecell.nc.civ2{ifile,j});%output netcdf file (without extention)
    2065             %namelog=[fullfile(Rootbat,Filebat) '.civ2.log'];
    20662050            par_civ2.Dt=num2str(time(num2_civ2(ifile),num_b_civ2(j))-time(num1_civ2(ifile),num_a_civ2(j)));
    20672051            par_civ2.T0=num2str((time(num2_civ1(ifile),num_b_civ2(j))+time(num1_civ2(ifile),num_a_civ2(j)))/2);
     
    21152099                end
    21162100            end
    2117             %endTESTgrid
    21182101            i_cmd=i_cmd+1;
    21192102            flname=fullfile(Rootbat,Filebat);
     
    22342217        if isequal(civAll,1)
    22352218            save(civAllxml,[filename_cmx([1:end-4]) '.xml']);
    2236             %cmd=char({cmd;[CivBin ' -f ' [filename_cmx([1:end-4]) '.xml'] ' ' civAllCmd]});
    22372219            cmd=[cmd CivBin ' -f ' filename_cmx(1:end-4) '.xml '  civAllCmd  '\n'];
    22382220        end
     
    22452227        fprintf(fid,cmd);
    22462228        fclose(fid);
    2247         %dlmwrite(filename_bat,cmd,'');%write commands in filename_bat
    22482229        if batch
    22492230            switch batch_mode
    22502231                case 'sge'
    22512232                    pvalue=num2str((1-ind_answer)*500);
    2252                     %namelog=[filename_bat '.patch.log'];
    22532233                    display(['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]);
    22542234                    eval(  ['!qsub -p ' pvalue ' -q civ.q -e ' flname '.errors -o ' flname '.log' ' ' filename_bat]);
     
    22582238            if(isunix)
    22592239                cmd_str=['. ' filename_bat];
    2260                 % cmd_str=['!at -qb now -f ' filename_bat ' &']; %ou at -qb now -f bad idea...
    22612240            else %case of Windows
    22622241                cmd_str=['@call "' regexprep(filename_bat,'\\','\\\\') '"'];
  • trunk/src/mouse_up.m

    r156 r183  
    116116    set(hh_set_object.YObject,'String',num2str(ObjectData.Coord(:,2),4));
    117117    set(hh_set_object.ZObject,'String',num2str(ObjectData.Coord(:,3),4));
     118    if strcmp(ObjectData.Style,'rectangle')||strcmp(ObjectData.Style,'ellipse')
     119        set(hh_set_object.XMax,'String',num2str(ObjectData.RangeX,4));
     120        set(hh_set_object.YMax,'String',num2str(ObjectData.RangeY,4));
     121    end
    118122    if NbDefPoint<=2 || isequal(get(currentfig,'SelectionType'),'alt') ||...
    119123              strcmp(AxeData.Drawing,'translate') || strcmp(AxeData.Drawing,'deform');%stop drawing
  • trunk/src/plot_object.m

    r177 r183  
    4747    ObjectData=ObjectDataIn;% TODO: modify take into account rotation of axis
    4848else
    49     return % no object representation yet available
     49    return % object representation only  available in a plane
    5050end
    5151if ~isfield(ObjectData,'Style')||isempty(ObjectData.Style)||~ischar(ObjectData.Style)
  • trunk/src/read_field.m

    r182 r183  
    2727%     .ColorVar: variable used for vector color
    2828%     .Npx, .Npy: nbre of pixels along x and y (used for .vol input files)
    29 function [Field,ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn)
     29function [Field,ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn,num)
    3030Field=[];
    3131ParamOut=[];
     
    124124        case 'movie'
    125125            try
    126                 A=read(ObjectName,num_i1);
     126                A=read(ObjectName,num);
    127127                FieldName='image';
    128128            catch
     
    132132        case 'avi'
    133133            try
    134                 mov=aviread(ObjectName,num_i1);
     134                mov=aviread(ObjectName,num);
    135135            catch
    136136                errormsg=lasterr;
     
    146146            FieldName='image';
    147147        case 'multimage'
    148             A=imread(ObjectName,num_i1);
     148            A=imread(ObjectName,num);
    149149            FieldName='image';
    150150        case 'image'
     
    187187
    188188
    189 
  • trunk/src/set_object.m

    r182 r183  
    8484end
    8585set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function (allow action on uvmat when set_object is in front)
    86 %set(handles.MenuCoord,'ListboxTop',1)
    87 % if ~exist('PlotHandles','var')
    88 %      PlotHandles=[];
    89 % end
    9086enable_plot=0;%default: does not allow plot of object and projection
    91 % SetData.PlotHandles=PlotHandles;
    92 % set(hObject,'UserData',SetData)
    9387
    9488% fill the interface as set in the input data:
     
    9993    if isfield(data,'Name')
    10094        set(handles.TITLE,'String',data.Name)
    101 %         set(hObject,'name',data.Name)
    10295    end
    10396    if ~isfield(data,'NbDim')||~isequal(data.NbDim,3)%2D case
     
    125118    ObjectStyle_Callback(hObject, eventdata, handles)
    126119    if isfield(data,'ProjMenu')
    127         set(handles.ProjMode,'String',data.ProjMenu);
     120        set(handles.ProjMode,'String',data.ProjMenu);%overset the standard menu
    128121    end
    129122    if isfield(data,'ProjMode')
     
    244237        set(handles.CoordUnit,'String',data.CoordUnit)
    245238    end
    246 %     if isfield(data,'CoordType')&& isequal(data.CoordType,'px')
    247 % %         if isequal(data.CoordType,'phys')
    248 % %             set(handles.MenuCoord,'Value',1)
    249 % %         elseif isequal(data.CoordType,'px')
    250 %              set(handles.MenuCoord,'Value',2)
    251 % %         end
    252 %     end
    253239end
    254240if enable_plot
     
    267253end
    268254
     255%------------------------------------------------------------------------
    269256% --- Outputs from this function are returned to the command line.
    270257function varargout = set_object_OutputFcn(hObject, eventdata, handles)
    271 % varargout  cell array for returning output args (see VARARGOUT);
    272 % hObject    handle to figure
    273 % eventdata  reserved - to be defined in a future version of MATLAB
    274 % handles    structure with handles and user data (see GUIDATA)
    275 
     258%------------------------------------------------------------------------
    276259% Get default command line output from handles structure
    277260varargout{1} = handles.output;
     
    281264% --- Executes on selection change in ObjectStyle.
    282265function ObjectStyle_Callback(hObject, eventdata, handles)
     266%------------------------------------------------------------------------
    283267style_prev=get(handles.ObjectStyle,'UserData');%previous object style
    284268str=get(handles.ObjectStyle,'String');
     
    286270style=str{val};
    287271% make correspondance between different object styles
    288 % if ~isequal(str{val},style_prev)
    289272Xcolumn=get(handles.XObject,'String');
    290273Ycolumn=get(handles.YObject,'String');
     
    333316     set(handles.ZObject,'String',z_new)
    334317end
    335 % end
     318
    336319switch style
    337320    case {'points','line','polyline','plane'}
     
    542525     s.ProjMode='none';
    543526 end
    544 %Display title
    545 % title=set_title(s.Style,s.ProjMode);%update the title
    546 % if ~isempty(huvmat)
    547 %     hhuvmat=guidata(huvmat);
    548 % end
    549 % menu=get(handles.TITLE,'String');
    550 % for iline=1:length(menu)
    551 %      if isequal(menu{iline},title)
    552 %          set(handles.TITLE,'Value',iline)
    553 %          break
    554 %      end
    555 % end
    556 %TITLE_Callback(hObject, eventdata, handles)
    557527teststyle=0;
    558528
     
    585555
    586556ProjMode_Callback(hObject, eventdata, handles);%visualize the appropriate edit boxes
    587 % if isfield(s,'CoordType')
    588 %     if isequal(s.CoordType,'phys')
    589 %         set(handles.MenuCoord,'Value',1)
    590 %     elseif isequal(s.CoordType,'px')
    591 %         set(handles.MenuCoord,'Value',2)
    592 %     else
    593 %         warndlg('unknown CoordType (px or phys) in set_object.m')
    594 %     end
    595 % end
    596557if isfield(s,'XMax')
    597558    set(handles.XMax,'String',s.XMax)
  • trunk/src/update_obj.m

    r180 r183  
    1212%    .Object{IndexObj}.DisplayHandle_uvmat: handles of the object plot on uvmat, =[] if it does not exist
    1313%    .Object{IndexObj}.DisplayHandle_view_field: handles of the object plot on view_field, =[] if it does not exist
    14 %IndexObj: object index of  UvData.Object correspopnding to the updated object
    15 %ObjectData: structure containing the input object properties to be attributed to the object #IndexObj
    16 %       .Style: style of the object: 'line', 'rectangle'...
    17 %PlotHandles: structure containing the handles of the plotting parameter buttons on the uvmat or view_field interface
     14%IndexObj_1: index of  the object used for the uvmat plot
     15%IndexObj_2: index of  the object used for the view_field plot
    1816%-------------------------------------
    1917
     
    2624%%  representation of the different objects in the plots uvmat and view_field
    2725%plot uvmat
    28     for iobj=1:length(Object_out) %change the view of all existing objects on the updated current object #IndexObj_1
    29          hobject=[];
    30         if isfield(Object_out{iobj},'DisplayHandle_uvmat') && ~isempty(Object_out{iobj}.DisplayHandle_uvmat) && ishandle(Object_out{iobj}.DisplayHandle_uvmat)
    31             hobject=Object_out{iobj}.DisplayHandle_uvmat;%graphic handle of object #iobj in the uvmat plot
    32         end
    33         Object_out{iobj}.DisplayHandle_uvmat=plot_object(Object_out{iobj},Object_out{IndexObj_1},hobject,'m');%update the object representation of Object_out{iobj} on Object_out{IndexObj_1}
     26for iobj=1:length(Object_out) %change the view of all existing objects on the updated current object #IndexObj_1
     27     hobject=[];
     28    if isfield(Object_out{iobj},'DisplayHandle_uvmat') && ~isempty(Object_out{iobj}.DisplayHandle_uvmat) && ishandle(Object_out{iobj}.DisplayHandle_uvmat)
     29        hobject=Object_out{iobj}.DisplayHandle_uvmat;%graphic handle of object #iobj in the uvmat plot
    3430    end
     31    Object_out{iobj}.DisplayHandle_uvmat=plot_object(Object_out{iobj},Object_out{IndexObj_1},hobject,'m');%update the object representation of Object_out{iobj} on Object_out{IndexObj_1}
     32end
    3533% plot view_field
    3634if ~isempty(IndexObj_2)
    37     for iobj=1:length(Object_out) %change the view of all existing objects on the updated current object #IndexObj_2
     35    for iobj=1:length(Object_out) %change the view of all existing objects on the updated object #IndexObj_2
    3836        hobject=[];
    3937        if isfield(Object_out{iobj},'DisplayHandle_view_field') &&  ~isempty(Object_out{iobj}.DisplayHandle_view_field) && ishandle(Object_out{iobj}.DisplayHandle_view_field)
  • trunk/src/uvmat.m

    r180 r183  
    21592159    ParamIn.VelType=VelType;
    21602160    ParamIn.GUIName='get_field';
    2161     [Field{1},ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn);
     2161    [Field{1},ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn,num_i1);
     2162    if ~isempty(errormsg)
     2163        errormsg=['error in reading ' filename ': ' errormsg];
     2164        return
     2165    end
    21622166    if isfield(ParamOut,'Npx')&& isfield(ParamOut,'Npy')
    21632167        set(handles.npx,'String',num2str(ParamOut.Npx));% display image size on the interface
     
    22442248            ParamIn.VelType=VelType_1;
    22452249            ParamIn.GUIName='get_field_1';
    2246             [Field{2},ParamOut_1,errormsg] = read_field(Name,FileType_1,ParamIn);         
     2250            [Field{2},ParamOut_1,errormsg] = read_field(Name,FileType_1,ParamIn,num_i1);
     2251            if ~isempty(errormsg)
     2252                errormsg=['error in reading ' filename_1 ': ' errormsg];
     2253                return
     2254            end
    22472255            UvData.Field_1=Field{2}; %store the second field for possible use at next RUN
    22482256        end
     
    42484256    if ~isempty(hview_field)
    42494257        delete(hview_field)
     4258    end
     4259    hset_object=findobj(allchild(0),'Tag','set_object');
     4260    if ~isempty(hset_object)
     4261        delete(hset_object)
    42504262    end
    42514263else
Note: See TracChangeset for help on using the changeset viewer.