Workflow Overview
graph TB
node1(Load Images of Segmented Grain Boundaries )
click node1 "#1"
node1(Load Images of Segmented Grain Boundaries ) --> node2(Subsample into 4 Regions)
click node2 "#2"
node2(Subsample into 4 Regions) --> node3(Chord Length Distribution - CLD)
click node3 "#3"
node3(Chord Length Distribution - CLD) --> node4(2-point Statistics)
click node4 "#4"
Load Images of Segmented Grain Boundaries
load amgr_scaled.mat amgr2
amgr2(amgr2==255)=1;
amgr2=amgr2+1;
amgr2(amgr2==2)=0;
figure;
imagesc(amgr2); colormap gray; set(gcf, 'Position', [100, 100, 1049, 895]);
axis image; axis off
Subsample into 4 Regions
In order to obtain a quick survey of in-sample variance.
n1=size(amgr2,1)-1;
n2=size(amgr2,2);
n11=floor(n1/2);
n22=floor(n2/2);
data=amgr2;
q=zeros(4,n11,n22);
q(1,:,:)=data(1:n11, 1:n22);
q(2,:,:)=data(1:n11, n22+1:n2);
q(3,:,:)=data(n11+1:n1, 1:n22);
q(4,:,:)=data(n11+1:n1,n22+1:n2);
Chord Length Distribution - CLD
Calculate CLD of each subsample and compare with full sized image to visualize variance.
figure('DefaultAxesFontSize',16)
for i=1:4
data=squeeze(q(i,:,:));
hist=CLDXX(data,0);
p(i)=plot(hist(:,1),':b'); hold on
end
hist=CLDXX(amgr2,0);
p(5)=plot(hist(:,1),'LineWidth',1.5);
xlabel('Chord Length')
ylabel('Frequency')
axis([0,140,0,0.035])
grid on
title('CLDs of subsampled AM + Full image');
legend([p(1),p(5)],'Subsamples','Full')
Compare CLD in X and Y directions to get a quick measure of anisotropy.
figure('DefaultAxesFontSize',16)
plot(hist,'LineWidth',1.5);
xlabel('Chord Length')
ylabel('Frequency')
axis([0,140,0,0.035])
grid on
title('CLDs of Full image');
legend('X direction','Y direction')
2-point Statistics
Reveal directional structural trends in the grain boundaries.
for i=1:4
data=squeeze(q(i,:,:));
Q2pt=noob2ptauto(data,0);
end
figure;
imagesc(Q2pt)
axis image
title('2 point statistics - Autocorrelation of grain boundaries')
ax = gca;
ax.XTick = [200 225 250 275 300];
ax.YTick = [200 225 250 275 300];
ax.XTickLabel = {'-50','-25','0','25','50'};
ax.YTickLabel = {'-50','-25','0','25','50'};
axis([200,300,200,300]);
Published with MATLABĀ® R2014b