Changeset 1150


Ignore:
Timestamp:
Jun 24, 2024, 6:38:26 PM (3 months ago)
Author:
sommeria
Message:

browse_data improved

Location:
trunk/src
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/browse_data.m

    r1127 r1150  
    426426                ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
    427427                ListFiles=ListCells(1,:);
    428                 check_xml=~cellfun('isempty',regexp(ListFiles,'(\.xml|~)$'));% detect non xml files and files not marked by ~
     428                check_xml=~cellfun('isempty',regexp(ListFiles,'\.xml$'));% detect  xml files
     429                check_tild=~cellfun('isempty',regexp(ListFiles,'~$'));% detect  ~  files
    429430                index_isdir=find(strcmp('isdir',fieldnames(ListStruct)));
    430431                check_dir=cell2mat(ListCells(index_isdir,:));% =1 for directories, =0 for files
    431                 nbfiles=numel(find(~check_xml & ~check_dir));% number of non xml files
     432                nbfiles=numel(find(~check_xml & ~check_dir & ~check_tild));% number of non xml files
    432433                check_dir=check_dir & cellfun('isempty', regexp(ListFiles,'^(-|\.|\+/\.)'));% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . )
    433434                ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+','+/$0');% put '+/' in front of dir name display
     
    477478        ListCells=struct2cell(ListStruct);%transform dir struct to a cell arrray
    478479        ListFiles=ListCells(1,:);%list of dir and file  names
    479         cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . )
     480        cell_remove=regexp(ListFiles,'^((-|\.|\+/\.))');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . )
    480481        check_keep=cellfun('isempty', cell_remove);
    481482        index_isdir=find(strcmp('isdir',fieldnames(ListStruct)));
     
    721722ListDevices=get(handles.ListDevices,'String');
    722723DeviceIndices=get(handles.ListDevices,'Value');
    723 set(handles.DataSeries,'String',ListDevices);
     724set(handles.DataSeries,'String',ListDevices);%transfer list of devices to DataSeries
    724725set(handles.DataSeries,'Value',DeviceIndices);
    725726
    726727ListExperiments=get(handles.ListExperiments,'String');
    727728ExpIndices=get(handles.ListExperiments,'Value');
    728 set(handles.ListDevices,'String',ListExperiments);
     729set(handles.ListDevices,'String',ListExperiments);%transfer list of experiments to devices
    729730set(handles.ListDevices,'Value',ExpIndices);
    730731
     
    740741% set(handles.ListExperiments,'String',DataSeries)
    741742% set(handles.ListExperiments,'Value',ValueDevice)
    742 % ListExperiments_Callback(hObject, [], handles)
    743 
    744 
    745 % % --- Executes on selection change in DataSeries.
    746 % function DataSeries_Callback(hObject, eventdata, handles)
    747 % SourceDir=get(handles.SourceDir,'String');
    748 % ListData=get(handles.DataSeries,'String');
    749 % Folder=ListData{get(handles.DataSeries,'Value')};
    750 % if ~isempty(regexp(Folder,'^\+/'))% if a folder is selected
    751 %     Folder=regexprep(Folder,'\+/','');
    752 %     ListExperiments=get(handles.ListExperiments,'String');
    753 %     list_val=get(handles.ListExperiments,'Value');
    754 %     for iexp=1:numel(list_val)
    755 %         ExpName=regexprep(ListExperiments{list_val(iexp)},'\+/','');
    756 %         FullName=fullfile(SourceDir,ExpName,Folder);
    757 %         dd=dir(FullName);
    758 %         check_sub=1;
    759 %         for idir=1:numel(dd)
    760 %             ListData{ilist}=dd(ilist).name;
    761 %             if dd(ilist).isdir && ~strcmp(dd(ilist).name,'.')&& ~strcmp(dd(ilist).name,'..')&& isempty(regexp(dd(ilist).name,'^_LOG'))...
    762 %                     && isempty(regexp(dd(ilist).name,'^_LOG'))&& isempty(regexp(dd(ilist).name,'^_XML'))
    763 %                check_sub=1;
    764 %                ListData{ilist}=['+/' dd(ilist).name];
    765 %             end
    766 %         end
    767 %         if check_sub
    768 %         set(handles.ListDevices,'String',ListData);
    769 %                 set(handles.ListDevices,'Visible','on');
    770 %                 set(handles.DataSeries,'String',ListData)
    771 %                 break
    772 %         end
    773 %     end
    774 % end
    775 
    776 % % --- Executes on button press in CheckDevices.
    777 % function CheckDevices_Callback(hObject, eventdata, handles)
    778 % if get(handles.CheckDevices,'Value')
    779 %     set(handles.ListDevices,'Visible','on')
    780 %     ListDevices=get(handles.DataSeries,'String');
    781 %     Index=get(handles.DataSeries,'Value');
    782 %     set(handles.ListDevices,'String',ListDevices)
    783 %     set(handles.ListDevices,'Value',Index)
    784 %     set(handles.DataSeries,'Value',1)
    785 %     if strcmp(get(handles.MirrorDir,'Visible'),'on')
    786 %     MirrorPath=get(handles.MirrorDir,'String');
    787 %     else
    788 %     MirrorPath=get(handles.SourceDir,'String');
    789 %     end
    790 %     IndexExperiment=get(handles.ListExperiments,'Value');
    791 %     ListExperiment=get(handles.ListExperiments,'String');
    792 %     Experiment=ListExperiment{get(handles.ListExperiments,'Value')};
    793 %     Experiment=regexprep(Experiment,'^\+/','');% remove the +/ used to mark dir
    794 %     Experiment=regexprep(Experiment,'^~','');% remove the ~ used to mark symbolic link
    795 %     Device=regexprep(ListDevices{Index},'^\+/','');% remove the +/ used to mark dir
    796 %     Device=regexprep(Device,'^~','');% remove the ~ used to mark symbolic link
    797 %     DataSeries=dir(fullfile(MirrorPath,Experiment,Device));
    798 %     DataSeriesCell=struct2cell(DataSeries);
    799 %     set(handles.DataSeries,'String',DataSeriesCell(1,:)')
    800 % else
    801 %     ListDevices=get(handles.ListDevices,'String');
    802 %     Index=get(handles.ListDevices,'Value');
    803 %     set(handles.ListDevices,'Visible','off')
    804 %     set(handles.DataSeries,'String',ListDevices)
    805 %     set(handles.DataSeries,'Value',Index)
    806 % end
     743ListExperiments_Callback(hObject, [], handles)
     744SourceDir_Callback(hObject, [], handles)
    807745
    808746
  • trunk/src/geometry_calib.m

    r1148 r1150  
    346346                        display([XmlName ' updated with calibration parameters' dispmessage])
    347347                    else
    348                         display([XmlName ' created with calibration parameters' dispmessage])
     348                        display([XmlName ' created with calibration parameters: no timing defined' dispmessage])
    349349                    end
    350350                end
     
    396396%------------------------------------------------------------------------
    397397% --- Executes on button press in Replicate
    398     function Replicate_Callback(hObject, eventdata, handles)
    399         % %------------------------------------------------------------------------
    400         set(handles.CheckEnableMouse,'Value',0)% desactivate mouse (to avoid spurious creation of new points)
    401        
    402         if get(handles.Replicate,'Value') %open the GUI browse_data
    403             % look for the GUI uvmat and check for an image as input
    404             huvmat=findobj(allchild(0),'Name','uvmat');
    405             hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
    406             RootPath=get(hhuvmat.RootPath,'String');
    407             SubDir=get(hhuvmat.SubDir,'String');
    408             browse_data(fullfile(RootPath,SubDir))
    409         else
    410             hbrowse=findobj(allchild(0),'Tag','browse_data');
    411             if ~isempty(hbrowse)
    412                 delete(hbrowse)
    413             end
    414         end
     398function Replicate_Callback(hObject, eventdata, handles)
     399% %------------------------------------------------------------------------
     400set(handles.CheckEnableMouse,'Value',0)% desactivate mouse (to avoid spurious creation of new points)
     401
     402if get(handles.Replicate,'Value') %open the GUI browse_data
     403    % look for the GUI uvmat and check for an image as input
     404    huvmat=findobj(allchild(0),'Name','uvmat');
     405    hhuvmat=guidata(huvmat);%handles of elements in the GUI uvmat
     406    RootPath=get(hhuvmat.RootPath,'String');
     407    SubDir=get(hhuvmat.SubDir,'String');
     408    browse_data(fullfile(RootPath,SubDir))
     409else
     410    hbrowse=findobj(allchild(0),'Tag','browse_data');
     411    if ~isempty(hbrowse)
     412        delete(hbrowse)
     413    end
     414end
    415415%------------------------------------------------------------------------
    416416% --- activate calibration and store parameters in ouputfile .
     
    12941294    Heading=s.Heading;
    12951295end
    1296 
     1296if isfield (s,'GeometryCalib')
    12971297GeometryCalib=s.GeometryCalib;
    12981298fx=1;fy=1;Cx=0;Cy=0;kc=0; %default
     
    13411341    set(handles.CheckEnableMouse,'BackgroundColor',[0.7 0.7 0.7])
    13421342end
    1343 
     1343end
    13441344%------------------------------------------------------------------------
    13451345%---display calibration intrinsic parameters
  • trunk/src/imadoc2struct.m

    r1149 r1150  
    7070        s.Camera.FirstFrameIndexI=1; %first index assumed equl to 1 by default
    7171    end
    72     Timing=s.Camera.BurstTiming;
    73     if ~iscell(Timing)
    74         Timing={Timing};
    75     end
     72    s.Time=xmlburst2time(s.Camera.BurstTiming,s.Camera.FirstFrameIndexI);
     73end
    7674
    77     s.Time=[];
    78     for k=1:length(Timing)
    79         Frequency=1;
    80         if isfield(Timing{k},'FrameFrequency')
    81             Frequency=Timing{k}.FrameFrequency;
    82         end
    83         Dtj=[];
    84         if isfield(Timing{k},'Dtj')
    85             Dtj=Timing{k}.Dtj/Frequency;%Dtj converted from frame unit to TimeUnit (e.g. 's');
    86         end
    87         NbDtj=1;
    88         if isfield(Timing{k},'NbDtj')&&~isempty(Timing{k}.NbDtj)
    89             NbDtj=Timing{k}.NbDtj;
    90         end
    91         Dti=[];
    92         if isfield(Timing{k},'Dti')
    93             Dti=Timing{k}.Dti/Frequency;%Dti converted from frame unit to TimeUnit (e.g. 's');
    94         end
    95         NbDti=1;
    96         if isfield(Timing{k},'NbDti')&&~isempty(Timing{k}.NbDti)
    97             NbDti=Timing{k}.NbDti;
    98         end
    99         Time_val=Timing{k}.Time;%time in TimeUnit
    100         if ~isempty(Dti)
    101             Dti=reshape(Dti'*ones(1,NbDti),NbDti*numel(Dti),1); %concatene Dti vector NbDti times
    102             Time_val=[Time_val;Time_val(end)+cumsum(Dti)];%append the times defined by the intervals  Dti
    103         end
    104         if ~isempty(Dtj)
    105             Dtj=reshape(Dtj'*ones(1,NbDtj),1,NbDtj*numel(Dtj)); %concatene Dtj vector NbDtj times
    106             Dtj=[0 Dtj];
    107             Time_val=Time_val*ones(1,numel(Dtj))+ones(numel(Time_val),1)*cumsum(Dtj);% produce a time matrix with Dtj
    108         end
    109         % reading Dtk
    110         Dtk=[];%default
    111         NbDtk=1;%default
    112         if isfield(Timing{k},'Dtk')
    113             Dtk=Timing{k}.Dtk;
    114         end
    115         if isfield(Timing{k},'NbDtk')&&~isempty(Timing{k}.NbDtk)
    116             NbDtk=Timing{k}.NbDtk;
    117         end
    118         if isempty(Dtk)
    119             s.Time=[s.Time;Time_val];
    120         else
    121             for kblock=1:NbDtk+1
    122                 Time_val_k=Time_val+(kblock-1)*Dtk;
    123                 s.Time=[s.Time;Time_val_k];
    124             end
    125         end
    126     end
    127    
    128     s.Time=[zeros(size(s.Time,1),1) s.Time]; %insert a vertical line of zeros (to deal with zero file indices)
    129     if s.Camera.FirstFrameIndexI~=0
    130     s.Time=[zeros(s.Camera.FirstFrameIndexI,size(s.Time,2)); s.Time]; %insert a horizontal line of zeros
    131     end
    132 end
    13375
    13476function [s,errormsg]=read_subtree(subt,Data,NbOccur,NumTest)
  • trunk/src/series.m

    r1148 r1150  
    14201420%% create the Action fct handle if RunMode option = 'local'
    14211421if strcmp(RunMode,'local')
    1422     if ~isequal(ActionPath,path_series)
    1423         eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION
    1424         if ~exist(ActionPath,'dir')
    1425             errormsg=['The prescribed function path ' ActionPath ' does not exist'];
    1426             return
    1427         end
    1428         if ~isequal(spath,ActionPath)
    1429             addpath(ActionPath)% add the prescribed path if not the current one
    1430         end
    1431     end
    1432     eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION
    1433     if ~isequal(ActionPath,path_series)
    1434         rmpath(ActionPath)% add the prescribed path if not the current one
    1435     end
    1436 end
     1422    current_dir=pwd; % current working dir
     1423cd(ActionPath)
     1424h_fun=str2func(ActionName);% create the function handle for the function ActionName
     1425cd(current_dir)
     1426    % if ~isequal(ActionPath,path_series)
     1427    %
     1428    %     %eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION
     1429    %     if ~exist(ActionPath,'dir')
     1430    %         errormsg=['The prescribed function path ' ActionPath ' does not exist'];
     1431    %         return
     1432    %     end
     1433    %     spath=fileparts(which(ActionName));
     1434    %     if ~strcmp(spath,ActionPath)
     1435    %         addpath(ActionPath)% add the prescribed path if not the current one
     1436    %     end
     1437    % end
     1438    % eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION
     1439    % if ~isequal(ActionPath,path_series)
     1440    %     rmpath(ActionPath)% add the prescribed path if not the current one
     1441    % end
     1442 end
    14371443
    14381444%% Get  parameters from series.xml
  • trunk/src/series/civ_3D.m

    r1148 r1150  
    290290        par_civ1.ImageB=zeros(2*SearchRange_z+1,npy,npx);
    291291
    292         for islice=ceil(par_civ1.Dz/2):par_civ1.Dz:NbSlice
    293             if par_civ1.Dz<2*SearchRange_z+1
     292        for islice=par_civ1.Dz:NbSlice
     293            if par_civ1.Dz<2*SearchRange_z+1 
    294294            par_civ1.ImageA=circshift(par_civ1.ImageA,-par_civ1.Dz);
    295295            par_civ1.ImageB=circshift(par_civ1.ImageA,-par_civ1.Dz);
    296296            end
    297297              for iz=1:par_civ1.Dz
    298             ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(ifield),[],j1_series_Civ1(ifield,islice));
     298            ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(1,ifield),[],j1_series_Civ1(islice+SearchRange_z-iz+1,1));
    299299            A= read_image(ImageName_A,FileType_A);
    300             ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield,islice));
     300            ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(1,ifield),[],j1_series_Civ1(islice+SearchRange_z-iz+1,1));
    301301            B= read_image(ImageName_B,FileType_B);
    302302            par_civ1.ImageA(2*SearchRange_z+2-iz,:,:) = A;
  • trunk/src/xml2struct.m

    r1127 r1150  
    5959        else
    6060        tsub=branch(t,uid_sub);
     61        if ~isempty(get(tsub,1,'contents'))
    6162        ss=convert(tsub);
    6263        s.(varargin{isub})=convert_string(ss);
     64        end
    6365        end
    6466    end
  • trunk/src/xmlburst2time.m

    r1149 r1150  
    55if ~iscell(BurstTiming)
    66    BurstTiming={BurstTiming};
    7     BurstTiming{1}.Time=0;%time origin set to zero by default
    87end
    98TimeMatrix=[];
     
    1211    if isfield(BurstTiming{k},'FrameFrequency')
    1312        Frequency=BurstTiming{k}.FrameFrequency;
     13    end
     14    if isfield(BurstTiming{k},'Time')
     15        BurstTiming{k}.Time=0;%time origin set to zero by default
    1416    end
    1517    Dtj=[];
     
    5860end
    5961TimeMatrix=[zeros(size(TimeMatrix,1),1) TimeMatrix]; %insert a vertical line of zeros (to deal with zero file indices)
    60     if FirstFrameIndexI~=0
     62if FirstFrameIndexI~=0
    6163    TimeMatrix=[zeros(FirstFrameIndexI,size(TimeMatrix,2)); TimeMatrix]; %insert a horizontal line of zeros
    62     end
     64end
Note: See TracChangeset for help on using the changeset viewer.