-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmakeRelativeSpotReferences.m
More file actions
42 lines (35 loc) · 1.78 KB
/
makeRelativeSpotReferences.m
File metadata and controls
42 lines (35 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function [ spotReferences ] = makeRelativeSpotReferences( spotMaps, refWin_x1,refWin_x2 )
%MakeRelativeSpotReferences Makes reference list for StrainTensorMap
% inputs:
% spotMaps -- struct array containing maps of maximum spot index Q1,Q2
% for each spot in spotList. Fields are:
% 'id' -- a name identifying the spot.
% 'Q1map' -- map of Q1 index value at peak maximum.
% 'Q2map' -- map of Q2 index value at peak maximum.
% 'x1map' -- map of x1 vector component for the spot.
% 'x2map' -- map of x2 vector component for the spot.
% 'spotlength' -- map of the spot vector length.
% 'spotangle' -- map of the spot vector angle in degrees.
% refWin_x1,refWin_x2 -- index ranges identifying area to be averaged
% to make reference spots. If only one
% argument is supplied, it is assumed to be a
% 2D mask identifying the averaging area.
% outputs:
% spotReferences -- struct array containing reference points
% corresponding to points in Qmaps. Fields are:
% 'id' -- a name identifying the spot.
% 'point' -- reference spot location [q1,q2]
%
%This function is part of the PC-STEM Package by Elliot Padgett in the
%Muller Group at Cornell University. Last updated June 26, 2019.
numspots=length(spotMaps);
ids = {};
refs = {};
for i=1:numspots
ids{i} = spotMaps(i).id;
vx1 = spotMaps(i).VectorX1(refWin_x1,refWin_x2);
vx2 = spotMaps(i).VectorX2(refWin_x1,refWin_x2);
refs{i} = [nanmean(nanmean(vx1(:))), nanmean(nanmean(vx2(:)))];
end
spotReferences = struct('id',ids,'point',refs);
end