Changeset 1053
- Timestamp:
- Jul 17, 2018, 11:37:31 AM (6 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/batch_extract_rdvision.m
r1051 r1053 3 3 % to run on the cluster, edit the file extract.sh in the folder TOP_view or SCANSIDE, 4 4 % 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 %%%%%%%%%%%%%%%%%%%%%%% 5 function batch_extract_rdvision(RootDir) 6 10 7 RootFolder=fullfile('/fsnet/project/coriolis/2018/18ADDUCE',RootDir); 11 8 ParamFile=fullfile(RootFolder,'extract_param.xml'); 12 %XmlFile='/fsnet/project/coriolis/2018/18ADDUCE/TOP_View/im.xml';9 XmlFile=fullfile(RootFolder,'im.xml'); 13 10 Param=xml2struct(ParamFile); 14 11 switch RootDir … … 26 23 check_dir=cell2mat(ListCells(index_dir,:));% =1 for directories, =0 for files 27 24 ListDir=ListNames(check_dir); 28 FirstFolder 29 first=find(strcmp(FirstFolder,ListDir)) 30 NbFolders=1%5; %totql number of folders to process 25 ind_bad=[find(strcmp('.',ListDir)) find(strcmp('..',ListDir))]; 26 ListDir(ind_bad)=[]; 27 28 %NbFolders=1%5; %totql number of folders to process 31 29 % first=9;% #3 is the first folder in the list (#1='.', #2='..') 32 30 % disp('first folder') … … 36 34 % dd(last).name 37 35 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 37 for 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) 47 51 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 54 75 end 76 'PROGRAM END' 55 77 %%%%% COMMAND CLUSTER 56 78 %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.