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

Better handle sample shifts correction (activate in p.acq)

parent 94af1a64
No related branches found
No related tags found
No related merge requests found
......@@ -19,17 +19,6 @@ function [shifts_lab, shifts_sam, abspos, relpos] = gtMatchGetSampleShifts(param
filename = sprintf('%s/%s%04d.edf', base_dir, acq_name, conf.offset_pos);
% Let's handle some special case
if (~exist(filename, 'file'))
if (~exist('omega_values', 'var') || isempty(omega_values))
omega_values = 0;
end
shifts_lab = zeros(numel(omega_values), 3);
shifts_sam = zeros(numel(omega_values), 3);
abspos = zeros(numel(omega_values), 3);
relpos = zeros(numel(omega_values), 3);
return
end
info = edf_info(filename);
offset = [info.motor.samtx, info.motor.samty, info.motor.samtz];
......
......@@ -29,6 +29,8 @@ end
check = inputwdefault('Do you want to reset all the parameters for matching? [y/n]', 'n');
if (strcmpi(check, 'y'))
mym(sprintf('truncate %s', parameters.acq.pair_tablename));
%mym(sprintf('truncate %s', parameters.acq.calib_tablename));
parameters.match = gtMatchDefaultParametersGUI();
parameters.match.thetalimits = 0.5 * ...
[parameters.labgeo.detanglemin, parameters.labgeo.detanglemax];
......@@ -85,8 +87,12 @@ handles.matchparnames = parnames;
%%% "update_ref_pos"... leading to sample displacements at reference
%%% positions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
handles.shifts = gtMatchGetSampleShifts(parameters);
if isfield(parameters.acq, 'correct_sample_shifts')
handles.shifts = gtMatchGetSampleShifts(parameters);
else
tot_proj = gtAcqTotNumberOfImages(parameters);
handles.shifts = zeros(tot_proj, 3);
end
% Get parameters description
parlist = build_list_v2();
......
......@@ -503,8 +503,8 @@ classdef GtThreshold < handle
threshold_val = meanvol - par_thr.percentile/100 * stdvol;
%seed = round([size(vol, 1), size(vol, 2), size(vol, 3)] / 2);
seed = vol > maxvol * 0.7;
seed = round([size(vol, 1), size(vol, 2), size(vol, 3)] / 2);
%seed = vol > maxvol * 0.7;
grain_seg = obj.segmentAndDoMorph(grain_rec, threshold_val, ...
par_thr.do_morph_recon, seed);
end
......
This diff is collapsed.
......@@ -11,9 +11,10 @@ function gtDBCreateCalibrationTable_v3(name)
fprintf('Working on %s\n',name);
mym('close')
mym('open','mysql.esrf.fr','gtadmin','gtadmin')
mym('use graintracking')
gtDBConnect;
%mym('close')
%mym('open','mysql.esrf.fr','gtadmin','gtadmin')
%mym('use graintracking')
tablename_calibration=sprintf('%scalibration',name);
......
......@@ -849,18 +849,25 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
labgeo = self.parameters.labgeo;
samgeo = self.parameters.samgeo;
om = zeros(numel(ab_sel), num_ors);
for ii_o = 1:num_ors
om(:, ii_o) = ors_allblobs(ii_o).omega(ab_sel);
end
if isfield(self.parameters.acq, 'correct_sample_shifts')
[~, shifts_sam] = gtMatchGetSampleShifts(self.parameters, om(:));
else
shifts_sam = zeros(numel(om(:)), 3);
end
% Dimensions are: <blobs x uv x edges x orientations>
uv_tab = zeros(num_blobs, 2, 8, num_ors);
for ii_o = 1:num_ors
dveclab_t = ors_allblobs(ii_o).dvec(ab_sel, :)';
om = ors_allblobs(ii_o).omega(ab_sel);
[~, shifts_sam] = gtMatchGetSampleShifts(self.parameters, om);
% It only works if there are no offsets in the tilt axes
rot_l2s = ors_allblobs(ii_o).srot(:, :, ab_sel);
rot_s2l = permute(rot_l2s, [2 1 3]);
gcsam_v = ref_gr.center(ones(1, size(rot_l2s, 3)), :) + shifts_sam;
shifts_sam_ii_o = shifts_sam((ii_o - 1) * numel(ab_sel) +1 : ii_o * numel(ab_sel), :);
gcsam_v = ref_gr.center(ones(1, size(rot_l2s, 3)), :) + shifts_sam_ii_o;
ii_e = 1;
......@@ -1018,27 +1025,33 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
ab_sel = ond(inc(sel));
num_orients = numel(ors_allblobs);
num_ors = numel(ors_allblobs);
om = zeros(numel(ab_sel), num_ors);
geoms = cell(num_orients, 1);
for ii_o = 1:num_orients
for ii_o = 1:num_ors
om(:, ii_o) = ors_allblobs(ii_o).omega(ab_sel);
end
if isfield(self.parameters.acq, 'correct_sample_shifts')
[~, shifts_sam] = gtMatchGetSampleShifts(self.parameters, om(:));
else
shifts_sam = zeros(numel(om(:)), 3);
end
geoms = cell(num_ors, 1);
for ii_o = 1:num_ors
dvec_sam = ors_allblobs(ii_o).dvecsam(ab_sel, :);
rot_w_l2s = ors_allblobs(ii_o).srot(:, :, ab_sel);
% account for sample shifts relative to rotation axis
[~, shifts_sam] = gtMatchGetSampleShifts(self.parameters, ors_allblobs(ii_o).omega(ab_sel));
% Dimensions are: <blobs x uv x [min, max]>
proj_or_lims = projs_uv_lims(:, :, :, ii_o);
bb_bls_uv = [proj_or_lims(:, :, 1), proj_or_lims(:, :, 2) - proj_or_lims(:, :, 1) + 1];
shifts_sam_ii_o = shifts_sam((ii_o - 1) * numel(ab_sel) +1 : ii_o * numel(ab_sel), :);
proj_geom = gtGeoProjForReconstruction(...
dvec_sam, rot_w_l2s, ref_gr.center, bb_bls_uv, [], ...
self.parameters.detgeo(det_ind), ...
self.parameters.labgeo, ...
self.parameters.samgeo, ...
self.parameters.recgeo(self.det_index(1)), ...
'ASTRA_grain', shifts_sam);
'ASTRA_grain', shifts_sam_ii_o);
if (self.volume_downscaling > 1)
proj_geom(:, 4:12) = proj_geom(:, 4:12) / self.volume_downscaling;
......@@ -1151,7 +1164,11 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
self.parameters.labgeo, self.parameters.samgeo, true);
% accounting for sample shifts relative to rotation axis
[~, shifts_sam] = gtMatchGetSampleShifts(self.parameters, ors_allblobs(ii_o).omega(ab_sel(ind_of_blob)));
if isfield(self.parameters.acq, 'correct_sample_shifts')
[~, shifts_sam] = gtMatchGetSampleShifts(self.parameters, ors_allblobs(ii_o).omega(ab_sel(ind_of_blob)));
else
shifts_sam = zeros(numel(ors_allblobs(ii_o).omega(ab_sel(ind_of_blob))), 3);
end
% Dimensions are: <blobs x uv x [min, max]>
proj_or_lims = projs_uv_lims(:, :, :, ii_o);
......@@ -1262,7 +1279,11 @@ classdef Gt6DReconstructionAlgorithmFactory < handle
self.parameters.labgeo, self.parameters.samgeo, true);
% accounting for sample shifts relative to rotation axis
[~, shifts_sam] = gtMatchGetSampleShifts(self.parameters, ors_allblobs(ii_o).omega(ab_sel(ind_of_blob)));
if isfield(self.parameters.acq, 'correct_sample_shifts')
[~, shifts_sam] = gtMatchGetSampleShifts(self.parameters, ors_allblobs(ii_o).omega(ab_sel(ind_of_blob)));
else
shifts_sam = zeros(numel(ors_allblobs(ii_o).omega(ab_sel(ind_of_blob))), 3);
end
% Dimensions are: <blobs x uv x [min, max]>
proj_or_lims = projs_uv_lims(:, :, :, ii_o);
......
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