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

6D: Added initial function for inspecting the voxel-average ODF of a reconstruction

parent 8ef4805c
No related branches found
No related tags found
No related merge requests found
function gt6DPlotReconstructionODF(phase_id, grain_id)
grain_rec = gtLoadGrainRec(phase_id, grain_id);
if (~isfield(grain_rec, 'SEG'))
grain_rec.SEG = gtLoadGrain(phase_id, grain_id, ...
'fields', {'seg', 'segbb'});
end
internal_shift = grain_rec.SEG.segbb(1:3) - grain_rec.ODF6D.shift + 1;
seg_vol_bb = [internal_shift, grain_rec.SEG.segbb(4:6)];
dm_vol(:, :, :, 3) = gtCrop(grain_rec.ODF6D.voxels_avg_R_vectors(:, :, :, 3), seg_vol_bb);
dm_vol(:, :, :, 2) = gtCrop(grain_rec.ODF6D.voxels_avg_R_vectors(:, :, :, 2), seg_vol_bb);
dm_vol(:, :, :, 1) = gtCrop(grain_rec.ODF6D.voxels_avg_R_vectors(:, :, :, 1), seg_vol_bb);
int_vol = gtCrop(grain_rec.ODF6D.intensity, seg_vol_bb);
gv_dm = gtDefDmvol2Gvdm(dm_vol);
gv_mask = logical(grain_rec.SEG.seg(:));
gv_int = int_vol(:);
p = gtLoadParameters();
resolution = tand(p.labgeo.omstep/2) * 0.2;
grid_points = [ ...
min(grain_rec.ODF6D.R_vectors{1}, [], 1), ...
max(grain_rec.ODF6D.R_vectors{1}, [], 1), ...
resolution([1 1 1])];
grid_points(1:3) = grid_points(1:3) - mod(grid_points(1:3), resolution);
grid_points(4:6) = grid_points(4:6) + mod(resolution - mod(grid_points(4:6), resolution), resolution);
odf = gtGetODFFromGvdm(gv_dm(:, gv_mask), grid_points, gv_int(gv_mask));
f = figure();
ax1 = subplot(1, 3, 1, 'parent', f);
ax2 = subplot(1, 3, 2, 'parent', f);
ax3 = subplot(1, 3, 3, 'parent', f);
imagesc(sum(odf, 3), 'parent', ax1);
imagesc(squeeze(sum(odf, 1)), 'parent', ax2);
imagesc(squeeze(sum(odf, 2)), 'parent', ax3);
title(ax1, 'XY');
title(ax2, 'YZ');
title(ax3, 'XZ');
colormap(ax1, gray);
colormap(ax2, gray);
colormap(ax3, gray);
set(f, 'Units', 'centimeters')
pos = get(f, 'Position');
pos(3) = pos(4) * 3;
set(f, 'position', pos);
end
......@@ -28,9 +28,9 @@ function odf = gtGetODFFromGvdm(gvdm, grid_points, gvint)
else
% We expect a <1x9> vector with <1x6> o-space bb, plus <1x3> the
% resolution
voxel_size = grid_points(7:9)
voxel_size = grid_points(7:9);
size_odf = (grid_points(4:6) - grid_points(1:3)) ./ voxel_size
size_odf = round((grid_points(4:6) - grid_points(1:3)) ./ voxel_size);
z_edges = linspace(grid_points(3) - voxel_size(3) / 2, ...
grid_points(6) + voxel_size(3) / 2, size_odf(3) + 1);
......
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