Ignore:
Timestamp:
Feb 5, 2011, 11:25:38 PM (13 years ago)
Author:
sommeria
Message:

introduce edit boxes to set axis limits. rationalisation of names FixScal?, FixLimits?....
introduce volume scan in calibration procedures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/imadoc2struct.m

    r185 r191  
    112112end
    113113
     114%% motor
     115if strcmp(option,'*') || strcmp(option,'GeometryCalib')
     116    uid_subtree=find(t,'/ImaDoc/TranslationMotor');
     117    if length(uid_subtree)==1
     118        subt=branch(t,uid_subtree);%subtree under GeometryCalib
     119       [s.TranslationMotor,errormsg]=read_subtree(subt,{'Nbslice','ZStart','ZEnd'},[1 1 1],[1 1 1])
     120    end
     121end
    114122%%  geometric calibration
    115123if strcmp(option,'*') || strcmp(option,'GeometryCalib')
     
    200208                end
    201209            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
    202214            if strcmp(option,'GeometryCalib')
    203215                tsai.PointCoord=get_value(subt,'/GeometryCalib/SourceCalib/PointCoord',[0 0 0 0 0]);
     
    207219    end
    208220end
     221
     222%--------------------------------------------------
     223%  read a subtree
     224% INPUT:
     225% t: xltree
     226% head_element: head elelemnt of the subtree
     227% Data, structure containing
     228%    .Key: element name
     229%    .Type: type of element ('charg', 'float'....)
     230%    .NbOccur: nbre of occurrence, NaN for un specified number
     231function [s,errormsg]=read_subtree(subt,Data,NbOccur,NumTest)
     232%--------------------------------------------------
     233s=[];%default
     234errormsg='';
     235head_element=get(subt,1,'name')
     236    cont=get(subt,1,'contents');
     237    if ~isempty(cont)
     238        for ilist=1:length(Data)
     239            uid_key=find(subt,[head_element '/' Data{ilist}])
     240            if ~isequal(length(uid_key),NbOccur(ilist))
     241                errormsg=['wrong number of occurence for ' Data{ilist}]
     242                return
     243            end
     244            for ival=1:length(uid_key)
     245                val=get(subt,children(subt,uid_key(ival)),'value')
     246                if ~NumTest(ilist)
     247                    eval(['s.' Data{ilist} '=val;']);
     248                else
     249                    eval(['s.' Data{ilist} '=str2double(val);'])
     250                end
     251            end
     252        end
     253    end
     254
    209255
    210256%--------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.