Skip to content
Snippets Groups Projects
Commit 4eac6426 authored by Wolfgang Ludwig's avatar Wolfgang Ludwig
Browse files

fixing grain Thresholing on OAR; couple of small fixes

parent 4d0791d8
No related branches found
No related tags found
No related merge requests found
......@@ -370,8 +370,8 @@ function cryst = sfUpdateReflections(cryst, energy)
cryst.thetasp = asind(0.5*lambda./cryst.dspacingsp);
% Update the intensity info: MISSING !
cryst.int = ones(1, numel(cryst.dspacing);
cryst.intsp = ones(1, numel(cryst.dspacingsp);
cryst.usedfam = true(1, numel(cryst.dspacing);
cryst.int = ones(1, numel(cryst.dspacing));
cryst.intsp = ones(1, numel(cryst.dspacingsp));
cryst.usedfam = true(1, numel(cryst.dspacing));
end
......@@ -25,6 +25,7 @@ try
name_next = fullfile(raw_data_dir, sprintf('%s%04d.edf', acq.name, indx_next) );
if exist(name_next,'file')
sprintf('Using images AFTER scan for determination of rotation axis posistion\n')
% FIRST CHOICE: IMAGES AFTER SCAN
indx_curr = 2*acq.nproj;
......@@ -32,6 +33,7 @@ try
name_ref0 = fullfile(raw_data_dir, sprintf('ref0000_%04d.edf', indx_curr) );
name_ref1 = name_ref0;
else
sprintf('Using images DURING scan for determination of rotation axis posistion\n')
% SECOND CHOICE: IMAGES DURING SCAN
% WL May 2009
% changed to use per default the images at end of scan - should be more accurate;
......
......@@ -31,6 +31,10 @@ function varargout = gtAstraReconstructGrain(grainID, phaseID, parameters)
gr_extra = gtLoadGrain(phaseID, grainID, 'fields', {'selected'});
gr.proj.selected = gr_extra.selected;
end
if isempty(find(gr.proj.selected))
warning('No projection has been selected - skipping grain')
return
end
gr.proj.num_iter = rec_opts.num_iter;
gr.proj.stack = gr.proj.stack(:, gr.proj.selected, :);
......
function [varargout] = gtChangeThreshold3D(firstID, lastID, ~, phaseID, parameters, varargin)
function [varargout] = gtChangeThreshold3D(firstID, lastID, ~, phaseID, ~, varargin)
% GTCHANGETHRESHOLD3D
% seg = gtChangeThreshold3D(firstID, lastID, ~, phaseID, varargin)
% ----------------------------------------------------------------
......@@ -11,6 +11,9 @@ function [varargout] = gtChangeThreshold3D(firstID, lastID, ~, phaseID, paramete
% varargin = to modify parameters.rec
%
args = struct('list', [], 'verbose', false);
args = parse_pv_pairs(args, varargin);
if (isdeployed)
global GT_DB
global GT_MATLAB_HOME
......@@ -23,14 +26,20 @@ function [varargout] = gtChangeThreshold3D(firstID, lastID, ~, phaseID, paramete
warning('OAR:unexpected_behavior', ...
'We should expect only strings from shell environment')
end
args.list = str2num(args.list); %#ok<ST2NM>
end
% This handles OAR's habbit of passing lists of IDs in a field called
% 'list'
args.grain_ids = args.list;
args = rmfield(args, 'list');
args = [varargin, 'verbose', false];
args = [fieldnames(args), struct2cell(args)]';
thresh = GtThreshold(args{:});
if (nargin >= 1)
if (nargout >= 1)
varargout{1} = thresh.batchThreshold(phaseID, firstID, lastID);
else
thresh.batchThreshold(phaseID, firstID, lastID)
thresh.batchThreshold(phaseID, firstID, lastID);
end
end
......@@ -96,8 +96,12 @@ function gtReconstructGrains(first, last, workingdirectory, phaseID, parameters,
gtReconstructGrainOrientation(gr_id, phaseID, parameters);
end
if (~isdeployed)
t.singleGrainAutoThreshold(phaseID, gr_id);
fprintf(repmat('\b', [1 num_chars]))
try
t.singleGrainAutoThreshold(phaseID, gr_id);
fprintf(repmat('\b', [1 num_chars]))
catch
sprintf('Segmentation of grain %d failed - check reconstruction!', gr_id)
end
end
end
fprintf('Done (in %f seconds).\n', toc(c))
......
......@@ -177,18 +177,7 @@ if (~isempty(conf.grain_ids))
launch_on_OAR('gtChangeThreshold3D', first, last, ...
phaseID_str, parameters, 'core', 4, 'distribute', true, 'list', conf.grain_ids);
else
if isempty(conf.grain_ids)
gtChangeThreshold3D(first, last, [], phase_id);
else
t=GtThreshold();
for i = 1 : numel(conf.grain_ids)
if sample.phases{phase_id}.getSelected(conf.grain_ids(i))
t.singleGrainAutoThreshold(phase_id, conf.grain_ids(i));
else
sprintf('skipping deselected grain %d\n',conf.grain_ids(i))
end
end
end
gtChangeThreshold3D(first, last, [], phase_id, [], 'list', conf.grain_ids);
end
end
end
......
......@@ -98,8 +98,9 @@ app.linecolor = app.linecolor(1:numel(grains));
parameters = [];
load('parameters.mat');
labgeo = parameters.labgeo;
detgeo = parameters.detgeo;
if isempty(app.pxsize{1})
app.pxsize{1} = (labgeo.pixelsizeu + labgeo.pixelsizev)/2;
app.pxsize{1} = (detgeo.pixelsizeu + detgeo.pixelsizev)/2;
end
if isempty(app.hf)
......
function [match, dev, dcm, drotm, conflicts, toBeChecked] = gtINDEXMatchGrains(...
function [match, dev, dcm, drotm, conflicts, toBeChecked, tol] = gtINDEXMatchGrains(...
grain1, grain2, ph1, dc, drot, tol)
% GTINDEXMATCHGRAINS Matches multiple indexed grains between two datasets;
% can also be used to find unmerged grains.
......@@ -178,7 +178,7 @@ disp('Loading pixelsize and crystallographic info from parameters.mat ...')
parameters = [];
load parameters
cryst = parameters.cryst(ph1);
pixsize = 0.5*(parameters.labgeo.pixelsizeu + parameters.labgeo.pixelsizev);
pixsize = 0.5*(parameters.detgeo.pixelsizeu + parameters.detgeo.pixelsizev);
match = NaN(nof_grains1,2);
......@@ -224,6 +224,10 @@ dev.rot = NaN(3,3,nof_grains1);
% Extension to Rodrigues fundamental zone
% Rext = 0;
Rext = tol.Rdist;
spacegroup = cryst.spacegroup;
fzone_acc = gtCrystRodriguesFundZone(spacegroup,0);
fzone_ext = gtCrystRodriguesFundZone(spacegroup,Rext);
if (any(gtIndexAllGrainValues(grain1,'R_onedge',[],1,[])) || ~isempty(drot))
......
......@@ -17,6 +17,7 @@ except ImportError as exc:
from yaml import YamlLoader
try:
raise ImportError('requests has been disabled')
import requests
from requests.exceptions import ConnectionError, HTTPError
from urllib2 import URLError
......
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