Changeset 207 for trunk


Ignore:
Timestamp:
Feb 27, 2011, 10:41:07 PM (13 years ago)
Author:
sommeria
Message:

bug fixes to deal with volumes

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r196 r207  
    254254        end     
    255255        GeometryCalib.SliceCoord=Z_plane'*[0 0 1];
     256        GeometryCalib.SliceAngle=answer{7}*ones(GeometryCalib.NbSlice,1)*[0 1 0];%rotation around y axis (to generalise)
    256257        GeometryCalib.InterfaceCoord=[0 0 str2double(answer{3})];
    257         GeometryCalib.RefractionIndex=str2double(answer{4});
     258        GeometryCalib.RefractionIndex=str2double(answer{4});     
    258259    end
    259260    errormsg=update_imadoc(GeometryCalib,outputfile);% introduce the calibration data in the xml file
  • trunk/src/imadoc2struct.m

    r197 r207  
    117117    if length(uid_subtree)==1
    118118        subt=branch(t,uid_subtree);%subtree under GeometryCalib
    119        [s.TranslationMotor,errormsg]=read_subtree(subt,{'Nbslice','ZStart','ZEnd'},[1 1 1],[1 1 1])
     119       [s.TranslationMotor,errormsg]=read_subtree(subt,{'Nbslice','ZStart','ZEnd'},[1 1 1],[1 1 1]);
    120120    end
    121121end
     
    207207                    tsai.SliceCoord=ones(NbSlice,1)*tsai.SliceCoord+DZ*(0:NbSlice-1)'*[0 0 1];
    208208                end
    209             end
    210             uid_VolumeScan=find(subt,'/GeometryCalib/VolumeScan');
    211             if ~isempty(uid_VolumeScan)
    212                 tsai.VolumeScan=get(subt,children(subt,uid_VolumeScan),'value');
    213             end
    214             tsai.InterfaceCoord=get_value(subt,'/GeometryCalib/InterfaceCoord',[0 0 0])
    215             tsai.RefractionIndex=get_value(subt,'/GeometryCalib/RefractionIndex',1)
     209            end   
     210            tsai.SliceAngle=get_value(subt,'/GeometryCalib/SliceAngle',[0 0 0]);
     211            tsai.VolumeScan=get_value(subt,'/GeometryCalib/VolumeScan','n');
     212            tsai.InterfaceCoord=get_value(subt,'/GeometryCalib/InterfaceCoord',[0 0 0]);
     213            tsai.RefractionIndex=get_value(subt,'/GeometryCalib/RefractionIndex',1);
    216214           
    217215            if strcmp(option,'GeometryCalib')
     
    236234s=[];%default
    237235errormsg='';
    238 head_element=get(subt,1,'name')
     236head_element=get(subt,1,'name');
    239237    cont=get(subt,1,'contents');
    240238    if ~isempty(cont)
    241239        for ilist=1:length(Data)
    242             uid_key=find(subt,[head_element '/' Data{ilist}])
     240            uid_key=find(subt,[head_element '/' Data{ilist}]);
    243241            if ~isequal(length(uid_key),NbOccur(ilist))
    244                 errormsg=['wrong number of occurence for ' Data{ilist}]
     242                errormsg=['wrong number of occurence for ' Data{ilist}];
    245243                return
    246244            end
    247245            for ival=1:length(uid_key)
    248                 val=get(subt,children(subt,uid_key(ival)),'value')
     246                val=get(subt,children(subt,uid_key(ival)),'value');
    249247                if ~NumTest(ilist)
    250248                    eval(['s.' Data{ilist} '=val;']);
     
    279277           if ~isempty(val_read)
    280278               val=val_read;
     279           else
     280              val=get(t,uid_child,'value');%char string data
    281281           end
    282282       end
  • trunk/src/mouse_motion.m

    r187 r207  
    103103                        text_displ_4='';
    104104                        for icell=1:numel(CellVarIndex)%look for all physical fields
    105                             if NbDim(icell)==2 % select 2D field
     105                            if NbDim(icell)>=2 % select 2D field
    106106                                if  isfield(Field,'Mesh') && ~isempty(Field.Mesh)&& ~isempty(VarType{icell}.coord_x) && ~isempty(VarType{icell}.coord_y)%case of unstructured data
    107107                                    eval(['X=Field.' Field.ListVarName{VarType{icell}.coord_x} ';'])
     
    169169%                     end
    170170                    if strcmp(text_displ_1,'')
    171                         text_displ_1=['x=' num2str(xy(1,1),3) ',y=' num2str(xy(1,2),3) ','];
    172                     end
    173                     if isfield(Field,'PlaneCoord') && isfield(Field,'ZIndex')
    174                         text_displ_1=[text_displ_1 ' z=' num2str(Field.PlaneCoord(Field.ZIndex,3))]; %TODO: generaliser au cas avec angle
     171                        text_displ_1=['x=' num2str(xy(1,1),3) ',y=' num2str(xy(1,2),3) ',']; 
     172                        z=[];
     173                        if isfield(Field,'PlaneCoord') && isfield(Field,'ZIndex')
     174                            ZIndex=Field.ZIndex;
     175                            if size(Field.PlaneCoord)>=[ZIndex 3]
     176                            z=Field.PlaneCoord(ZIndex,3);
     177                            if isfield(Field,'PlaneAngle')
     178                                om=norm(Field.PlaneAngle(ZIndex,:));%norm of rotation angle in radians
     179                                OmAxis=Field.PlaneAngle(ZIndex,:)/om; %unit vector marking the rotation axis
     180                                cos_om=cos(pi*om/180);
     181                                sin_om=sin(pi*om/180);
     182                                coeff=OmAxis(3)*(1-cos_om);
     183                                norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om;
     184                                norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om;
     185                                norm_plane(3)=OmAxis(3)*coeff+cos_om;
     186                                Z0=norm_plane*Field.PlaneCoord(ZIndex,:)'/norm_plane(3);
     187                                z=Z0-norm_plane(1)*xy(1,1)/norm_plane(3)-norm_plane(2)*xy(1,2)/norm_plane(3);
     188                            end
     189                            end
     190                        end
     191                        if ~isempty(z)
     192                            text_displ_1=[text_displ_1 ' z=' num2str(z,3)]; %TODO: generaliser au cas avec angle
     193                        end
    175194                    end
    176195                    %coordinate transform if proj_coord differs from menu_coord A REVOIR
Note: See TracChangeset for help on using the changeset viewer.