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

gvdm->detector projector: added nearest neighbour proection (plus some other fixes)

parent 8c95274c
No related branches found
No related tags found
No related merge requests found
......@@ -22,10 +22,16 @@ function bl = gtDefFwdProjGvdm(grain, ref_sel, gv, fedpars, parameters, det_ind,
g = gtMathsRod2OriMat(grain.R_vector);
pls_orig = grain.allblobs.plorig(ref_sel, :);
if (strcmpi(fedpars.defmethod, 'rod_rightstretch'))
% We bring the plane normals back to the status of pl_cry
pls_orig = gtVectorLab2Cryst(pls_orig, g);
if (isfield(grain.allblobs, 'plcry'))
pls_orig = grain.allblobs.plcry(ref_sel, :);
else
% We bring the plane normals back to the status of pl_cry
pls_orig = grain.allblobs.plorig(ref_sel, :);
pls_orig = gtVectorLab2Cryst(pls_orig, g);
end
else
pls_orig = grain.allblobs.plorig(ref_sel, :);
end
sinths = grain.allblobs.sintheta(ref_sel);
......@@ -62,6 +68,8 @@ function bl = gtDefFwdProjGvdm(grain, ref_sel, gv, fedpars, parameters, det_ind,
uvw_shifts = round(or_uvw)';
end
linear_interp = ~(isfield(fedpars, 'projector') && strcmpi(projector, 'nearest'));
num_oversampling = size(gv.d, 3);
gvpow = gv.pow(1, uinds);
......@@ -198,18 +206,24 @@ function bl = gtDefFwdProjGvdm(grain, ref_sel, gv, fedpars, parameters, det_ind,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Distribute value over 8 pixels
[ucbl8, ints8] = gtMathsGetInterpolationIndices(uvw_bl, gvpow_v, fedpars.bltype);
if (linear_interp)
[ucbl8, ints8] = gtMathsGetInterpolationIndices(uvw_bl, ...
gvpow_v, fedpars.bltype);
else
ucbl8 = round(uvw_bl);
ints8 = gvpow_v;
end
% Accumulate all intensities in the blob voxel-wise
% 'uvw' needs to be nx3; 'ints' is now 1xnx8
try
tmp_bl(ii_b).intm = accumarray(ucbl8, ints8, blob_uvw_size);
catch mexc
disp(' ')
disp('ERROR')
disp(['The error is probably caused by the projected intensities' ...
' falling outside the blob volume. Try increasing the blob' ...
' volume padding: fedpars.detector(det_ind).blobsizeadd'])
fprintf(['\n\nERROR\nThe error is probably caused by the'
' projected intensities falling outside the blob volume.'
'\nTry increasing the blob volume padding:'
' fedpars.detector(det_ind).blobsizeadd, or FIXING'
' YOUR CODE!!\n\n'])
disp('Blob ID:')
disp(ii_b)
disp('Blob size:')
......
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