Skip to content
Snippets Groups Projects
Commit e3f0b408 authored by Nicola Vigano's avatar Nicola Vigano
Browse files

Deformation: small fixes

parent 4be47a8c
No related branches found
No related tags found
No related merge requests found
...@@ -54,7 +54,7 @@ classdef GtGrainODFwSolver < handle ...@@ -54,7 +54,7 @@ classdef GtGrainODFwSolver < handle
end end
function vol = solve_experimental(self, ref_gr, algorithm, lambda) function vol = solve_experimental(self, ref_gr, algorithm, lambda)
sampler = self.build_orientation_sampling_experimental(ref_gr, 1.1); sampler = self.build_orientation_sampling_experimental(ref_gr, 1.05);
bls = sampler.bl(sampler.selected); bls = sampler.bl(sampler.selected);
self.build_sinogram(bls, 1.2); self.build_sinogram(bls, 1.2);
...@@ -129,7 +129,7 @@ classdef GtGrainODFwSolver < handle ...@@ -129,7 +129,7 @@ classdef GtGrainODFwSolver < handle
self.sino = zeros(num_ws, num_blobs); self.sino = zeros(num_ws, num_blobs);
self.size_sino = size(self.sino); self.size_sino = size(self.sino);
self.pre_paddings = floor((num_ws - blob_dephs) / 2) + 1; self.pre_paddings = round((num_ws - blob_dephs) / 2) + 1;
for ii_b = 1:num_blobs for ii_b = 1:num_blobs
ints_interval = self.pre_paddings(ii_b):(self.pre_paddings(ii_b) + blob_dephs(ii_b) -1); ints_interval = self.pre_paddings(ii_b):(self.pre_paddings(ii_b) + blob_dephs(ii_b) -1);
...@@ -205,14 +205,14 @@ classdef GtGrainODFwSolver < handle ...@@ -205,14 +205,14 @@ classdef GtGrainODFwSolver < handle
indx_maxs = find(ok_maxs); indx_maxs = find(ok_maxs);
b_ws = [b_ws; ... b_ws = [b_ws; ...
min_ws(indx_mins) - bls_bbws(indx_mins, 1) + self.pre_paddings(indx_mins); ... min_ws(indx_mins) - min_conds(indx_mins) + 1; ...
max_ws(indx_maxs) - bls_bbws(indx_maxs, 1) + self.pre_paddings(indx_maxs)]; max_ws(indx_maxs) - min_conds(indx_maxs) + 1]; %#ok<AGROW>
b_cs = [b_cs; ... b_cs = [b_cs; ...
min_cs(indx_mins); max_cs(indx_maxs)]; min_cs(indx_mins); max_cs(indx_maxs)]; %#ok<AGROW>
b_is = [b_is; ... b_is = [b_is; ...
indx_mins; indx_maxs]; indx_mins; indx_maxs]; %#ok<AGROW>
b_os = [b_os; ... b_os = [b_os; ...
ii_o(ones(numel(indx_mins) + numel(indx_maxs), 1), 1)]; ii_o(ones(numel(indx_mins) + numel(indx_maxs), 1), 1)]; %#ok<AGROW>
end end
sino_indx = sub2ind(self.size_sino, b_ws, b_is); sino_indx = sub2ind(self.size_sino, b_ws, b_is);
......
...@@ -14,8 +14,7 @@ function [odfw, odfw_R_vectors] = gtDefComputeGrainODFNearField(phase_id, grain_ ...@@ -14,8 +14,7 @@ function [odfw, odfw_R_vectors] = gtDefComputeGrainODFNearField(phase_id, grain_
phase_dir = fullfile(parameters.acq.dir, '4_grains', ... phase_dir = fullfile(parameters.acq.dir, '4_grains', ...
sprintf('phase_%02d', phase_id)); sprintf('phase_%02d', phase_id));
grain_file = fullfile(phase_dir, sprintf('grain_%04d.mat', grain_id)); gr = gtLoadGrain(phase_id, grain_id);
gr = load(grain_file);
odfw = sol.solve_experimental(gr); odfw = sol.solve_experimental(gr);
...@@ -44,7 +43,7 @@ function [odfw, odfw_R_vectors] = gtDefComputeGrainODFNearField(phase_id, grain_ ...@@ -44,7 +43,7 @@ function [odfw, odfw_R_vectors] = gtDefComputeGrainODFNearField(phase_id, grain_
% it to be in GVDM format. % it to be in GVDM format.
odfw_orientations = sol.get_orientations(); odfw_orientations = sol.get_orientations();
gvdm6D = gtDefDmvol2Gvdm(gr_det.ODF6D.voxels_avg_R_vectors); gvdm6D = gtDefDmvol2Gvdm(gr_det.ODF6D.voxels_avg_R_vectors);
odf6D = gtGetODFFromGvdm(gvdm6D, odfw_orientations); odf6D = gtGetODFFromGvdm(gvdm6D, odfw_orientations, gr_det.ODF6D.intensity);
odfw_coeffs = reshape(odfw, [], 1); odfw_coeffs = reshape(odfw, [], 1);
odfw_coeffs = odfw_coeffs(:, [1 1 1]); odfw_coeffs = odfw_coeffs(:, [1 1 1]);
......
...@@ -18,6 +18,7 @@ function [igm, gos] = gtDefComputeIntraGranularMisorientation(dmvol, intvol, var ...@@ -18,6 +18,7 @@ function [igm, gos] = gtDefComputeIntraGranularMisorientation(dmvol, intvol, var
igm = abs(gvdm - avg_R_vec(:, ones(tot_voxels, 1))); igm = abs(gvdm - avg_R_vec(:, ones(tot_voxels, 1)));
igm = sqrt(sum(igm .^ 2, 1)); igm = sqrt(sum(igm .^ 2, 1));
igm(intvol == 0) = 0;
% so we get all the orientation differences (Intra-Granular Misorientation) % so we get all the orientation differences (Intra-Granular Misorientation)
igm = 2 * atand(igm); igm = 2 * atand(igm);
% Grain Orientation Spread % Grain Orientation Spread
......
function odf = gtGetODFFromGvdm(gvdm, grid_points) function odf = gtGetODFFromGvdm(gvdm, grid_points, gvint)
% FUNCTION odf = gtGetODFFromGvdm(gvdm, grid_points) % FUNCTION odf = gtGetODFFromGvdm(gvdm, grid_points, gvint)
% %
% ddm is a <n_voxels x 3> vector, where each row is the Rodriguez vector of % ddm is a <n_voxels x 3> vector, where each row is the Rodriguez vector of
% each voxel % each voxel
...@@ -10,6 +10,11 @@ function odf = gtGetODFFromGvdm(gvdm, grid_points) ...@@ -10,6 +10,11 @@ function odf = gtGetODFFromGvdm(gvdm, grid_points)
if (size(gvdm, 1) == 3) if (size(gvdm, 1) == 3)
gvdm = gvdm'; gvdm = gvdm';
end end
if (~exist('gvint', 'var'))
gvint = ones(size(gvdm, 1), 1);
else
gvint = reshape(gvint, [], 1);
end
voxel_size = grid_points{2, 2, 2}.R_vector - grid_points{1, 1, 1}.R_vector; voxel_size = grid_points{2, 2, 2}.R_vector - grid_points{1, 1, 1}.R_vector;
...@@ -24,14 +29,17 @@ function odf = gtGetODFFromGvdm(gvdm, grid_points) ...@@ -24,14 +29,17 @@ function odf = gtGetODFFromGvdm(gvdm, grid_points)
c = tic(); c = tic();
for l = 1:size_odf(3) for l = 1:size_odf(3)
included3 = (z_edges(l) <= gvdm(:, 3)) & (gvdm(:, 3) <= z_edges(l+1)); included3 = (z_edges(l) <= gvdm(:, 3)) & (gvdm(:, 3) <= z_edges(l+1));
included3 = gvdm(included3, :); gvdm_inc3 = gvdm(included3, :);
gvint_inc3 = gvint(included3);
for n = 1:size_odf(2) for n = 1:size_odf(2)
included2 = (y_edges(n) <= included3(:, 2)) & (included3(:, 2) <= y_edges(n+1)); included2 = (y_edges(n) <= gvdm_inc3(:, 2)) & (gvdm_inc3(:, 2) <= y_edges(n+1));
included2 = included3(included2, :); gvdm_inc2 = gvdm_inc3(included2, :);
gvint_inc2 = gvint_inc3(included2);
for m = 1:size_odf(1) for m = 1:size_odf(1)
included1 = (x_edges(m) <= included2(:, 1)) & (included2(:, 1) <= x_edges(m+1)); included1 = (x_edges(m) <= gvdm_inc2(:, 1)) & (gvdm_inc2(:, 1) <= x_edges(m+1));
gvint_inc1 = gvint_inc2(included1);
odf(m, n, l) = numel(find(included1)); odf(m, n, l) = sum(gvint_inc1);
end end
end end
end 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