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
772881ed
Commit
772881ed
authored
6 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
Topotomo import: fixes to previous commit
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
549d34db
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
4_grains/gtGrainTopotomoUpdateParameters.m
+22
-7
22 additions, 7 deletions
4_grains/gtGrainTopotomoUpdateParameters.m
zUtil_Geo/gtGeoDiffractometerDefinition.m
+40
-42
40 additions, 42 deletions
zUtil_Geo/gtGeoDiffractometerDefinition.m
with
62 additions
and
49 deletions
4_grains/gtGrainTopotomoUpdateParameters.m
+
22
−
7
View file @
772881ed
...
...
@@ -12,6 +12,8 @@ function p = gtGrainTopotomoUpdateParameters(scan_xml, range_basetilt, nproj_bas
c
=
tic
();
xmlfname
=
fullfile
(
p
.
acq
.
dir
,
'0_rawdata'
,
'Orig'
,
[
p
.
acq
.
name
'.xml'
]);
acq_xml
=
gtLoadAcquisitionXML
(
xmlfname
,
false
,
false
);
% We now have to handle the fact that it is a legacy datastructure
p
.
acq
(
1
)
.
motors
=
acq_xml
.
motors
;
base_acq
=
make_parameters
(
2
);
base_acq
=
base_acq
.
acq
;
...
...
@@ -23,14 +25,26 @@ function p = gtGrainTopotomoUpdateParameters(scan_xml, range_basetilt, nproj_bas
end
acq_tt
=
p
.
acq
(
1
);
acq_tt
.
type
=
'topotomo'
;
fprintf
(
' - Reading Topotomo acquisition parameters..'
)
c
=
tic
();
topotomo_xml
=
gtLoadAcquisitionXML
(
scan_xml
,
false
,
false
);
acq_tt
=
gtAddMatFile
(
acq_tt
,
topotomo_xml
,
true
,
false
,
false
);
acq_tt
.
type
=
'topotomo'
;
% The XML tends to set it to 360degree
acq_tt
=
gtAcqDefaultParameters
(
acq_tt
);
acq_tt
.
collection_dir
=
tt_scan_dir
;
fprintf
(
'\b\b: Done in %g seconds.\n'
,
toc
(
c
))
if
(
acq_tt
.
energy
<
0
)
disp
(
' '
)
warning
(
'Energy reported by the XML file is: %d, parsing info file...'
,
acq_tt
.
energy
)
info_file
=
fullfile
(
tt_scan_dir
,
[
acq_tt
.
name
'.info'
]);
fid
=
fopen
(
info_file
);
info_line
=
fgetl
(
fid
);
fclose
(
fid
);
energy
=
regexp
(
info_line
,
'Energy=\s*(?<value>.+)'
,
'names'
,
'once'
);
acq_tt
.
energy
=
str2double
(
energy
.
value
);
disp
(
' '
)
end
dct_samt
=
[
p
.
acq
(
1
)
.
motors
.
samtx
,
p
.
acq
(
1
)
.
motors
.
samty
,
p
.
acq
(
1
)
.
motors
.
samtz
];
tt_samt
=
[
acq_tt
.
motors
.
samtx
,
acq_tt
.
motors
.
samty
,
acq_tt
.
motors
.
samtz
];
...
...
@@ -44,7 +58,6 @@ function p = gtGrainTopotomoUpdateParameters(scan_xml, range_basetilt, nproj_bas
% samr X and Y reversed, because the first on the right is the one
% applied first when doing SAM->LAB
acq_tt
.
sample_tilts
=
tt_samr
-
dct_samr
;
acq_tt
.
sample_tilts
acq_tt
.
range_basetilt
=
range_basetilt
;
acq_tt
.
nproj_basetilt
=
nproj_basetilt
;
...
...
@@ -56,14 +69,15 @@ function p = gtGrainTopotomoUpdateParameters(scan_xml, range_basetilt, nproj_bas
p
.
detgeo
(
det_ind
)
=
detgeo_tt
;
p
.
recgeo
(
det_ind
)
=
p
.
recgeo
(
1
);
p
.
recgeo
(
det_ind
)
.
voxsize
=
mean
([
detgeo_tt
.
pixelsizeu
,
detgeo_tt
.
pixelsizev
])
*
[
1
,
1
,
1
];
if
(
~
isempty
(
pl_ind
))
p
.
acq
(
det_ind
)
.
pl_ind
=
pl_ind
;
else
if
(
isempty
(
pl_ind
))
fprintf
(
' - Guessing Topotomo pl_ind, with respect to DCT (for the range: [%g, %g])..'
,
range_basetilt
)
c
=
tic
();
% Trying to detect the tilts
p
.
diffractometer
(
det_ind
)
=
gtGeoDiffractometerDefinition
(
'esrf_id11'
,
'axes_rotation_offset'
,
dct_diffrz_start
);
p
.
diffractometer
(
det_ind
)
=
gtGeoDiffractometerDefinition
(
'esrf_id11'
,
...
'axes_rotation_offset'
,
dct_diffrz_start
,
...
'shifts_sam_stage'
,
acq_tt
.
sample_shifts
);
diff
=
p
.
diffractometer
(
det_ind
);
tilts
=
p
.
acq
(
det_ind
)
.
sample_tilts
;
...
...
@@ -75,6 +89,7 @@ function p = gtGrainTopotomoUpdateParameters(scan_xml, range_basetilt, nproj_bas
angle
=
gtMathsVectorsAnglesDeg
(
diff
.
axes_rotation
,
pl_labd
,
false
);
fprintf
(
'\b\b: Done in %g seconds.\n'
,
toc
(
c
))
[
~
,
pl_ind
]
=
min
(
angle
);
fprintf
(
' + Chosen pl_ind:
%d (%g deg)\n'
,
pl_ind
,
angle
(
pl_ind
))
fprintf
(
' + Chosen pl_ind: %d (%g deg)\n'
,
pl_ind
,
angle
(
pl_ind
))
end
p
.
acq
(
det_ind
)
.
pl_ind
=
pl_ind
;
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
zUtil_Geo/gtGeoDiffractometerDefinition.m
+
40
−
42
View file @
772881ed
function diff = gtGeoDiffractometerDefinition(types, varargin)
diff = struct( ...
'axes_basetilt', {zeros(1, 3)}, ...
'axes_rotation', {zeros(1, 3)}, ...
'axes_sam_tilt', {zeros(0, 3)}, ... % They are applied in reverse order (last->first) for SAM->LAB transformations in gtGeoDiffractometerTensor
'origin_basetilt', {zeros(1, 3)}, ...
'origin_rotation', {zeros(1, 3)}, ...
'origin_sam_tilt', {zeros(0, 3)}, ...
'limits_sam_tilt', {zeros(0, 2)}, ...
'shifts_sam_stage', {zeros(0, 3)} );
conf = struct( ...
'axes_basetilt', zeros(1, 3), ...
'axes_rotation', zeros(1, 3), ...
'axes_sam_tilt', zeros(0, 3), ... % They are applied in reverse order (last->first) for SAM->LAB transformations in gtGeoDiffractometerTensor
'origin_basetilt', zeros(1, 3), ...
'origin_rotation', zeros(1, 3), ...
'origin_sam_tilt', zeros(0, 3), ...
'limits_sam_tilt', zeros(0, 2), ...
'shifts_sam_stage', zeros(0, 3), ...
'axes_rotation_offset', [], ...
'axes_sam_tilt_offset', []);
conf = parse_pv_pairs(conf, varargin);
'axes_sam_tilt_offset', [] );
if (iscell(types))
diff(2:numel(types)) = diff;
for ii = 1:numel(types)
diff(ii) = gtAcqDiffractometerDefinition(types{ii});
end
else
switch (lower(types))
case 'esrf_id11'
diff.axes_basetilt = [0, 1, 0];
diff.axes_rotation = [0, 0, 1];
diff.axes_sam_tilt = [0, 1, 0; 1, 0, 0];
diff.origin_sam_tilt = [0, 0, 0; 0, 0, 0];
diff.limits_sam_tilt = [-15, 15; -20 20];
diff = parse_pv_pairs(diff, varargin);
if (~isempty(conf.axes_sam_tilt_offset))
rot = eye(3);
for ii = (size(diff.axes_sam_tilt, 1)-1):-1:1
rotcomp = gtMathsRotationMatrixComp(diff.axes_sam_tilt(ii, :), 'row');
rot_ii = gtMathsRotationTensor(conf.axes_sam_tilt_offset(ii), rotcomp);
rot = rot * rot_ii;
end
diff.axes_sam_tilt = diff.axes_sam_tilt * rot;
end
switch (lower(types))
case 'esrf_id11'
diff.axes_basetilt = [0, 1, 0];
diff.axes_rotation = [0, 0, 1];
diff.axes_sam_tilt = [0, 1, 0; 1, 0, 0];
diff.origin_sam_tilt = [0, 0, 0; 0, 0, 0];
diff.limits_sam_tilt = [-15, 15; -20 20];
otherwise
error('gtAcqDiffractometerDefinition:wrong_argument', ...
'Unknown diffractometer: %s', types)
end
if (~isempty(conf.axes_rotation_offset))
rotcomp = gtMathsRotationMatrixComp(diff.axes_rotation, 'row');
rot = gtMathsRotationTensor(conf.axes_rotation_offset, rotcomp);
diff.axes_sam_tilt = diff.axes_sam_tilt * rot;
end
otherwise
error('gtAcqDiffractometerDefinition:wrong_argument', ...
'Unknown diffractometer: %s', types)
if (~isempty(diff.axes_sam_tilt_offset))
rot = eye(3);
for ii = (size(diff.axes_sam_tilt, 1)-1):-1:1
rotcomp = gtMathsRotationMatrixComp(diff.axes_sam_tilt(ii, :), 'row');
rot_ii = gtMathsRotationTensor(diff.axes_sam_tilt_offset(ii), rotcomp);
rot = rot * rot_ii;
end
diff.axes_sam_tilt = diff.axes_sam_tilt * rot;
rotcomp = gtMathsRotationMatrixComp(diff.axes_sam_tilt(end, :), 'row');
rot_ii = gtMathsRotationTensor(diff.axes_sam_tilt_offset(end), rotcomp);
rot = rot_ii * rot;
diff.shifts_sam_stage = diff.shifts_sam_stage * rot;
end
if (~isempty(diff.axes_rotation_offset))
rotcomp = gtMathsRotationMatrixComp(diff.axes_rotation, 'row');
rot = gtMathsRotationTensor(diff.axes_rotation_offset, rotcomp);
diff.axes_sam_tilt = diff.axes_sam_tilt * rot;
diff.shifts_sam_stage = diff.shifts_sam_stage * rot;
end
end
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