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

GtPhase: added oversize feature to nighbours finding, and cleaned laura's code a little bit.


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

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@657 4c865b51-4357-4376-afb4-474e03ccb993
parent adfb6f5c
No related branches found
No related tags found
No related merge requests found
......@@ -437,7 +437,10 @@ classdef GtPhase < handle
);
end
function IDs = getNeighbours(obj, grainID)
function IDs = getNeighbours(obj, grainID, oversize)
if (~exist('oversize', 'var'))
oversize = 1;
end
numGrains = length(obj.grains);
replOnes = ones(numGrains, 1);
......@@ -450,7 +453,7 @@ classdef GtPhase < handle
grainCenter = centersInPixels(grainID, :);
relativeCenters = abs(centersInPixels - grainCenter(replOnes, :));
IDs = setdiff(find(all(relativeCenters < maxDistances, 2)), grainID);
IDs = setdiff(find(all(relativeCenters < (maxDistances * oversize), 2)), grainID);
end
function idspot = buildIdSpot(obj, grainid)
......@@ -482,22 +485,22 @@ classdef GtPhase < handle
merge_value2 = false;
% centers
c1=obj.center(id1,:)/pixelsize;
c2=obj.center(id2,:)/pixelsize;
c1 = obj.center(id1,:) / pixelsize;
c2 = obj.center(id2,:) / pixelsize;
dist = norm(c1-c2);
b1=obj.boundingBox(id1, :);
b2=obj.boundingBox(id2, :);
b1 = obj.boundingBox(id1, :);
b2 = obj.boundingBox(id2, :);
% mean of two volumes : get radius equivalent and get 10% of it
% as threshold
thr_dist = mean(prod(b2(4:6)),prod(b1(4:6)))^(1/3)/100*10;
thr_dist = mean(prod(b2(4:6)), prod(b1(4:6))) ^ (1/3) / 10;
%thr_dist = 0.10 * (0.6/2)/pixelsize; % 10% of radius of sample
if dist < thr_dist
merge_value1 = true;
end
% R_vector
r1=obj.R_vector(id1,:);
r2=obj.R_vector(id2,:);
r1 = obj.R_vector(id1,:);
r2 = obj.R_vector(id2,:);
%fprintf('R_vector1: %5.4f %5.4f %5.4f\nR_vector2: %5.4f %5.4f %5.4f\n',r1,r2)
angle = atan2(norm(cross(r1,r2)), dot(r1,r2));
angle = rad2deg(angle);
......@@ -523,10 +526,6 @@ classdef GtPhase < handle
merge.value2 = merge_value2;
merge.value = merge_value1 & merge_value2;
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