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
b90b3d10
Commit
b90b3d10
authored
7 years ago
by
Wolfgang Ludwig
Browse files
Options
Downloads
Patches
Plain Diff
add option for nearest neighbor interpolation to gtRotateVolume
Signed-off-by:
Wolfgang Ludwig
<
wolfgang.ludwig@esrf.fr
>
parent
90bde551
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
4_grains/gtGrainRotateStructure.m
+9
-6
9 additions, 6 deletions
4_grains/gtGrainRotateStructure.m
zUtil_Imaging/gtRotateVolume.m
+6
-4
6 additions, 4 deletions
zUtil_Imaging/gtRotateVolume.m
with
15 additions
and
10 deletions
4_grains/gtGrainRotateStructure.m
+
9
−
6
View file @
b90b3d10
function [structure, proj] = gtGrainRotateStructure(structure, proj, type, parameters, rot_tensor_angles, rot_axes)
function [structure, proj] = gtGrainRotateStructure(structure, proj, type, parameters, rot_tensor_angles, rot_axes
, interpolation
)
if (any([size(rot_tensor_angles, 1), size(rot_tensor_angles, 2)] == 1))
rot_angles = rot_tensor_angles;
if (~exist('rot_ax
i
s', 'var'))
if (~exist('rot_ax
e
s', 'var')
|| isempty(rot_axes)
)
rot_axes = [0 0 1];
end
rot_tensor = gtMathsRotationTensorComposite(rot_axes, rot_angles);
else
rot_tensor = rot_tensor_angles;
end
if (~exist('interpolation','var') || isempty(interpolation))
interpolation = 'linear';
end
structure.intensity = gtRotateVolume(structure.intensity, rot_tensor);
structure.intensity = gtRotateVolume(structure.intensity, rot_tensor
, [], [], interpolation
);
switch (upper(type))
case 'ODF6D'
dmvol = structure.voxels_avg_R_vectors;
dmvol(:, :, :, 1) = gtRotateVolume(dmvol(:, :, :, 1), rot_tensor);
dmvol(:, :, :, 2) = gtRotateVolume(dmvol(:, :, :, 2), rot_tensor);
dmvol(:, :, :, 3) = gtRotateVolume(dmvol(:, :, :, 3), rot_tensor);
dmvol(:, :, :, 1) = gtRotateVolume(dmvol(:, :, :, 1), rot_tensor
, [], [], interpolation
);
dmvol(:, :, :, 2) = gtRotateVolume(dmvol(:, :, :, 2), rot_tensor
, [], [], interpolation
);
dmvol(:, :, :, 3) = gtRotateVolume(dmvol(:, :, :, 3), rot_tensor
, [], [], interpolation
);
structure.voxels_avg_R_vectors = dmvol;
case 'VOL3D'
end
...
...
This diff is collapsed.
Click to expand it.
zUtil_Imaging/gtRotateVolume.m
+
6
−
4
View file @
b90b3d10
function
vol
=
gtRotateVolume
(
vol
,
rot_tensor_angle
,
rot_axis
,
rot_center
)
function
vol
=
gtRotateVolume
(
vol
,
rot_tensor_angle
,
rot_axis
,
rot_center
,
interpolation
)
% function vol = gtRotateVolume(vol, rot_tensor_angle, rot_axis, rot_center)
if
(
any
([
size
(
rot_tensor_angle
,
1
),
size
(
rot_tensor_angle
,
2
)]
==
1
))
rot_angle
=
rot_tensor_angle
;
if
(
~
exist
(
'rot_axis'
,
'var'
))
if
(
~
exist
(
'rot_axis'
,
'var'
)
||
isempty
(
rot_axis
)
)
rot_axis
=
[
0
0
1
];
end
rot_tensor
=
eye
(
3
);
...
...
@@ -18,7 +18,9 @@ function vol = gtRotateVolume(vol, rot_tensor_angle, rot_axis, rot_center)
if
(
~
exist
(
'rot_center'
,
'var'
)
||
isempty
(
rot_center
))
rot_center
=
(
vol_size
+
1
)
/
2
;
end
if
(
~
exist
(
'interpolation'
,
'var'
)
||
isempty
(
'interpolation'
))
interpolation
=
'linear'
;
end
T1
=
eye
(
4
);
T1
(
4
,
1
:
3
)
=
-
rot_center
;
...
...
@@ -37,6 +39,6 @@ function vol = gtRotateVolume(vol, rot_tensor_angle, rot_axis, rot_center)
% Old version. NOTE that rot_tensor should be un-transposed if this
% version was to be used.
tform
=
maketform
(
'affine'
,
T
);
R
=
makeresampler
(
'linear'
,
'fill'
);
R
=
makeresampler
(
interpolation
,
'fill'
);
vol
=
tformarray
(
vol
,
tform
,
R
,
[
1
2
3
],
[
1
2
3
],
vol_size
,
[],
0
);
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