[1051] | 1 | |
---|
| 2 | %%% extract a series of image folders from RDvision |
---|
| 3 | % to run on the cluster, edit the file extract.sh in the folder TOP_view or SCANSIDE, |
---|
| 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 | %%%%%%%%%%%%%%%%%%%%%%% |
---|
| 10 | RootFolder=fullfile('/fsnet/project/coriolis/2018/18ADDUCE',RootDir); |
---|
| 11 | ParamFile=fullfile(RootFolder,'extract_param.xml'); |
---|
| 12 | %XmlFile='/fsnet/project/coriolis/2018/18ADDUCE/TOP_View/im.xml'; |
---|
| 13 | Param=xml2struct(ParamFile); |
---|
| 14 | switch RootDir |
---|
| 15 | case 'TOP_View' |
---|
| 16 | XmlFile=''; |
---|
| 17 | Param.OutputRootFile='Falcon'; |
---|
| 18 | case 'SCANSIDE' |
---|
| 19 | XmlFile='im.xml'; |
---|
| 20 | Param.OutputRootFile='im'; |
---|
| 21 | end |
---|
| 22 | ListStruct=dir(RootFolder); % get structure of the Root directory |
---|
| 23 | ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray |
---|
| 24 | ListNames=ListCells(1,:);%list of file names |
---|
| 25 | index_dir=find(strcmp('isdir',fieldnames(ListStruct)));%detect folders |
---|
| 26 | check_dir=cell2mat(ListCells(index_dir,:));% =1 for directories, =0 for files |
---|
| 27 | ListDir=ListNames(check_dir); |
---|
| 28 | FirstFolder |
---|
| 29 | first=find(strcmp(FirstFolder,ListDir)) |
---|
| 30 | NbFolders=1%5; %totql number of folders to process |
---|
| 31 | % first=9;% #3 is the first folder in the list (#1='.', #2='..') |
---|
| 32 | % disp('first folder') |
---|
| 33 | % dd(first).name |
---|
| 34 | % last=15;%19; |
---|
| 35 | % disp('last folder') |
---|
| 36 | % dd(last).name |
---|
| 37 | |
---|
| 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'])); |
---|
| 47 | 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 |
---|
| 54 | end |
---|
| 55 | %%%%% COMMAND CLUSTER |
---|
| 56 | %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 |
---|