Changeset 342


Ignore:
Timestamp:
Dec 20, 2011, 5:14:43 PM (9 years ago)
Author:
sommeria
Message:

various bugs corrected

Location:
trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_file_series.m

    r339 r342  
    143143                break
    144144            end
    145         else
    146             ref_j=j1;
    147             if isempty(j2_input)
    148                 if  ~isempty(j2)% invalid file name if j2 does not exist in the input file
    149                     break
     145        else %j1_input is not empty
     146            if isempty(j1)% the detected name does not fit with the input
     147                break
     148            else
     149                ref_j=j1;
     150                if isempty(j2_input)
     151                    if  ~isempty(j2)% invalid file name if j2 does not exist in the input file
     152                        break
     153                    end
     154                else
     155                    ref_j=floor((j1+j2)/2);
    150156                end
    151             else
    152                 ref_j=floor((j1+j2)/2);
    153157            end
    154158        end
  • trunk/src/keyboard_callback.m

    r192 r342  
    3333            elseif isfield(AxeData,'LimEditBox')&& isequal(AxeData.LimEditBox,1)% update display of the GUI containing the axis (uvmat or view_field)
    3434                hh=guidata(hfig);
    35                 if isfield(hh,'MinX')
    36                     set(hh.MinX,'String',num2str(xlimit(1)))
    37                     set(hh.MaxX,'String',num2str(xlimit(2)))
    38                     set(hh.MinY,'String',num2str(ylimit(1)))
    39                     set(hh.MaxY,'String',num2str(ylimit(2)))
     35                if isfield(hh,'num_MinX')
     36                    set(hh.num_MinX,'String',num2str(xlimit(1)))
     37                    set(hh.num_MaxX,'String',num2str(xlimit(2)))
     38                    set(hh.num_MinY,'String',num2str(ylimit(1)))
     39                    set(hh.num_MaxY,'String',num2str(ylimit(2)))
    4040                end
    4141            end
  • trunk/src/mouse_down.m

    r332 r342  
    353353            set(hhuvmat.transform_fct,'Value',1)
    354354            uvmat('transform_fct_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat
    355             set(hhuvmat.FixedLimits,'Value',0)% put FixedLimits option to 'off'
    356             set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
     355            set(hhuvmat.CheckFixedLimits,'Value',0)% put FixedLimits option to 'off'
     356            set(hhuvmat.CheckFixedLimits,'BackgroundColor',[0.7 0.7 0.7])
    357357            return
    358358        end
  • trunk/src/series.m

    r341 r342  
    490490CData=zeros([size(XIma) 3]);
    491491file_ima=double((i1_series(:,:,1)>0)');
     492if numel(file_ima)>=2
    492493if size(file_ima,1)==1
    493494    CLine=interp1(ind_i,file_ima,xima,'nearest');
     
    499500end
    500501set(handles.waitbar_frame,'CData',CData)
     502end
    501503set(handles.waitbar_frame,'Units','normalized')
     504
    502505% CData(:,1:floor(advance_ratio*size(CData,2)),1:2)=1;
    503506% set(hwaitbar,'CData',CData)
     
    16731676function num_first_i_Callback(hObject, eventdata, handles)
    16741677%------------------------------------------------------------------------
    1675 last_i_Callback(hObject, eventdata, handles)
     1678num_last_i_Callback(hObject, eventdata, handles)
    16761679
    16771680%------------------------------------------------------------------------
     
    16871690function num_first_j_Callback(hObject, eventdata, handles)
    16881691%------------------------------------------------------------------------
    1689  last_j_Callback(hObject, eventdata, handles)
     1692 num_last_j_Callback(hObject, eventdata, handles)
    16901693
    16911694%------------------------------------------------------------------------
  • trunk/src/set_grid.m

    r315 r342  
    264264textout=char(textgrid);
    265265imageA=get(handles.image_1,'String');
    266 [Pathsub]=name2display(imageA);
    267 Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile(Pathsub,'gridA.grid'));
     266RootPath=fileparts_uvmat(imageA);
     267%[Pathsub]=name2display(imageA);
     268Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile(RootPath,'gridA.grid'));
    268269% Answer = inputdlg('grid file name (*.grid)',' ',1,{fullfile(Pathsub,'gridA.grid')},'on');
    269270dlmwrite(Answer,textout,'');
     
    281282    textgrid={tete;txt};
    282283    textout=char(textgrid);
    283     Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile(Pathsub,'gridB.grid'));
     284    Answer = msgbox_uvmat('INPUT_TXT','grid file name (*.grid)',fullfile(RootPath,'gridB.grid'));
    284285    dlmwrite(Answer,textout,'');
    285286    msgbox_uvmat('CONFIRMATION',[Answer ' written as ASCII text file']);
     
    287288
    288289%-------------------------
    289 function [grid_pix_A,grid_pix_B]=get_grid(handles);
     290function [grid_pix_A,grid_pix_B]=get_grid(handles)
    290291%Object=read_set_object(handles);%read the set_grid interface;
    291292grid_pix_B=[];%default
     
    296297YMin=str2num(get(handles.YMin,'String'));
    297298YMax=str2num(get(handles.YMax,'String'));
    298 array_realx=[XMin:DX:XMax];
    299 array_realy=[YMin:DY:YMax];
     299array_realx=XMin:DX:XMax;
     300array_realy=YMin:DY:YMax;
    300301nx_patch=length(array_realx);
    301302ny_patch=length(array_realy);
     
    325326    return
    326327end
    327 [Pathsub,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(imageA);
    328 form=imformats(ext(2:end));
     328%[Pathsub,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(imageA);
     329[RootPath,~,RootFile,~,~,~,~,FileExt]=fileparts_uvmat(imageA);
     330form=imformats(FileExt(2:end));
    329331if isempty(form)% if the extension corresponds to an image format recognized by Matlab
    330332     msgbox_uvmat('ERROR',['error: ' imageA ' is not an image name recognized by Matlab '])
    331333     return
    332334end
    333 fileAxml=[fullfile(Pathsub,RootFile) '.xml'];
     335fileAxml=[fullfile(RootPath,RootFile) '.xml'];
    334336[XmlDataA,error]=imadoc2struct(fileAxml);
    335337if isfield(XmlDataA,'GeometryCalib')
     
    360362        return
    361363    end
    362     [Pathsub,RootFile,field_count,str2,str_a,str_b,ext,nom_type,subdir]=name2display(imageB);
    363     form=imformats(ext([2:end]));
     364    %[RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(imageB);
     365    [RootPath,~,RootFile,~,~,~,~,FileExt]=fileparts_uvmat(imageB);
     366    form=imformats(FileExt(2:end));
    364367    if isempty(form)% if the extension corresponds to an image format recognized by Matlab
    365          msgbox_uvmat('ERROR',['error: ' imageB ' is not an image name recognized by Matlab '])
    366          return
    367     end
    368     fileBxml=[fullfile(Pathsub,RootFile) '.xml'];
    369     [XmlDataB,error]=imadoc2struct(fileBxml); 
     368        msgbox_uvmat('ERROR',['error: ' imageB ' is not an image name recognized by Matlab '])
     369        return
     370    end
     371    fileBxml=[fullfile(RootPath,RootFile) '.xml'];
     372    [XmlDataB,error]=imadoc2struct(fileBxml);
    370373    if isfield(XmlDataB,'GeometryCalib')
    371      tsaiB=XmlDataB.GeometryCalib;
     374        tsaiB=XmlDataB.GeometryCalib;
    372375    else
    373      msgbox_uvmat('WARNING','no geometric calibration available for image B')
    374      tsaiB=[];
    375  end
    376     %[error,Heading,nom_type_read,ext_ima_read,time,TimeUnit,mode,NbSlice,...
     376        msgbox_uvmat('WARNING','no geometric calibration available for image B')
     377        tsaiB=[];
     378    end
     379    %[error,Heading,NomType_read,ext_ima_read,time,TimeUnit,mode,NbSlice,...
    377380    %     npxB,npyB,tsaiB]=read_imadoc(fileBxml,0);
    378381    [grid_imaB(:,1),grid_imaB(:,2)]=px_XYZ(tsaiB,grid_real(:,1),grid_real(:,2),0);
    379 %     if isempty(npxB)|isempty(npyB)
    380         B=imread(imageB);
    381        siz=size(B);
    382        npxB=siz(2);
    383        npyB=siz(1);
    384 %     end
    385     flagB=grid_imaB(:,1)>0 & grid_imaB(:,1)<npxB & grid_imaB(:,2)>0 & grid_imaB(:,2)<npyB; 
     382    %     if isempty(npxB)|isempty(npyB)
     383    B=imread(imageB);
     384    siz=size(B);
     385    npxB=siz(2);
     386    npyB=siz(1);
     387    %     end
     388    flagB=grid_imaB(:,1)>0 & grid_imaB(:,1)<npxB & grid_imaB(:,2)>0 & grid_imaB(:,2)<npyB;
    386389end
    387390if testB
  • trunk/src/set_object.m

    r341 r342  
    672672hhuvmat=guidata(huvmat);%handles in the uvmat GUI
    673673ListObject=get(hhuvmat.ListObject,'String');%position in the objet list
    674 IndexObj=get(hhuvmat.ListObject,'Value')
     674IndexObj=get(hhuvmat.ListObject,'Value');
    675675
    676676%% read the object on the GUI set_object
     677ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object
    677678ObjectName=get(handles.TITLE,'String');%name of the current object defiend in set_object
    678 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object
    679679if isempty(ObjectName)
    680680    if get(hhuvmat.edit_object,'Value')% edit mode
    681681        ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item
     682    else %new object
     683        StyleList=get(handles.ObjectStyle,'String');
     684        StyleVal=get(handles.ObjectStyle,'Value');
     685        ObjectName=StyleList{StyleVal};
     686        %ObjectName=[num2str(numel(ListObject)+1) '-' StyleList{StyleVal}];% take the object style as default name
    682687    end
    683688end
     
    700705    end
    701706    ObjectName=ObjectNameNew;
    702     ObjectName=[num2str(IndexObj(end)) '-' ObjectData.Style];%default name
     707%     ObjectName=[num2str(IndexObj(end)) '-' ObjectData.Style];%default name
     708    set(handles.TITLE,'String',ObjectName)% display the default name in set_object
     709    IndexObj(2)=numel(ListObject)+1;% append an object to the list in uvmat
     710    set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list
     711    set(hhuvmat.ListObject,'Value',IndexObj)
     712    UvData.Object{IndexObj(2)}=[];%initiate a new object (empty yet)
    703713end
    704714% IndexObj_1=IndexObj(1);
  • trunk/src/uvmat.m

    r341 r342  
    19861986
    19871987%% determine the input file type
    1988 if (test_1 && isfield(UvData,'MovieObject_1'))||(~test_1 && isfield(UvData,'MovieObject'))
     1988if (test_1 && isfield(UvData,'MovieObject_1'))||(~test_1 && ~isempty(UvData.MovieObject))
    19891989    FileType='movie';
    19901990elseif isequal(lower(Ext),'.avi')
     
    42494249list_str=get(handles.ListObject,'String');
    42504250IndexObj_old=get(handles.ListObject,'UserData');%retrieve previous selection
    4251 IndexObj=get(handles.ListObject,'Value');
     4251IndexObj=get(handles.ListObject,'Value');%present object selection
     4252
     4253%% we select two objects or more at once (using the Ctrl key), keep only the last two items: the first is projected on uvmat, the second on view_field
    42524254if length(IndexObj)>2
    42534255     IndexObj=[IndexObj(end-1) IndexObj(end)];%keeps only the last two selected items at most
    42544256end
    4255 if length(IndexObj)==1
    4256     if length(IndexObj_old)>=2 && isequal(IndexObj_old(1),IndexObj)       
    4257         IndexObj=IndexObj_old(2);
    4258     elseif length(IndexObj_old)>=2 && isequal(IndexObj_old(2),IndexObj)
    4259         IndexObj=IndexObj_old(1);
    4260     else
    4261         IndexObj=[IndexObj_old(1) IndexObj];
    4262     end
    4263 end
    4264 set(handles.ListObject,'Value',IndexObj); %keeps only the two first selected objects
    4265 set(handles.ListObject,'UserData',IndexObj)
    4266  %desactivate the edit object mode
    4267 set(handles.edit_object,'Value',0)
     4257
     4258%% we select one object
     4259if length(IndexObj)==1%
     4260    if length(IndexObj_old)>=2 && isequal(IndexObj_old(1),IndexObj)   % we select the first previously selected object->
     4261        IndexObj=[1 IndexObj_old(2)];% it desactivates this object and selects the first object for uvmat
     4262    elseif length(IndexObj_old)>=2 && isequal(IndexObj_old(2),IndexObj) % we select the second previously selected object->
     4263        IndexObj=IndexObj_old(1);% it desactivates this object  and keeps only the first previously selected object (uvmat)
     4264    else %
     4265        IndexObj=[IndexObj_old(1) IndexObj];% activates a second object while keeping the first previously selected one
     4266    end
     4267end
     4268set(handles.ListObject,'Value',IndexObj); % marks the selected objects in the list
     4269set(handles.ListObject,'UserData',IndexObj)% keep the current object selection in memory for next time
     4270
     4271%% update the object representation
     4272set(handles.edit_object,'Value',0) % desactivate the edit object mode
    42684273edit_object_Callback(hObject, eventdata, handles)
    42694274UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
     
    42724277    return
    42734278end
    4274 UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));
    4275 set(handles.uvmat,'UserData',UvData)
    4276 
    4277 %project on the selected object and update the corresponding plot
     4279if numel(IndexObj)>=2
     4280    UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));%update the current object graphic representation
     4281    set(handles.uvmat,'UserData',UvData)
     4282end
     4283
     4284%% project on the selected object and update the corresponding plot
     4285% hview_field=findobj(allchild(0),'tag','view_field');
     4286% ViewObjectAxes=[];%default
     4287if ~isequal(IndexObj(1),IndexObj_old(1))
     4288    update_object(handles,IndexObj(1),handles.axes3,list_str{IndexObj(1)})%plot the projection in uvmat
     4289end
    42784290hview_field=findobj(allchild(0),'tag','view_field');
    4279 ViewObjectAxes=[];%default
    4280 if ~isequal(IndexObj(1),IndexObj_old(1))
    4281 update_object(handles,IndexObj(1),handles.axes3,list_str{IndexObj(1)})%plot the projection in uvmat
    4282 end
    42834291if length(IndexObj)==2 && (length(IndexObj_old)==1 || ~isequal(IndexObj(2),IndexObj_old(2)))
    4284     hview_field=findobj(allchild(0),'tag','view_field');
    42854292    if isempty(hview_field)
    42864293        hview_field=view_field;
     
    42884295    PlotHandles=guidata(hview_field);
    42894296    update_object(handles,IndexObj(2),PlotHandles.axes3,list_str{IndexObj(2)})%plot the projection in view_field
    4290 end
    4291 update_object_color(handles.axes3,PlotHandles.axes3,UvData.Object{IndexObj(2)}.DisplayHandle_uvmat)
     4297    update_object_color(handles.axes3,PlotHandles.axes3,UvData.Object{IndexObj(2)}.DisplayHandle_uvmat)
     4298else
     4299    if ~isempty(hview_field)
     4300        delete(hview_field)
     4301    end
     4302    hset_object=findobj(allchild(0),'tag','set_object');
     4303    if ~isempty(hset_object)
     4304        delete(hset_object)
     4305    end
     4306    update_object_color(handles.axes3,handles.axes3,[])
     4307end
     4308
     4309%% update the color of the gfraphic object representation: the selected object in magenta, others in blue
     4310% update_object_color(handles.axes3,PlotHandles.axes3,UvData.Object{IndexObj(2)}.DisplayHandle_uvmat)
    42924311
    42934312%------------------------------------------------------------------------
     
    43084327if ~isempty(hset_object)
    43094328    delete(hset_object)% delete existing version of set_object
     4329end
    43104330    hset_object=set_object(ObjectData,[],ZBounds);
    4311 end
     4331% end
    43124332edit_test=get(handles.edit_object,'Value');
    43134333if edit_test
     
    43474367    set(hother(iobj),'Selected','off')
    43484368end
     4369if ~isempty(DisplayHandle)
    43494370linetype=get(DisplayHandle,'Type');
    43504371if isequal(linetype,'line')
     
    43724393if isfield(SubObjectData,'DeformPoint') & ishandle(SubObjectData.DeformPoint)
    43734394    set(SubObjectData.DeformPoint,'Color','m')
     4395end
    43744396end
    43754397
Note: See TracChangeset for help on using the changeset viewer.