Ignore:
Timestamp:
Nov 6, 2025, 11:06:13 PM (5 weeks ago)
Author:
sommeria
Message:

bed_scan repaired

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/bed_scan.m

    r1184 r1185  
    101101FileExt=Param.InputTable{1,5};
    102102i_series=Param.IndexRange.first_i:Param.IndexRange.incr_i:Param.IndexRange.last_i;
    103 j_series=Param.IndexRange.first_j:Param.IndexRange.incr_j:Param.IndexRange.last_j;
    104103nbfield_i=numel(i_series);
    105 nbfield_j=numel(j_series);
     104nb_scan=400;% nbre of planes for a scan
    106105
    107106%% directory for output files
    108107DirOut=fullfile(RootPath,[Param.OutputSubDir Param.OutputDirExt]);
    109108
    110 %% get the set of input file names (cell array filecell), and file indices
    111 %[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
    112 % filecell{iview,fileindex}: cell array representing the list of file names
    113 %        iview: line in the table corresponding to a given file series
    114 %        fileindex: file index within  the file series,
    115 % i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j
    116 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
    117 %nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
    118 % nbfield_i=size(i1_series{1},2); %nb of fields for the i index
    119 %
    120 % nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
     109%% get the set of input file names and frame indices
    121110CheckVirtual=false;
    122111if isfield(Param,'FileSeries')% virtual file indexing used (e.g. multitif images)
    123112    CheckVirtual=true;
    124113end
     114
    125115
    126116%%%%%%%%%%%% END STANDARD PART  %%%%%%%%%%%%fullfile(
     
    131121CalibFolder=fullfile(RootRoot,'EXP_INIT',CamName);
    132122File_init=fullfile(CalibFolder,'images.png.bed','Z_init.nc');
    133 Data_init=nc2struct(File_init);
     123[Data_init,~,~,errormsg]=nc2struct(File_init);
     124if isempty(errormsg)
     125    disp([File_init ' loaded'])
     126else
     127    disp(errormsg)
     128    return
     129end
     130%% get the time from the ImaDoc xml file
     131XmlFileName=fullfile(RootPath,[SubDir '.xml']);
     132[XmlData,warnmsg]=imadoc2struct(XmlFileName);
     133if isempty(warnmsg)
     134    Time=mean(XmlData.Time(i_series+1,2:nb_scan+1),2);% time averaged on the j index (laser scan)
     135else
     136    disp(warnmsg)
     137    Time=zeros(size(i_series));% time not defined
     138end
     139
     140
    134141%% set of y positions
    135142
    136 nb_scan=400;% nbre of planes for a scan
    137 if nbfield_j<400
    138     nb_scan=nbfield_j;
    139 end
     143
    140144%ycalib=[-51 -1 49];% calibration planes
    141145y_scan=-51+0.25*(1:nb_scan);% transverse position given by the translating system: first view at y=-51, view 400 at y=+49
     
    206210% main loop
    207211for ifield=1:nbfield_i
    208     for img=1:nbfield_j% loop on positions
     212    ifield
     213    for img=1:nb_scan % loop on y positions
    209214        if CheckVirtual
    210             [FileName,FrameIndex]=index2filename(Param.FileSeries,i_series(ifield),j_series(img),nbfield_j);
     215            [FileName,FrameIndex]=index2filename(Param.FileSeries,i_series(ifield),img,nb_scan);
    211216            InputFile=fullfile(RootPath,SubDir,FileName);
    212217        else
    213             InputFile=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,FileIndex,ifield,[],img);
     218            InputFile=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,FileIndex,i_series(ifield),[],img);
    214219            FrameIndex=1;
    215220        end
     
    252257    Data.ListVarName={'coord_x','y_scan','Z','dZ'};
    253258    Data.VarDimName={'coord_x','y_scan',{'y_scan','coord_x'},{'y_scan','coord_x'}};
     259    Data.ListGlobalAttribute={'Time'};
     260     Data.Time=Time(ifield);
    254261    Data.VarAttribute{1}.Role='coord_x';
    255262    Data.VarAttribute{1}.unit='cm';
     
    262269    Data.coord_x=coord_x;
    263270    Data.y_scan=y_scan;
    264     struct2nc(fullfile(DirOut,['dZ_' num2str(ifield) '.nc']),Data)
     271    struct2nc(fullfile(DirOut,['dZ_' num2str(i_series(ifield)) '.nc']),Data)
    265272end
    266273
Note: See TracChangeset for help on using the changeset viewer.