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)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% directories
% Directories
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('Creating the directories...')
if exist(fullfile(newdir, new_pattern),'dir')
disp('Creating the new dataset directories...');
if exist(fullfile(newdir, new_pattern), 'dir')
gtError('gtCopyDataForTest:wrong_directory', ...
'New directory already exists. Please check the directory name.');
elseif ~exist(newdir, 'dir')
......@@ -41,11 +41,11 @@ end
[~, msg] = mkdir(fullfile(newdir, new_pattern, '0_rawdata', 'Orig')); disp(msg);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% images
% Images
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% copying data
disp('Copying the images...')
% Copying data
disp('Copying and the images to the new directory...');
copyfile(fullfile(workdir, old_pattern, '0_rawdata', 'Orig', '*.edf'), ...
fullfile(newdir, new_pattern, '0_rawdata', 'Orig'), 'f');
......@@ -53,10 +53,10 @@ disp('Copying the info file...');
copyfile(fullfile(workdir, old_pattern, '0_rawdata', 'Orig', '*.info'), ...
fullfile(newdir, new_pattern, '0_rawdata', 'Orig'), 'f');
olddir=pwd;
olddir = pwd;
% 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');
% Enter old dataset Orig directopy
......@@ -68,47 +68,43 @@ is_interlaced = exist([old_pattern '0_0000.edf'], 'file');
disp('Renaming the images...');
filenames = [old_pattern '*.edf'];
if (is_interlaced)
image_old=[old_pattern '0_'];
image_new=[new_pattern '0_'];
image_old = [old_pattern '0_'];
image_new = [new_pattern '0_'];
cmd = [tomoUtilsScript ...
' -rename ''' filenames ''' ''' image_old ''' ''' image_new ''''];
[s, msg] = gtPythonCommand(cmd);
disp(msg);
image_old=[old_pattern '1_'];
image_new=[new_pattern '1_'];
[~, msg] = gtPythonCommand(cmd); disp(msg);
image_old = [old_pattern '1_'];
image_new = [new_pattern '1_'];
cmd = [tomoUtilsScript ...
' -rename ''' filenames ''' ''' image_old ''' ''' image_new ''''];
[s, msg] = gtPythonCommand(cmd);
disp(msg);
[~, msg] = gtPythonCommand(cmd); disp(msg);
else
cmd=[tomoUtilsScript ...
cmd = [tomoUtilsScript ...
' -rename ''' filenames ''' ''' old_pattern ''' ''' new_pattern ''''];
[s, msg] = gtPythonCommand(cmd);
disp(msg);
[~, msg] = gtPythonCommand(cmd); disp(msg);
end
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', 'Orig', [old_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 fields in the xml file...')
disp('Renaming scan name field in the xml file...');
cmd = ['sed -i -e "s/' old_pattern '/' new_pattern '/g " ' xmlnew];
[s,msg] = unix(cmd); disp(msg)
[~, msg] = unix(cmd); disp(msg);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Header information
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% copy *.xml file to *dct_.xml adding some information from headers of
% ref0000_0000.edf and darkend0000.xml images
% Copy *.xml file to *dct_.xml adding some information from headers of
% ref0000_0000.edf and darkend0000.edf images
wd = pwd;
cd(fullfile(newdir, new_pattern, '0_rawdata', 'Orig'));
......@@ -118,9 +114,7 @@ gtUpdateXmlFile();
cd(wd);
% copy DB tables and values
gtDBCopyAllTables(old_pattern,new_pattern);
gtDBCreateSpotPairTable(new_pattern,1);
end
gtDBCopyAllTables(old_pattern, new_pattern);
gtDBCreateSpotPairTable(new_pattern, 1);
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