Commit a992f268 authored by Wolfgang Ludwig's avatar Wolfgang Ludwig
Browse files

Added support for gtLoadImage in gtGetSummedDifSpot


Signed-off-by: Wolfgang Ludwig's avatarWolfgang Ludwig <wolfgang.ludwig@esrf.fr>
parent 5fad6810
......@@ -14,6 +14,8 @@ function [spot, bb] = gtGetSummedDifSpot(difspotID, parameters, connected, det_i
%
% 360degree scan convention - ak 10/2007
% speed up by providing edfheader info
% Can read from .h5 files produced by pydct (assumed to reside in 2_difblob/000000/difblob_%06d.h5)
if (~exist('parameters','var') || isempty(parameters))
parameters = gtLoadParameters();
......@@ -35,24 +37,51 @@ function [spot, bb] = gtGetSummedDifSpot(difspotID, parameters, connected, det_i
end
bb = [];
base_dir = fullfile(parameters.acq(det_index).dir, '2_difspot');
sub_dir = fullfile(base_dir, sprintf('%05d', difspotID - mod(difspotID, 1e4)));
filename = fullfile(sub_dir, sprintf('difspot%05d.edf', difspotID) );
if (parameters.seg.writeedfs)
base_dir = fullfile(parameters.acq(det_index).dir, '2_difspot');
sub_dir = fullfile(base_dir, sprintf('%05d', difspotID - mod(difspotID, 1e4)));
img_name_pattern = 'difspot%05d.edf';
filename = fullfile(sub_dir, sprintf(img_name_pattern, difspotID));
else
base_dir = fullfile(parameters.acq(det_index).dir, '2_difblob');
sub_dir = fullfile(base_dir, sprintf('%06d', difspotID - mod(difspotID, 1e4)));
img_name_pattern = 'difblob_%06d.h5';
filename = fullfile(sub_dir, sprintf(img_name_pattern, difspotID));
end
dataset_name = parameters.acq(det_index).name;
if exist(filename, 'file')
% read the edf file
spot = edf_read(filename, [], [], info);
if (nargout == 2)
query = sprintf([ ...
'SELECT BoundingBoxXOrigin, BoundingBoxYOrigin, ' ...
' BoundingBoxXSize, BoundingBoxYSize' ...
' FROM %sdifspot' ...
' WHERE difspotID = %d'], dataset_name, difspotID);
[bb(1), bb(2), bb(3), bb(4)] = mym(query);
[spot, info] = gtLoadImage(sub_dir, 'index', difspotID, ...
'img_name_pattern', 'difspot%05d', 'data_field', 'Projection', ...
'info_field', {'BoundingBoxXOrigin', 'BoundingBoxYOrigin', 'BoundingBoxXSize', 'BoundingBoxYSize'});
try
bb = [ ...
info.BoundingBoxXOrigin, info.BoundingBoxYOrigin, ...
info.BoundingBoxXSize, info.BoundingBoxYSize ...
];
catch
query = sprintf([ ...
'SELECT BoundingBoxXOrigin, BoundingBoxYOrigin, ' ...
' BoundingBoxXSize, BoundingBoxYSize' ...
' FROM %sdifspot' ...
' WHERE difspotID = %d'], dataset_name, difspotID);
[bb(1), bb(2), bb(3), bb(4)] = mym(query);
end
else
spot = gtLoadImage(sub_dir, 'index', difspotID, 'img_name_pattern', img_name_pattern);
end
% % read the edf file
% spot = edf_read(filename, [], [], info);
% if (nargout == 2)
% query = sprintf([ ...
% 'SELECT BoundingBoxXOrigin, BoundingBoxYOrigin, ' ...
% ' BoundingBoxXSize, BoundingBoxYSize' ...
% ' FROM %sdifspot' ...
% ' WHERE difspotID = %d'], dataset_name, difspotID);
% [bb(1), bb(2), bb(3), bb(4)] = mym(query);
% end
else
try
[vol, bb] = gtDBBrowseDiffractionVolume(dataset_name, difspotID);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment