Skip to content
Snippets Groups Projects
Commit 3dbfb3b9 authored by Laura Nervo's avatar Laura Nervo Committed by Nicola Vigano
Browse files

gtUpdateXmlFile : fix bug - check on fields of image headers


Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@492 4c865b51-4357-4376-afb4-474e03ccb993
parent 456169a5
No related branches found
No related tags found
No related merge requests found
...@@ -29,18 +29,27 @@ if exist(xml_file,'file') ...@@ -29,18 +29,27 @@ if exist(xml_file,'file')
if exist(dark_file,'file') if exist(dark_file,'file')
info_dark = edf_info(dark_file); info_dark = edf_info(dark_file);
xml.acquisition.byteorder = info_dark.byteorder; if all(isfield(info_dark,{'byteorder','suffix'}))
xml.acquisition.collection_dir_old = info_dark.dir; xml.acquisition.byteorder = info_dark.byteorder;
xml.acquisition.imageSuffix = info_dark.suffix; xml.acquisition.imageSuffix = info_dark.suffix;
else % if don't exist, define them by default
xml.acquisition.byteorder = 'l';
xml.acquisition.imageSuffix = '.edf';
msg = strcat(msg,'Setting byteorder and imageSuffix by default.\n');
end
else else
msg = strcat(msg,'Image darkend0000.edf not found.\n'); msg = strcat(msg,'Image darkend0000.edf not found.\n');
xml.acquisition.collection_dir_old = fullfile(xml.acquisition.disk,xml.acquisition.scanName);
end end
xml.acquisition.collection_dir_old = fullfile(xml.acquisition.disk,xml.acquisition.scanName);
if exist(ref_file,'file') if exist(ref_file,'file')
info_ref = edf_info(ref_file); info_ref = edf_info(ref_file);
xml.acquisition.energy = info_ref.energy; if all(isfield(info_ref,{'energy','optic_used'}))
xml.acquisition.opticsUsed = info_ref.optic_used; xml.acquisition.energy = info_ref.energy;
xml.acquisition.opticsUsed = info_ref.optic_used;
else
msg = strcat(msg,'Energy and optic_used information have not been found in the header.\n');
end
else else
msg = strcat(msg,'Image ref0000_0000.edf not found.\n'); msg = strcat(msg,'Image ref0000_0000.edf not found.\n');
end end
...@@ -51,14 +60,14 @@ if exist(xml_file,'file') ...@@ -51,14 +60,14 @@ if exist(xml_file,'file')
disp(['Saved updated .xml file in ' fullfile(pwd(),newname)]) disp(['Saved updated .xml file in ' fullfile(pwd(),newname)])
if nargout > 0 if nargout > 0
xml_name = newname; xml_name = newname;
disp(msg)
end end
disp(msg)
else else
disp('File .xml not found') msg = 'File .xml not found';
if nargout > 0 if nargout > 0
xml_name = []; xml_name = [];
disp(msg)
end end
disp(msg)
return; return;
end end
......
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