Skip to content
Snippets Groups Projects
Commit 38061167 authored by Laura Nervo's avatar Laura Nervo
Browse files

gtGetSummedDifSpot : commented header and indenting... Difspots images are...

gtGetSummedDifSpot : commented header and indenting... Difspots images are supposed to be in 2_difspot/*0000 folders.

Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>
parent b81bc290
No related branches found
No related tags found
No related merge requests found
function [spot, bb] = gtGetSummedDifSpot(difID, parameters, connected, info) function [spot, bb] = gtGetSummedDifSpot(difspotID, parameters, connected, info)
% returns the summed difspot image (saved as difspot%05d.edf) or in difblobtable % GTGETSUMMEDDIFSPOT Returns the summed difspot image (saved as *0000/difspot%05d.edf) or in difblobtable
% [spot, bb] = gtGetSummedDifSpot(difspotID, parameters, connected, info)
% -----------------------------------------------------------------------
% INPUT:
% difspotID = <double> diffraction spot ID
% parameters = <struct> parameters.mat
% connected = <logical> true if already connected to the database {false}
% info = <struct> image header info {[]}
%
% OUTPUT:
% spot = <double> diffraction spot image
% bb = <double> diffraction spot bounding box
%
% 360degree scan convention - ak 10/2007 % 360degree scan convention - ak 10/2007
% speed up by providing edfheader info % speed up by providing edfheader info
if ~exist('parameters','var') if ~exist('parameters','var')
disp('loading parameters...'); parameters = [];
load('parameters.mat'); load('parameters.mat');
end end
% connect to database % connect to database
if (~exist('connected', 'var')) if ~exist('connected', 'var')
connected = false; connected = false;
end end
if (~connected) if (~connected)
gtDBConnect() gtDBConnect()
end end
if (~exist('info', 'var')) if (~exist('info', 'var'))
info = []; info = [];
end end
bb = [];
bb = []; base_dir = fullfile(parameters.acq.dir, '2_difspot');
sub_dir = fullfile(base_dir, sprintf('%05d', difspotID - mod(difspotID, 1e4)));
base_dir = fullfile(parameters.acq.dir, '2_difspot'); filename = fullfile(sub_dir, sprintf('difspot%05d.edf', difspotID) );
sub_dir = fullfile(base_dir, sprintf('%05d', difID - mod(difID, 1e4)));
filename = fullfile(sub_dir, sprintf('difspot%05d.edf', difID) ); if exist(filename, 'file')
% read the edf file
if (exist(filename, 'file')) spot = edf_read(filename, [], [], info);
% read the edf file if (nargout == 2)
spot = edf_read(filename, [], [], info); query = sprintf([ ...
if (nargout == 2) 'SELECT BoundingBoxXOrigin, BoundingBoxYOrigin, ' ...
query = sprintf([ ... ' BoundingBoxXSize, BoundingBoxYSize' ...
'SELECT BoundingBoxXOrigin, BoundingBoxYOrigin, ' ... ' FROM %sdifspot' ...
' BoundingBoxXSize, BoundingBoxYSize' ... ' WHERE difspotID = %d'], parameters.acq.name, difspotID);
' FROM %sdifspot' ... [bb(1), bb(2), bb(3), bb(4)] = mym(query);
' WHERE difspotID = %d'], parameters.acq.name, difID); end
[bb(1), bb(2), bb(3), bb(4)] = mym(query); else
end try
else tablename = parameters.acq.name;
try [vol, bb] = gtDBBrowseDiffractionVolume(tablename, difspotID);
tablename = parameters.acq.name; spot = sum(vol, 3);
[vol, bb] = gtDBBrowseDiffractionVolume(tablename, difID); catch Mexc
spot = sum(vol, 3); gtPrintException(Mexc, 'cannot find difspot as edf or as difblob!')
catch Mexc
gtPrintException(Mexc, 'cannot find difspot as edf or as difblob!')
end
end end
end 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