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

GtPhase: added method to get neighbors of a grain.


Signed-off-by: default avatarNicola Vigano <nicola.vigano@esrf.fr>

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@569 4c865b51-4357-4376-afb4-474e03ccb993
parent 55414d46
No related branches found
No related tags found
No related merge requests found
......@@ -436,6 +436,22 @@ classdef GtPhase < handle
& obj.bboxExtremes(:,6) >= point(3) ...
);
end
function IDs = getNeighbours(obj, grainID)
numGrains = length(obj.grains);
replOnes = ones(numGrains, 1);
halfLengths = obj.boundingBox(:, 4:6) / 2;
grainHalfLengths = halfLengths(grainID, :);
maxDistances = halfLengths + grainHalfLengths(replOnes, :);
centersInPixels = obj.boundingBox(:, 1:3) + halfLengths;
grainCenter = centersInPixels(grainID, :);
relativeCenters = abs(centersInPixels - grainCenter(replOnes, :));
IDs = setdiff(find(all(relativeCenters < maxDistances, 2)), grainID);
end
function idspot = buildIdSpot(obj, grainid)
difspotID = obj.summary{grainid}.difspotID'; % row vector
......
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