diff --git a/zUtil_Deformation/GtGrainODFwSolver.m b/zUtil_Deformation/GtGrainODFwSolver.m index bedb9f8e617c8d8e99bde4a0bd7e5dd2547c4778..c70710b7b7405c4b260787eb5d9e80a6ac761af9 100644 --- a/zUtil_Deformation/GtGrainODFwSolver.m +++ b/zUtil_Deformation/GtGrainODFwSolver.m @@ -54,7 +54,7 @@ classdef GtGrainODFwSolver < handle end 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); self.build_sinogram(bls, 1.2); @@ -129,7 +129,7 @@ classdef GtGrainODFwSolver < handle self.sino = zeros(num_ws, num_blobs); 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 ints_interval = self.pre_paddings(ii_b):(self.pre_paddings(ii_b) + blob_dephs(ii_b) -1); @@ -205,14 +205,14 @@ classdef GtGrainODFwSolver < handle indx_maxs = find(ok_maxs); b_ws = [b_ws; ... - min_ws(indx_mins) - bls_bbws(indx_mins, 1) + self.pre_paddings(indx_mins); ... - max_ws(indx_maxs) - bls_bbws(indx_maxs, 1) + self.pre_paddings(indx_maxs)]; + min_ws(indx_mins) - min_conds(indx_mins) + 1; ... + max_ws(indx_maxs) - min_conds(indx_maxs) + 1]; %#ok<AGROW> 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; ... - indx_mins; indx_maxs]; + indx_mins; indx_maxs]; %#ok<AGROW> 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 sino_indx = sub2ind(self.size_sino, b_ws, b_is); diff --git a/zUtil_Deformation/gtDefComputeGrainODFNearField.m b/zUtil_Deformation/gtDefComputeGrainODFNearField.m index fb6d417382398afee6fdbefae3989ccfaf5a8663..ac0e4b225f44a6036c74beeb5e9fb4e2fb9c5279 100644 --- a/zUtil_Deformation/gtDefComputeGrainODFNearField.m +++ b/zUtil_Deformation/gtDefComputeGrainODFNearField.m @@ -14,8 +14,7 @@ function [odfw, odfw_R_vectors] = gtDefComputeGrainODFNearField(phase_id, grain_ phase_dir = fullfile(parameters.acq.dir, '4_grains', ... sprintf('phase_%02d', phase_id)); - grain_file = fullfile(phase_dir, sprintf('grain_%04d.mat', grain_id)); - gr = load(grain_file); + gr = gtLoadGrain(phase_id, grain_id); odfw = sol.solve_experimental(gr); @@ -44,7 +43,7 @@ function [odfw, odfw_R_vectors] = gtDefComputeGrainODFNearField(phase_id, grain_ % it to be in GVDM format. odfw_orientations = sol.get_orientations(); 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 = odfw_coeffs(:, [1 1 1]); diff --git a/zUtil_Deformation/gtDefComputeIntraGranularMisorientation.m b/zUtil_Deformation/gtDefComputeIntraGranularMisorientation.m index a28d0a969e4875ef8e5291e0c43d9f19120e513d..e6061d712b71c0af574a31a9180346eb60e29e4f 100644 --- a/zUtil_Deformation/gtDefComputeIntraGranularMisorientation.m +++ b/zUtil_Deformation/gtDefComputeIntraGranularMisorientation.m @@ -18,6 +18,7 @@ function [igm, gos] = gtDefComputeIntraGranularMisorientation(dmvol, intvol, var igm = abs(gvdm - avg_R_vec(:, ones(tot_voxels, 1))); igm = sqrt(sum(igm .^ 2, 1)); + igm(intvol == 0) = 0; % so we get all the orientation differences (Intra-Granular Misorientation) igm = 2 * atand(igm); % Grain Orientation Spread diff --git a/zUtil_Deformation/gtGetODFFromGvdm.m b/zUtil_Deformation/gtGetODFFromGvdm.m index 9038da0da859538095dcde34ddb604bf78535d14..6b78a0585c522052176747be7b2f62ca8ba38d74 100644 --- a/zUtil_Deformation/gtGetODFFromGvdm.m +++ b/zUtil_Deformation/gtGetODFFromGvdm.m @@ -1,5 +1,5 @@ -function odf = gtGetODFFromGvdm(gvdm, grid_points) -% FUNCTION odf = gtGetODFFromGvdm(gvdm, grid_points) +function odf = gtGetODFFromGvdm(gvdm, grid_points, gvint) +% FUNCTION odf = gtGetODFFromGvdm(gvdm, grid_points, gvint) % % ddm is a <n_voxels x 3> vector, where each row is the Rodriguez vector of % each voxel @@ -10,6 +10,11 @@ function odf = gtGetODFFromGvdm(gvdm, grid_points) if (size(gvdm, 1) == 3) gvdm = gvdm'; 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; @@ -24,14 +29,17 @@ function odf = gtGetODFFromGvdm(gvdm, grid_points) c = tic(); for l = 1:size_odf(3) 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) - included2 = (y_edges(n) <= included3(:, 2)) & (included3(:, 2) <= y_edges(n+1)); - included2 = included3(included2, :); + included2 = (y_edges(n) <= gvdm_inc3(:, 2)) & (gvdm_inc3(:, 2) <= y_edges(n+1)); + gvdm_inc2 = gvdm_inc3(included2, :); + gvint_inc2 = gvint_inc3(included2); 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