Changeset 497


Ignore:
Timestamp:
Jul 21, 2012, 11:15:52 PM (12 years ago)
Author:
sommeria
Message:

cleaning and small bug repair.
pb of histogram for filter data solved
display of uicontrol by right mouse selection improved

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/check_files.m

    r480 r497  
    33%  uvmat path to the Matlab path if needed.
    44%----------------------------------------------------------------------
    5 % function [errormsg,date_str,ver]=check_files
     5% function [checkmsg,date_str,ver]=check_files
    66%
    77% OUTPUT:
    8 % errormsg: error message listing functions whose paths are not in the directory of uvmat.m
     8% checkmsg: error message listing functions whose paths are not in the directory of uvmat.m
    99% date_str: date of the most recent modification of a file in the toolbox
    1010% ver : svn version in case this is a  svn repository
     
    2626%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    2727
    28 function [errormsg,date_str,svn_info]=check_files
    29 errormsg={};%default
    30 date_str='';
     28function [checkmsg,date_str,svn_info]=check_files
     29checkmsg={};%default
    3130svn_info.rep_rev=[];
    3231svn_info.cur_rev=[];
     
    5352    'editxml.fig';...%interface for editxml
    5453    'fileparts_uvmat';...% extracts the root name,field indexes and nomenclature type from an input filename
    55     'fill_GUI';...% fill a GUI with handles 'handles' from input data Param
     54    'fill_GUI';...%  fill a GUI with a set of parameters from a Matlab structure
    5655    'filter_tps';...% find the thin plate spline coefficients for interpolation-smoothing
    5756    'find_field_indices';...% group the variables of a nc-formated Matlab structure into 'fields' with common dimensions
     
    8786    'read_image';... read images or video objects
    8887    'read_get_field';... read the list of selected variables from the GUI get_field (TODO: use read_GUI)
    89     'read_GUI';... %read all parameters set by a GUI as a Matlab structure
     88    'read_GUI';... %read a GUI and provide the data as a Matlab structure
    9089    'read_image';...%read .civ files (obsolete, but can be adapted to other text documentation files)
    9190    'read_multimadoc';... %read a set of Imadoc files and compare their timing of different file series
     
    121120    };
    122121dir_fct=which('uvmat');% path to uvmat
    123 [pathuvmat,name,ext]=fileparts(dir_fct);
     122pathuvmat=fileparts(dir_fct);
    124123
    125124%% add the uvmat path to matlab if needed
     
    136135    if isempty(dir_fct)
    137136        icount=icount+1;
    138         errormsg{icount}=[list_fct{i} ' not found'];% test for function not found
     137        checkmsg{icount}=[list_fct{i} ' not found'];% test for function not found
    139138    else
    140         [pth,name,ext]=fileparts(dir_fct);
    141         if ~isequal(pathuvmat,pth)&~isequal(fullfile(pathuvmat,'private'),pth)
     139        pth=fileparts(dir_fct);
     140        if ~isequal(pathuvmat,pth) && ~isequal(fullfile(pathuvmat,'private'),pth)
    142141            icount=icount+1;
    143             errormsg{icount}=[dir_fct ' overrides the package UVMAT'];% bad path for the function
     142            checkmsg{icount}=[dir_fct ' overrides the package UVMAT'];% bad path for the function
    144143        end
    145144        datfile=dir(dir_fct);
     
    150149end
    151150date_str=datestr(max(datnum));
     151
     152%% check svn status
    152153[status,result]=system('svn --help');
    153154if status==0
     
    158159        svn_info.cur_rev=str2double(t.rev);
    159160    end
    160     [tild,result]=system(['svn info -r ''HEAD'' '  dir_fct]);
     161    [tild,result]=system(['svn info -r ''HEAD'' '  pathuvmat]);
    161162    t=regexp(result,'R.vision\s*:\s*(?<rev>\d+)','names');
    162163    if ~isempty(t)
    163     svn_info.rep_rev=str2double(t.rev);
     164        svn_info.rep_rev=str2double(t.rev);
    164165    end
    165     [tild,result]=system(['svn status'  dir_fct]);
     166    [tild,result]=system(['svn status '  pathuvmat]);
    166167    svn_info.status=result;
    167     errormsg =[errormsg {['SVN revision : ' num2str(svn_info.cur_rev)]}];
     168    checkmsg =[checkmsg {['SVN revision : ' num2str(svn_info.cur_rev)]}];
    168169    if svn_info.rep_rev>svn_info.cur_rev
    169         errormsg =[errormsg ...
     170        checkmsg =[checkmsg ...
    170171            {['Repository now at revision ' num2str(svn_info.rep_rev) '. Please type svn update in uvmat folder']}];
    171172    end
    172173    modifications=regexp(svn_info.status,'M\s[^(\n|\>)]+','match');
    173174    if ~isempty(modifications)
    174         errormsg=[errormsg modifications];
     175        for ilist=1:numel(modifications)
     176            [tild,FileName,FileExt]=fileparts(modifications{ilist});
     177            checkmsg=[checkmsg {[FileName FileExt ' modified']}];
     178        end
    175179    end
    176180else
    177     errormsg=[errormsg {'SVN not available'}];
     181    checkmsg=[checkmsg {'SVN not available'}];
    178182end
    179 errormsg=errormsg';
     183checkmsg=checkmsg';
    180184
  • trunk/src/civ_matlab.m

    r494 r497  
    228228    [Data.Civ1_SubRange,Data.Civ1_NbSites,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,tild,Ures, Vres,tild,FFres]=...
    229229        filter_tps([Data.Civ1_X(ind_good) Data.Civ1_Y(ind_good)],Data.Civ1_U(ind_good),Data.Civ1_V(ind_good),[],Data.Patch1_SubDomain,Data.Patch1_Rho,Data.Patch1_Threshold);
    230 %     fill=zeros(3,2,size(Data.Civ1_SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
    231 %     Data.Civ1_Coord_tps=cat(1,Data.Civ1_Coord_tps,fill);
    232230    Data.Civ1_U_smooth(ind_good)=Ures;
    233231    Data.Civ1_V_smooth(ind_good)=Vres;
     
    424422    [Data.Civ2_SubRange,Data.Civ2_NbSites,Data.Civ2_Coord_tps,Data.Civ2_U_tps,Data.Civ2_V_tps,tild,Ures, Vres,tild,FFres]=...
    425423        filter_tps([Data.Civ2_X(ind_good) Data.Civ2_Y(ind_good)],Data.Civ2_U(ind_good),Data.Civ2_V(ind_good),[],Data.Patch2_SubDomain,Data.Patch2_Rho,Data.Patch2_Threshold);
    426 %     fill=zeros(3,2,size(Data.Civ2_SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
    427 %     Data.Civ2_Coord_tps=cat(1,Data.Civ2_Coord_tps,fill);
    428424    Data.Civ2_U_smooth(ind_good)=Ures;
    429425    Data.Civ2_V_smooth(ind_good)=Vres;
  • trunk/src/fill_GUI.m

    r476 r497  
    1 %'fill_GUI': fill a GUI with handles 'handles' from input data Param
     1%'fill_GUI': fill a GUI with a set of parameters from a Matlab structure
    22% -----------------------------------------------------------------------
     3% function errormsg=fill_GUI(Param,handles)
     4% OUPUT:
     5% errormsg: error message, ='' by default
     6%
     7% INPUT:
     8% Param: matlab structure containing the information to display in the GUI
     9% handles: Matlab structure containing the handles of the GUI elements
     10%
     11% see also the reverse function read_GUI.m
     12%
    313function errormsg=fill_GUI(Param,handles)
    414%------------------------------------------------------------------------
     
    1828    else
    1929        hh=[];
    20         input_data=Param.(fields{ifield})
     30        input_data=Param.(fields{ifield});
    2131        check_done=0;
    2232        if isfield(handles,fields{ifield})
    23             hh=handles.(fields{ifield})
     33            hh=handles.(fields{ifield});
    2434            if strcmp(get(hh,'Type'),'uitable')
    2535                set(hh,'Visible','on')
  • trunk/src/find_file_series.m

    r494 r497  
    218218        [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ind_select(ifile_min)).name);% update the representation of indices (number of 0 before the number)
    219219        NomType=regexprep(NomType,['^' NomTypePref],'');
    220     end
    221     %% update the file type if the input file does not exist (pb of 0001)
    222     if isempty(FileType)
    223         [FileType,tild,MovieObject]=get_file_type(fullfile(FilePath,dirpair(ifile_min).name));
     220        %% update the file type if the input file does not exist (pb of 0001)
     221        if isempty(FileType)
     222            [FileType,tild,MovieObject]=get_file_type(fullfile(FilePath,dirpair(ifile_min).name));
     223        end
    224224    end
    225225end
  • trunk/src/mouse_down.m

    r456 r497  
    129129                end
    130130                break
    131             case 'uicontrol'  %if the mouse is over a uicontrol, duplicate the display  in an editable  zoom window
     131            %if the mouse is over a uicontrol, duplicate the display  in an editable  zoom window
     132            case 'uicontrol'
    132133                if isequal(get(hObject,'SelectionType'),'alt')  && isequal(get(hchild,'Visible'),'on') && ~isequal(get(hchild,'tag'),'frame_object')&&...
    133134                        ~isequal(get(hchild,'tag'),'ListObject')
    134135                    if ~strcmp(get(hchild,'Style'),'frame')%do not visualisaze frames
    135136                        msg_pos(1:2)=GUI_pos(1:2)+obj_pos(1:2).*GUI_pos(3:4);
    136                         output_str=msgbox_uvmat(['uicontrol: ' get(hchild,'Tag')],'',get(hchild,'String'),msg_pos);
     137                        display_str=get(hchild,'TooltipString');
     138                        output_str=msgbox_uvmat(['uicontrol: ' get(hchild,'Tag')],display_str,get(hchild,'String'),msg_pos);
    137139                        break
    138140                    end
     
    152154                        if strcmp(htype,'uicontrol') && strcmp(get(hchild,'Visible'),'on')
    153155                            msg_pos(1:2)=GUI_pos(1:2)+obj_pos(1:2).*GUI_pos(3:4);
    154                             output_str=msgbox_uvmat(['uicontrol: ' get(hchild,'Tag')],'',get(hchild,'String'),msg_pos);
     156                            display_str=get(hchild,'TooltipString');
     157                            output_str=msgbox_uvmat(['uicontrol: ' get(hchild,'Tag')],display_str,get(hchild,'String'),msg_pos);
    155158                            break
    156159                        end
     
    165168if ~isempty(output_str)               
    166169    set(hObject,'Units','pixels')
     170    if strcmp(get(hchild,'enable'),'on')
    167171    set(hchild,'String',output_str)
     172    end
    168173end
    169174   
  • trunk/src/msgbox_uvmat.m

    r472 r497  
    112112    if exist('Position','var')
    113113    if iscell(default_answer)
    114         widthstring=max(cellfun('length',default_answer));
     114        widthstring=max(cellfun('length',default_answer),length(display_str));
    115115        heightstring=size(default_answer,1);
    116116        set(handles.edit_box,'Max',2);
    117117    else
    118         widthstring=length(default_answer);
     118        widthstring=max(length(default_answer),length(display_str));
    119119        heightstring=1;
    120120    end
    121     widthstring=max(widthstring,length(title));
     121    widthstring=max(widthstring,length(title)+20);
    122122    boxsize=[10*widthstring 20*heightstring];%size of the display edit box
    123123    set(handles.edit_box,'Units','pixels')
     
    126126   set(handles.edit_box,'Position',[5,34,boxsize(1),boxsize(2)])
    127127   FigPos(3)=10+boxsize(1);
    128    FigPos(4)=36+boxsize(2);
     128   FigPos(4)=56+boxsize(2);
    129129   FigPos(2)=Position(2)-FigPos(4)-25;
    130130   set(handles.figure1,'Position',FigPos)
  • trunk/src/read_GUI.m

    r427 r497  
    1 % -----------------------------------------------------------------------
    2 % --- read a GUI with handle 'handle' producing a structure 'struct'
     1% 'read_GUI':read a GUI and provide the data as a Matlab structure
     2%----------------------------------------------------------------------
     3% function struct=read_GUI(handle)
    34%
    4 % The output Matlab structure 'struct' contains the information displayed on
    5 % the GUI or a panel with handle 'handle'
     5% OUTPUT:
     6% struct: matlab structure containing the information displayed in the GUI
    67% The content of a panel with tag 'tag' is displayed as a substructure struct.(tag) (recursive use of read_GUI)
    7 % Output of an element with tag 'tag':
    8 %     'checkbox','radiobutton','togglebutton': struct.(tag)=value
    9 %     'edit': struct.(tag)=string, 
     8% Output of a GUI element with tag 'tag':
     9%     -case 'checkbox','radiobutton','togglebutton': struct.(tag)=value
     10%     -case'edit': struct.(tag)=string, 
    1011%         or, if the tag is in the form by 'num_tag',
    1112%         struct.(tag)=str2double(string). If the result is empty the  'UserData' is taken as the default input.
    12 %     'listbox','popupmenu': struct.(tag)=selected string, or, if the tag is in the form by 'num_tag', struct.(tag)=str2double(string)
    13 %     'table': struct.(tag)=data of the table
     13%     -case 'listbox','popupmenu': struct.(tag)=selected string, or, if the tag is in the form by 'num_tag', struct.(tag)=str2double(string)
     14%     -case 'table': struct.(tag)=data of the table
    1415%
    1516function struct=read_GUI(handle)
  • trunk/src/read_civdata.m

    r494 r497  
    176176            'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U_smooth','Civ1_V_smooth','Civ1_W','Civ1_C','Civ1_F','Civ1_FF',...
    177177            'Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps','Civ1_W_tps','Civ1_SubRange','Civ1_NbSites'};
    178         role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x',...
    179             'vector_y','vector_z','ancillary','ancillary'};
     178        role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x_tps',...
     179            'vector_y_tps','vector_z_tps','ancillary','ancillary'};
    180180        units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''};
    181181    case 'civ2'
     
    188188            'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U_smooth','Civ2_V_smooth','Civ2_W','Civ2_C','Civ2_F','Civ2_FF',...
    189189            'Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps','','Civ2_SubRange','Civ2_NbSites'};
    190         role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x',...
    191             'vector_y','vector_z','ancillary','ancillary'};
     190        role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x_tps',...
     191            'vector_y_tps','vector_z_tps','ancillary','ancillary'};
    192192        units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel',''};
    193193end
  • trunk/src/read_field.m

    r493 r497  
    1 
    2 %'read_field': read input fields in different formats
     1%'read_field': read the fields from files in different formats (netcdf files, images, video)
    32%--------------------------------------------------------------------------
    43%  function [Field,ParamOut,errormsg] = read_field(FileName,FileType,ParamIn,num)
     
    1615%INPUT
    1716% FileName: name of the input file
    18 % FileType: type of file
    19 %     = netcdf : netcdf file
    20 %     = image : usual image as recognised by Matlab
    21 %     = multimage: image series stored in a single file
    22 %     = mmreader: movie read with mmreader
    23 %     = video: movie read with VideoReader (recent versions of Matlab)
    24 %     = vol: images representing scanned volume (images concatened in the y direction)
     17% FileType: type of file, as determined by the function get_file_type.m
    2518% ParamIn: movie object or Matlab structure of input parameters
    2619%     .FieldName: name (char string) of the input field (for Civx data)
     
    2922%     .Npx, .Npy: nbre of pixels along x and y (used for .vol input files)
    3023% num: frame number for movies
     24%
     25% see also read_image.m,read_civxdata.m,read_civdata.m,
    3126
    3227function [Field,ParamOut,errormsg] = read_field(FileName,FileType,ParamIn,num)
  • trunk/src/read_image.m

    r493 r497  
    1 %--read images or video objects
    2 function [A,ParamOut]=read_image(FileName,FileType,VideoObject,num)
    3 %------------------------------------------------------------------------
    4 %num is the view number needed for an avi movie
    5 ParamOut=VideoObject;%default
     1%'read_image': read images or video objects
     2%----------------------------------------------------------------------
     3% function [A,ObjectOut]=read_image(FileName,FileType,VideoObject,num)
     4%
     5% OUTPUT:
     6% A(npy,npx,rgb): matrix of integers (iunt8 or uint16) representing the image, with sizes npy, npx, and possibly color component rgb=1:3
     7% ObjectOut: video object (=[] for images)
     8%
     9% INPUT:
     10% FileName: input file name
     11% FileType: input file type, as determined by the function get_file_type.m
     12% VideoObject: video object (for faster reading if availlable)
     13% num: frame index for movies or multimage types
     14%
     15function [A,ObjectOut]=read_image(FileName,FileType,VideoObject,num)
     16%-----------------------------------------------------------------------
     17if ~exist('VideoObject','var')
     18    VideoObject=[];
     19end
     20if ~exist('num','var')
     21    num=1;
     22end
     23ObjectOut=VideoObject;%default
    624switch FileType
    725         case 'video'
     
    927                A=read(VideoObject,num);
    1028            else
    11                 ParamOut=VideoReader(FileName);
    12                 A=read(ParamOut,num);
     29                ObjectOut=VideoReader(FileName);
     30                A=read(ObjectOut,num);
    1331            end
    1432        case 'mmreader'
     
    1634                A=read(VideoObject,num);
    1735            else
    18                 ParamOut=mmreader(FileName);
    19                 A=read(ParamOut,num);
     36                ObjectOut=mmreader(FileName);
     37                A=read(ObjectOut,num);
    2038            end
    2139    case 'multimage'
  • trunk/src/uvmat.m

    r496 r497  
    936936        if isfield(XmlData, 'GeometryCalib') && ~isempty(XmlData.GeometryCalib)
    937937            if isfield(XmlData.GeometryCalib,'VolumeScan') && isequal(XmlData.GeometryCalib.VolumeScan,'y')
    938                 set (handles.nb_slice,'String','volume')
     938                set (handles.num_NbSlice,'String','volume')
    939939            end
    940940            hgeometry_calib=findobj('tag','geometry_calib');
     
    10161016           end
    10171017           if isfield(GeometryCalib,'VolumeScan') && isequal(GeometryCalib.VolumeScan,'y')
    1018                set(handles.nb_slice,'String','volume')
     1018               set(handles.num_NbSlice,'String','volume')
    10191019           else
    1020                set(handles.nb_slice,'String',num2str(NbSlice))
     1020               set(handles.num_NbSlice,'String',num2str(NbSlice))
    10211021           end
    10221022           slices_Callback([],[], handles)
     
    12291229if get(handles.slices,'Value')==1
    12301230    set(handles.slices,'BackgroundColor',[1 1 0])
    1231     set(handles.nb_slice,'Visible','on')
     1231    set(handles.num_NbSlice,'Visible','on')
    12321232    set(handles.z_text,'Visible','on')
    12331233    set(handles.z_index,'Visible','on')
    1234     nb_slice_Callback(hObject, eventdata, handles)
     1234    num_NbSlice_Callback(hObject, eventdata, handles)
    12351235else
    1236     set(handles.nb_slice,'Visible','off')
     1236    set(handles.num_NbSlice,'Visible','off')
    12371237    set(handles.slices,'BackgroundColor',[0.7 0.7 0.7])
    12381238    set(handles.z_text,'Visible','off')
     
    12431243
    12441244%------------------------------------------------------------------------
    1245 function nb_slice_Callback(hObject, eventdata, handles)
    1246 %------------------------------------------------------------------------
    1247 nb_slice_str=get(handles.nb_slice,'String');
     1245function num_NbSlice_Callback(hObject, eventdata, handles)
     1246%------------------------------------------------------------------------
     1247nb_slice_str=get(handles.num_NbSlice,'String');
    12481248if isequal(nb_slice_str,'volume')
    12491249    num=stra2num(get(handles.j1,'String'));
     
    12521252else
    12531253    num=str2double(get(handles.i1,'String'));
    1254     nbslice=str2double(get(handles.nb_slice,'String'));
     1254    nbslice=str2double(get(handles.num_NbSlice,'String'));
    12551255end
    12561256z=mod(num-1,nbslice)+1;
     
    13261326            mdetect=exist(maskname,'file');
    13271327            if mdetect
    1328                 set(handles.nb_slice,'String',Name(i+1:ind_mask-1));
    1329                 set(handles.nb_slice,'BackgroundColor',[1 1 0])
     1328                set(handles.num_NbSlice,'String',Name(i+1:ind_mask-1));
     1329                set(handles.num_NbSlice,'BackgroundColor',[1 1 0])
    13301330                set(handles.CheckMask,'UserData',Mask);
    13311331                set(handles.CheckMask,'BackgroundColor',[1 1 0])
     
    14121412        Mask.CoordUnit='pixel';
    14131413        if isequal(get(handles.slices,'Value'),1)
    1414            NbSlice=str2num(get(handles.nb_slice,'String'));
     1414           NbSlice=str2num(get(handles.num_NbSlice,'String'));
    14151415           num_i1=str2num(get(handles.i1,'String'));
    14161416           Mask.ZIndex=mod(num_i1-1,NbSlice)+1;
     
    18421842Field_b.AY=Field_a.AY;
    18431843% z index
    1844 nbslice=str2double(get(handles.nb_slice,'String'));
     1844nbslice=str2double(get(handles.num_NbSlice,'String'));
    18451845if ~isempty(nbslice)
    18461846    Field_b.ZIndex=mod(num_i2-1,nbslice)+1;
     
    19871987% NomType=get(handles.FileIndex,'UserData');
    19881988%update the z position index
    1989 nbslice_str=get(handles.nb_slice,'String');
     1989nbslice_str=get(handles.num_NbSlice,'String');
    19901990if isequal(nbslice_str,'volume')%NOT USED
    19911991    z_index=num_j1;
     
    23902390        {'nb_tps','nb_coord','nb_subdomain'},{'nb_tps','nb_subdomain'},{'nb_tps','nb_subdomain'}}];
    23912391    Field{1}.VarAttribute{nbvar+3}.Role='coord_tps';
    2392     Field{1}.VarAttribute{nbvar+4}.Role='vector_x';
    2393     Field{1}.VarAttribute{nbvar+5}.Role='vector_y';
     2392    Field{1}.VarAttribute{nbvar+4}.Role='vector_x_tps';
     2393    Field{1}.VarAttribute{nbvar+5}.Role='vector_y_tps';
    23942394    if isfield(Field{1},'ListDimName')%cleaning
    23952395        Field{1}=rmfield(Field{1},'ListDimName');
     
    48804880    web(helpfile);
    48814881end
     4882
Note: See TracChangeset for help on using the changeset viewer.