Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
graintracking
DCT
Commits
fa752294
Commit
fa752294
authored
7 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
Improved IPF key generation function
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
db40e542
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
6_rendering/gtIPFCmapKey.m
+75
-65
75 additions, 65 deletions
6_rendering/gtIPFCmapKey.m
with
75 additions
and
65 deletions
6_rendering/gtIPFCmapKey.m
+
75
−
65
View file @
fa752294
function
h
=
gtIPFCmapKey
(
varargin
)
function
[
h
,
ax
]
=
gtIPFCmapKey
(
varargin
)
% GTIPFCMAPKEY Show inverse pole figure color space in the hexagonal SST
% GTIPFCMAPKEY Show inverse pole figure color space in the hexagonal SST
%
%
% h = gtIPFCmapKey(varargin)
% h = gtIPFCmapKey(varargin)
...
@@ -23,22 +23,24 @@ function h = gtIPFCmapKey(varargin)
...
@@ -23,22 +23,24 @@ function h = gtIPFCmapKey(varargin)
app
=
struct
(
...
app
=
struct
(
...
'crystal_system'
,
''
,
...
'crystal_system'
,
''
,
...
'N'
,
30
,
...
'N'
,
45
,
...
'poles_label'
,
true
,
...
'poles_label'
,
true
,
...
'ipf_label'
,
true
,
...
'ipf_label'
,
true
,
...
'font_size'
,
1
2
,
...
'font_size'
,
2
0
,
...
'font_color'
,
[
0
0
0
],
...
'font_color'
,
[
0
0
0
],
...
'drawing'
,
true
,
...
'drawing'
,
true
,
...
'hf'
,
[],
...
'hf'
,
[],
...
'ha'
,
[],
...
'ha'
,
[],
...
'fig_color'
,
[
1
1
1
],
...
'fig_color'
,
[
1
1
1
],
...
'sample_dir'
,
''
);
'sample_dir'
,
''
,
...
'phase_id'
,
1
,
...
'saturate'
,
true
);
[
app
,
rej_pars
]
=
parse_pv_pairs
(
app
,
varargin
);
[
app
,
rej_pars
]
=
parse_pv_pairs
(
app
,
varargin
);
if
(
isempty
(
app
.
crystal_system
))
if
(
isempty
(
app
.
crystal_system
))
parameters
=
gtLoadParameters
();
parameters
=
gtLoadParameters
();
app
.
crystal_system
=
parameters
.
cryst
(
1
)
.
crystal_system
;
app
.
crystal_system
=
parameters
.
cryst
(
app
.
phase_id
)
.
crystal_system
;
end
end
if
(
isempty
(
app
.
hf
))
if
(
isempty
(
app
.
hf
))
...
@@ -53,69 +55,70 @@ else
...
@@ -53,69 +55,70 @@ else
end
end
hold
(
ha
,
'on'
);
hold
(
ha
,
'on'
);
if
(
ismember
(
app
.
crystal_system
,
{
'hexagonal'
,
'hex'
,
'hcp'
,
'h'
}))
switch
(
lower
(
app
.
crystal_system
))
% For hexagonal colour map, we need two angles:
case
{
'hexagonal'
,
'hex'
,
'hcp'
,
'h'
}
% - phi (around z-axis)
% For hexagonal colour map, we need two angles:
% - psi (from z-axis to vector)
% - phi (around z-axis)
% Work in radians
% - psi (from z-axis to vector)
phimin
=
0
;
% Work in radians
phimax
=
pi
/
6
;
phimin
=
0
;
inc
=
phimax
/
app
.
N
;
phimax
=
pi
/
6
;
inc
=
phimax
/
app
.
N
;
psimin
=
0
;
psimax
=
pi
/
2
;
psimin
=
0
;
elseif
(
ismember
(
app
.
crystal_system
,
{
'cubic'
,
'cube'
,
'c'
}))
psimax
=
pi
/
2
;
% For cubic colour map, we need two angles:
case
{
'cubic'
,
'cube'
,
'c'
}
% - phi (around z-axis)
% For cubic colour map, we need two angles:
% - chi (around y-axis)
% - phi (around z-axis)
% Work in radians
% - chi (around y-axis)
phimin
=
0
;
% Work in radians
phimax
=
pi
/
4
;
phimin
=
0
;
inc
=
phimax
/
app
.
N
;
phimax
=
pi
/
4
;
inc
=
phimax
/
app
.
N
;
psimin
=
0
;
psimax
=
atan
(
sqrt
(
2
))
+
inc
;
psimin
=
0
;
chimax
=
pi
/
4
;
psimax
=
atan
(
sqrt
(
2
))
+
inc
;
chimax
=
pi
/
4
;
end
end
h_p
=
[];
h_p
=
[];
for
phi
=
phimin
:
inc
:(
phimax
-
inc
)
% Rotation around z-axis
for
phi
=
phimin
:
inc
:(
phimax
-
inc
)
% Rotation around z-axis
for
psi
=
psimin
:
inc
:(
psimax
-
inc
)
% Out from z-axis to vector
psis
=
(
psimin
:
inc
:(
psimax
-
inc
))
'
;
if
(
ismember
(
app
.
crystal_system
,
{
'hexagonal'
,
'hex'
,
'hcp'
,
'h'
}))
if
(
ismember
(
app
.
crystal_system
,
{
'hexagonal'
,
'hex'
,
'hcp'
,
'h'
}))
ratioR
=
1
-
psi
/
psimax
;
ratios_R
=
1
-
psis
.
/
psimax
;
elseif
(
ismember
(
app
.
crystal_system
,
{
'cubic'
,
'cube'
,
'c'
}))
elseif
(
ismember
(
app
.
crystal_system
,
{
'cubic'
,
'cube'
,
'c'
}))
z
=
cos
(
psi
);
zs
=
cos
(
psis
);
x
=
sin
(
psi
)
*
cos
(
phi
);
xs
=
sin
(
psis
)
*
cos
(
phi
);
chi
=
atan2
(
x
,
z
);
chis
=
atan2
(
xs
,
zs
);
if
chi
>
chimax
+
inc
/
2
valid_chis
=
chis
<=
(
chimax
+
inc
/
2
);
continue
;
ratios_R
=
1
-
chis
(
valid_chis
)
/
chimax
;
end
psis
=
psis
(
valid_chis
);
ratioR
=
1
-
chi
/
chimax
;
end
end
ratioB
=
phi
/
phimax
;
ratioB
=
phi
/
phimax
;
red
=
ratioR
;
red
=
ratio
s_
R
;
green
=
(
1
-
ratioR
)
*
(
1
-
ratioB
);
green
=
(
1
-
ratio
s_
R
)
.
*
(
1
-
ratioB
);
blue
=
(
1
-
ratioR
)
*
ratioB
;
blue
=
(
1
-
ratio
s_
R
)
.
*
ratioB
;
rgb
=
[
red
green
blue
];
rgb
=
[
red
,
green
,
blue
];
% Ensure that we stay in [0 1]
% Ensure that we stay in [0 1]
rgb
(
rgb
<
0
)
=
0
;
rgb
=
max
(
rgb
,
0
);
rgb
(
rgb
>
1
)
=
1
;
rgb
=
min
(
rgb
,
1
);
if
(
app
.
saturate
)
if
(
app
.
saturate
)
rgb
=
gtCrystSaturateSSTColor
(
rgb
);
rgb
=
gtCrystSaturateSSTColor
(
rgb
);
end
end
% Radius distorted for stereographic proj
if
(
app
.
drawing
)
r_patch
=
tan
([
psi
/
2
(
psi
+
inc
)/
2
]);
for
ii
=
1
:
numel
(
psis
)
[
phi_patch
,
r_patch
]
=
meshgrid
([
phi
phi
+
inc
]
'
,
r_patch
);
% Radius distorted for stereographic proj
[
x_patch
,
y_patch
]
=
pol2cart
(
phi_patch
,
r_patch
);
r_patch
=
tan
([
psis
(
ii
)/
2
(
psis
(
ii
)
+
inc
)/
2
]);
[
phi_patch
,
r_patch
]
=
meshgrid
([
phi
phi
+
inc
]
'
,
r_patch
);
[
x_patch
,
y_patch
]
=
pol2cart
(
phi_patch
,
r_patch
);
if
(
app
.
drawing
)
h_p
(
end
+
1
)
=
patch
(
x_patch
,
y_patch
,
rgb
(
ii
,
:),
'EdgeColor'
,
'none'
,
'Faces'
,
[
1
2
4
3
],
'Parent'
,
ha
);
h_p
(
end
+
1
)
=
patch
(
x_patch
,
y_patch
,
rgb
,
'EdgeColor'
,
'none'
,
'Faces'
,
[
1
2
4
3
],
'Parent'
,
ha
);
end
end
end
end
end
end
...
@@ -192,7 +195,7 @@ if (ismember(app.crystal_system, {'hexagonal', 'hex', 'hcp', 'h'}))
...
@@ -192,7 +195,7 @@ if (ismember(app.crystal_system, {'hexagonal', 'hex', 'hcp', 'h'}))
elseif
(
ismember
(
app
.
crystal_system
,
{
'cubic'
,
'cube'
,
'c'
}))
elseif
(
ismember
(
app
.
crystal_system
,
{
'cubic'
,
'cube'
,
'c'
}))
uvw_poles_x
=
[
0
0.366
0.4142
0.236
0.2247
0.3
0.4
];
uvw_poles_x
=
[
0
0.366
0.4142
0.236
0.2247
0.3
0.4
];
uvw_poles_y
=
[
0
0.366
0
0
0.2247
0.153
0.2
];
uvw_poles_y
=
[
0
0.366
0
0
0.2247
0.153
0.2
];
uvw_poles_l
=
{
'[0 0 1]'
,
'[1 1 1]'
,
'[1 0 1]'
,
'[1 0 2]'
,
'[1 1 2]'
,
'[2 1 3]'
,
'[2 1 2]'
};
uvw_poles_l
=
{
'[0 0 1]'
,
'[1 1 1]'
,
'
[1 0 1]'
,
'[1 0 2]
'
,
'[1 1 2]
'
,
'[2 1 3]'
,
'[2 1 2]'
};
%uvw_poles_l(end+1) = {'[159]'};
%uvw_poles_l(end+1) = {'[159]'};
%uvw_poles_x(end+1) = 0.2584;
%uvw_poles_x(end+1) = 0.2584;
%uvw_poles_y(end+1) = 0.0516; % 159
%uvw_poles_y(end+1) = 0.0516; % 159
...
@@ -201,7 +204,7 @@ end
...
@@ -201,7 +204,7 @@ end
h_t
=
[];
h_t
=
[];
if
(
app
.
poles_label
)
if
(
app
.
poles_label
)
for
ii
=
1
:
length
(
uvw_poles_x
)
for
ii
=
1
:
length
(
uvw_poles_x
)
plot
(
uvw_poles_x
(
ii
),
uvw_poles_y
(
ii
),
'
*'
,
...
plot
(
uvw_poles_x
(
ii
),
uvw_poles_y
(
ii
),
'
o'
,
'LineWidth'
,
5
,
...
'Tag'
,
'h_points_plot'
,
'Color'
,
app
.
font_color
,
'Parent'
,
ha
);
'Tag'
,
'h_points_plot'
,
'Color'
,
app
.
font_color
,
'Parent'
,
ha
);
h_t
{
ii
}
=
text
(
uvw_poles_x
(
ii
),
uvw_poles_y
(
ii
),
uvw_poles_l
{
ii
},
...
h_t
{
ii
}
=
text
(
uvw_poles_x
(
ii
),
uvw_poles_y
(
ii
),
uvw_poles_l
{
ii
},
...
...
@@ -212,6 +215,12 @@ if (app.poles_label)
...
@@ -212,6 +215,12 @@ if (app.poles_label)
if
(
ii
==
2
)
if
(
ii
==
2
)
set
(
h_t
{
ii
},
'VerticalAlignment'
,
'bottom'
)
set
(
h_t
{
ii
},
'VerticalAlignment'
,
'bottom'
)
end
end
if
(
ii
==
7
)
set
(
h_t
{
ii
},
'VerticalAlignment'
,
'bottom'
)
end
if
(
ii
==
5
)
set
(
h_t
{
ii
},
'VerticalAlignment'
,
'middle'
,
'HorizontalAlignment'
,
'right'
)
end
end
end
end
end
...
@@ -222,7 +231,7 @@ set(hf, 'Color', app.fig_color)
...
@@ -222,7 +231,7 @@ set(hf, 'Color', app.fig_color)
set
(
ha
,
'Visible'
,
'off'
);
set
(
ha
,
'Visible'
,
'off'
);
if
(
app
.
ipf_label
)
if
(
app
.
ipf_label
)
label
and
sample
direction
to
plot
%
label and sample direction to plot
h_ipf
=
text
(
0
,
0.6
,
0
,
'IPF'
,
...
h_ipf
=
text
(
0
,
0.6
,
0
,
'IPF'
,
...
'FontSize'
,
app
.
font_size
,
'Color'
,
app
.
font_color
,
...
'FontSize'
,
app
.
font_size
,
'Color'
,
app
.
font_color
,
...
'VerticalAlignment'
,
'top'
,
'HorizontalAlignment'
,
'left'
,
...
'VerticalAlignment'
,
'top'
,
'HorizontalAlignment'
,
'left'
,
...
...
@@ -236,13 +245,14 @@ h_ipf_dir = text(0, 0.52, 0, app.sample_dir, ...
...
@@ -236,13 +245,14 @@ h_ipf_dir = text(0, 0.52, 0, app.sample_dir, ...
if
(
ismember
(
app
.
crystal_system
,
{
'cubic'
,
'cube'
,
'c'
}))
if
(
ismember
(
app
.
crystal_system
,
{
'cubic'
,
'cube'
,
'c'
}))
if
(
app
.
ipf_label
)
if
(
app
.
ipf_label
)
set
(
h_ipf
,
'Position'
,
[
0
,
0.
35
,
0
])
set
(
h_ipf
,
'Position'
,
[
-
0.1
,
0.
40
,
0
])
end
end
set
(
h_ipf_dir
,
'Position'
,
[
0
,
0.3
2
,
0
])
set
(
h_ipf_dir
,
'Position'
,
[
-
0.1
,
0.3
5
,
0
])
end
end
if
(
nargout
>
0
)
if
(
nargout
>
0
)
h
=
guihandles
(
hf
);
h
=
guihandles
(
hf
);
ax
=
ha
;
end
end
end
% end of function
end
% end of function
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment