source: trunk/src/batch_extract_rdvision.m @ 1052

Last change on this file since 1052 was 1051, checked in by sommeria, 6 years ago

psmsn cluster command updated, pb with multimask solved...

File size: 2.4 KB
Line 
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
5function batch_extract_rdvision(RootDir,FirstFolder)
6%%%%%%%%%%%%%%  CHOOSE THE ROOT FOLDER %%%%%%%%%%
7%RootDir='TOP_View'
8%RootDir='SCANSIDE';%
9%%%%%%%%%%%%%%%%%%%%%%%
10RootFolder=fullfile('/fsnet/project/coriolis/2018/18ADDUCE',RootDir);
11ParamFile=fullfile(RootFolder,'extract_param.xml');
12%XmlFile='/fsnet/project/coriolis/2018/18ADDUCE/TOP_View/im.xml';
13Param=xml2struct(ParamFile);
14switch RootDir
15    case 'TOP_View'
16        XmlFile='';
17        Param.OutputRootFile='Falcon';
18    case 'SCANSIDE'
19        XmlFile='im.xml';
20        Param.OutputRootFile='im';
21end
22ListStruct=dir(RootFolder); % get structure of the Root directory
23ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
24ListNames=ListCells(1,:);%list of file names
25index_dir=find(strcmp('isdir',fieldnames(ListStruct)));%detect folders
26check_dir=cell2mat(ListCells(index_dir,:));% =1 for directories, =0 for files
27ListDir=ListNames(check_dir);
28FirstFolder
29first=find(strcmp(FirstFolder,ListDir))
30NbFolders=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
38for 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
54end
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
Note: See TracBrowser for help on using the repository browser.