Skip to content
Snippets Groups Projects
Commit 0526acac authored by Yoann Guilhem's avatar Yoann Guilhem
Browse files

Code formatting in gtCopyDataForTest

parent 92f62aa7
No related branches found
No related tags found
No related merge requests found
...@@ -27,10 +27,10 @@ if ~exist('newdir', 'var') || isempty(newdir) ...@@ -27,10 +27,10 @@ if ~exist('newdir', 'var') || isempty(newdir)
end end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% directories % Directories
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('Creating the directories...') disp('Creating the new dataset directories...');
if exist(fullfile(newdir, new_pattern),'dir') if exist(fullfile(newdir, new_pattern), 'dir')
gtError('gtCopyDataForTest:wrong_directory', ... gtError('gtCopyDataForTest:wrong_directory', ...
'New directory already exists. Please check the directory name.'); 'New directory already exists. Please check the directory name.');
elseif ~exist(newdir, 'dir') elseif ~exist(newdir, 'dir')
...@@ -41,11 +41,11 @@ end ...@@ -41,11 +41,11 @@ end
[~, msg] = mkdir(fullfile(newdir, new_pattern, '0_rawdata', 'Orig')); disp(msg); [~, msg] = mkdir(fullfile(newdir, new_pattern, '0_rawdata', 'Orig')); disp(msg);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% images % Images
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% copying data % Copying data
disp('Copying the images...') disp('Copying and the images to the new directory...');
copyfile(fullfile(workdir, old_pattern, '0_rawdata', 'Orig', '*.edf'), ... copyfile(fullfile(workdir, old_pattern, '0_rawdata', 'Orig', '*.edf'), ...
fullfile(newdir, new_pattern, '0_rawdata', 'Orig'), 'f'); fullfile(newdir, new_pattern, '0_rawdata', 'Orig'), 'f');
...@@ -53,10 +53,10 @@ disp('Copying the info file...'); ...@@ -53,10 +53,10 @@ disp('Copying the info file...');
copyfile(fullfile(workdir, old_pattern, '0_rawdata', 'Orig', '*.info'), ... copyfile(fullfile(workdir, old_pattern, '0_rawdata', 'Orig', '*.info'), ...
fullfile(newdir, new_pattern, '0_rawdata', 'Orig'), 'f'); fullfile(newdir, new_pattern, '0_rawdata', 'Orig'), 'f');
olddir=pwd; olddir = pwd;
% Set path to tomo_utils.py script % Set path to tomo_utils.py script
global GT_MATLAB_HOME global GT_MATLAB_HOME;
tomoUtilsScript = fullfile( GT_MATLAB_HOME, 'zUtil_Python', 'tomo_utils.py'); tomoUtilsScript = fullfile( GT_MATLAB_HOME, 'zUtil_Python', 'tomo_utils.py');
% Enter old dataset Orig directopy % Enter old dataset Orig directopy
...@@ -68,47 +68,43 @@ is_interlaced = exist([old_pattern '0_0000.edf'], 'file'); ...@@ -68,47 +68,43 @@ is_interlaced = exist([old_pattern '0_0000.edf'], 'file');
disp('Renaming the images...'); disp('Renaming the images...');
filenames = [old_pattern '*.edf']; filenames = [old_pattern '*.edf'];
if (is_interlaced) if (is_interlaced)
image_old=[old_pattern '0_']; image_old = [old_pattern '0_'];
image_new=[new_pattern '0_']; image_new = [new_pattern '0_'];
cmd = [tomoUtilsScript ... cmd = [tomoUtilsScript ...
' -rename ''' filenames ''' ''' image_old ''' ''' image_new '''']; ' -rename ''' filenames ''' ''' image_old ''' ''' image_new ''''];
[s, msg] = gtPythonCommand(cmd); [~, msg] = gtPythonCommand(cmd); disp(msg);
disp(msg); image_old = [old_pattern '1_'];
image_old=[old_pattern '1_']; image_new = [new_pattern '1_'];
image_new=[new_pattern '1_'];
cmd = [tomoUtilsScript ... cmd = [tomoUtilsScript ...
' -rename ''' filenames ''' ''' image_old ''' ''' image_new '''']; ' -rename ''' filenames ''' ''' image_old ''' ''' image_new ''''];
[s, msg] = gtPythonCommand(cmd); [~, msg] = gtPythonCommand(cmd); disp(msg);
disp(msg);
else else
cmd=[tomoUtilsScript ... cmd = [tomoUtilsScript ...
' -rename ''' filenames ''' ''' old_pattern ''' ''' new_pattern '''']; ' -rename ''' filenames ''' ''' old_pattern ''' ''' new_pattern ''''];
[s, msg] = gtPythonCommand(cmd); [~, msg] = gtPythonCommand(cmd); disp(msg);
disp(msg);
end end
cd(olddir); cd(olddir);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% copying xml file % Copying xml file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('Copying the xml file...') disp('Copying the xml file...');
%xmlold = fullfile(workdir, old_pattern, '0_rawdata', old_pattern, [old_pattern '.xml']); %xmlold = fullfile(workdir, old_pattern, '0_rawdata', old_pattern, [old_pattern '.xml']);
xmlold = fullfile(workdir, old_pattern, '0_rawdata', 'Orig', [old_pattern '.xml']); xmlold = fullfile(workdir, old_pattern, '0_rawdata', 'Orig', [old_pattern '.xml']);
xmlnew = fullfile(newdir, new_pattern, '0_rawdata', 'Orig', [new_pattern '.xml']); xmlnew = fullfile(newdir, new_pattern, '0_rawdata', 'Orig', [new_pattern '.xml']);
copyfile(xmlold,xmlnew,'f'); copyfile(xmlold, xmlnew, 'f');
% changing fields in xml file disp('Renaming scan name field in the xml file...');
% disp('Renaming fields in the xml file...')
cmd = ['sed -i -e "s/' old_pattern '/' new_pattern '/g " ' xmlnew]; cmd = ['sed -i -e "s/' old_pattern '/' new_pattern '/g " ' xmlnew];
[s,msg] = unix(cmd); disp(msg) [~, msg] = unix(cmd); disp(msg);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Header information % Header information
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% copy *.xml file to *dct_.xml adding some information from headers of % Copy *.xml file to *dct_.xml adding some information from headers of
% ref0000_0000.edf and darkend0000.xml images % ref0000_0000.edf and darkend0000.edf images
wd = pwd; wd = pwd;
cd(fullfile(newdir, new_pattern, '0_rawdata', 'Orig')); cd(fullfile(newdir, new_pattern, '0_rawdata', 'Orig'));
...@@ -118,9 +114,7 @@ gtUpdateXmlFile(); ...@@ -118,9 +114,7 @@ gtUpdateXmlFile();
cd(wd); cd(wd);
% copy DB tables and values % copy DB tables and values
gtDBCopyAllTables(old_pattern,new_pattern); gtDBCopyAllTables(old_pattern, new_pattern);
gtDBCreateSpotPairTable(new_pattern,1); gtDBCreateSpotPairTable(new_pattern, 1);
end
end % end of function
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment