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

enable optional passing of grain structure instead of grain_id (save time...)

parent 7cb01ef0
No related branches found
No related tags found
No related merge requests found
......@@ -19,16 +19,26 @@ function varargout = gtReconstructGrainOrientation(grain_id, phase_id, parameter
if (~isempty(conf.ospace_resolution))
rec_opts.ospace_resolution = conf.ospace_resolution;
end
if (~isempty(conf.ospace_lims))
rec_opts.ospace_lims = conf.ospace_lims;
end
if (~isempty(conf.det_ind))
rec_opts.det_ind = conf.det_ind;
end
sample = GtSample.loadFromFile();
is_extended = sample.phases{phase_id}.getUseExtended(grain_id);
fprintf('Loading the grain file..')
c = tic();
gr = gtLoadGrain(phase_id, grain_id, 'is_extended', is_extended);
if ~isstruct(grain_id)
fprintf('Loading the grain file..')
c = tic();
is_extended = sample.phases{phase_id}.getUseExtended(grain_id);
gr = gtLoadGrain(phase_id, grain_id, 'is_extended', is_extended);
fprintf('\b\b: Done in %g seconds.\n', toc(c))
else
gr = grain_id;
grain_id = gr.id;
is_extended = sample.phases{phase_id}.getUseExtended(grain_id);
end
% Dealing with legacy grain strctures.. should we keep this??
if (~isfield(gr.proj, 'bl'))
......@@ -42,13 +52,12 @@ function varargout = gtReconstructGrainOrientation(grain_id, phase_id, parameter
gr.proj.included = gr_extra.included;
gr.proj.selected = gr_extra.selected;
end
fprintf('\b\b: Done in %g seconds.\n', toc(c))
if (is_extended)
bb_ors = gr.bb_ors;
ospace_bb = cat(1, bb_ors(:).R_vector);
elseif (~isempty(conf.ospace_lims))
diff_r_vecs = tand(conf.ospace_lims / 2);
elseif (~isempty(rec_opts.ospace_lims))
diff_r_vecs = tand(rec_opts.ospace_lims / 2);
ospace_bb = [gr.R_vector + diff_r_vecs(1:3); gr.R_vector + diff_r_vecs(4:6)];
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