Changeset 1053 for trunk


Ignore:
Timestamp:
Jul 17, 2018, 11:37:31 AM (6 years ago)
Author:
sommeria
Message:

bed_scan added

Location:
trunk/src
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/batch_extract_rdvision.m

    r1051 r1053  
    33% to run on the cluster, edit the file extract.sh in the folder TOP_view or SCANSIDE,
    44% Then oarsub -l "walltime=20:00:00" /fsnet/project/coriolis/2018/18ADDUCE/TOP_View/extract.sh
    5 function batch_extract_rdvision(RootDir,FirstFolder)
    6 %%%%%%%%%%%%%%  CHOOSE THE ROOT FOLDER %%%%%%%%%%
    7 %RootDir='TOP_View'
    8 %RootDir='SCANSIDE';%
    9 %%%%%%%%%%%%%%%%%%%%%%%
     5function batch_extract_rdvision(RootDir)
     6
    107RootFolder=fullfile('/fsnet/project/coriolis/2018/18ADDUCE',RootDir);
    118ParamFile=fullfile(RootFolder,'extract_param.xml');
    12 %XmlFile='/fsnet/project/coriolis/2018/18ADDUCE/TOP_View/im.xml';
     9XmlFile=fullfile(RootFolder,'im.xml');
    1310Param=xml2struct(ParamFile);
    1411switch RootDir
     
    2623check_dir=cell2mat(ListCells(index_dir,:));% =1 for directories, =0 for files
    2724ListDir=ListNames(check_dir);
    28 FirstFolder
    29 first=find(strcmp(FirstFolder,ListDir))
    30 NbFolders=1%5; %totql number of folders to process
     25ind_bad=[find(strcmp('.',ListDir)) find(strcmp('..',ListDir))];
     26ListDir(ind_bad)=[];
     27
     28%NbFolders=1%5; %totql number of folders to process
    3129% first=9;% #3 is the first folder in the list (#1='.', #2='..')
    3230% disp('first folder')
     
    3634% dd(last).name
    3735
    38 for ilist=first:first+NbFolders-1
    39     Param.InputTable{1}=fullfile(RootFolder,ListDir{ilist});%folder exp
    40     ddd=dir(Param.InputTable{1});
    41     Param.InputTable{2}=ddd(3).name;
    42     DataFolder=fullfile(Param.InputTable{1},Param.InputTable{2});
    43     ExtractFolder=fullfile(Param.InputTable{1},[Param.InputTable{2} '.extract']);
    44     mkdir(ExtractFolder)
    45     if ~isempty(XmlFile)
    46     copyfile(fullfile(RootFolder,XmlFile),fullfile(DataFolder,[Param.OutputRootFile '.xml']));
     36%for ilist=first:first+NbFolders-1
     37for ilist=1:numel(ListDir)
     38    disp([ListDir{ilist} ' opened'])
     39    ddd=dir(fullfile(RootFolder,ListDir{ilist}));
     40    dddCells=struct2cell(ddd);% transform dir struct to a cell arrray
     41    dddNames=dddCells(1,:);%list of file names
     42    checkdone=false;
     43    checkrdvision=0;
     44    for iname=1:numel(dddNames)
     45        checkdone=~isempty(regexp(dddNames{iname},'.extract$'));
     46        if checkdone
     47            disp('already extracted')
     48            break
     49        end
     50        checkrdvision=checkrdvision+isequal(regexp(dddNames{iname},'^2018-'),1)
    4751    end
    48     seqname=fullfile(DataFolder,[Param.InputTable{3} Param.InputTable{5}]);
    49     [A,FileInfo,timestamps,errormsg]=read_rdvision(seqname,[]);
    50     Param.IndexRange.last_i=str2num(FileInfo.numberoffiles);   
    51     Param.OutputSubDir=Param.InputTable{2};
    52     Param.ActionInput.LogPath= DataFolder;
    53     extract_rdvision(Param)% apply the function used in series
     52    if ~checkdone
     53        if checkrdvision==0
     54            disp('no rdvision folder')
     55        elseif checkrdvision>1
     56            disp('multiple rdvision folders, no extraction')
     57        else
     58            Param.InputTable{1}=fullfile(RootFolder,ListDir{ilist});%folder exp
     59            Param.InputTable{2}=ddd(3).name;
     60            DataFolder=fullfile(Param.InputTable{1},Param.InputTable{2});
     61            ExtractFolder=fullfile(Param.InputTable{1},[Param.InputTable{2} '.extract']);
     62            mkdir(ExtractFolder)
     63            if ~isempty(XmlFile)
     64                copyfile(XmlFile,fullfile(DataFolder,[Param.OutputRootFile '.xml']));
     65            end
     66            seqname=fullfile(DataFolder,[Param.InputTable{3} Param.InputTable{5}]);
     67            [A,FileInfo,timestamps,errormsg]=read_rdvision(seqname,[]);
     68            Param.IndexRange.last_i=str2num(FileInfo.numberoffiles);
     69            Param.OutputSubDir=Param.InputTable{2};
     70            Param.ActionInput.LogPath= DataFolder;
     71            extract_rdvision(Param)% apply the function used in series
     72            disp([ListDir{ilist} ' extracted'])
     73        end
     74    end
    5475end
     76'PROGRAM END'
    5577%%%%% COMMAND CLUSTER
    5678%oarsub -l "walltime=10:00:00" /fsnet/project/coriolis/2018/18ADDUCE/SCANSIDE/extract.sh -E /fsnet/project/coriolis/2018/18ADDUCE/SCANSIDE/error -O /fsnet/project/coriolis/2018/18ADDUCE/SCANSIDE/stdout
Note: See TracChangeset for help on using the changeset viewer.