Skip to content
Snippets Groups Projects
Commit 18df74ad authored by Nicola Vigano's avatar Nicola Vigano
Browse files

gtRotateVolume/Assemble: reverted performance improvements until I figure out how to fix it

parent 64ff2910
No related branches found
No related tags found
No related merge requests found
...@@ -530,7 +530,8 @@ classdef GtAssembleVol3D < handle ...@@ -530,7 +530,8 @@ classdef GtAssembleVol3D < handle
for ii = 1:numel(rot_angles) for ii = 1:numel(rot_angles)
rot_axis = obj.localPar.rotation_axes(ii, :)'; rot_axis = obj.localPar.rotation_axes(ii, :)';
rotcomp = gtMathsRotationMatrixComp(rot_axis, 'col'); rotcomp = gtMathsRotationMatrixComp(rot_axis, 'col');
rot = rot * gtMathsRotationTensor(rot_angles(ii), rotcomp); rot = gtMathsRotationTensor(rot_angles(ii), rotcomp) * rot;
% rot = rot * gtMathsRotationTensor(rot_angles(ii), rotcomp);
end end
end end
......
...@@ -7,7 +7,8 @@ function vol = gtRotateVolume(vol, rot_tensor_angle, rot_axis) ...@@ -7,7 +7,8 @@ function vol = gtRotateVolume(vol, rot_tensor_angle, rot_axis)
rot_tensor = eye(3); rot_tensor = eye(3);
for ii = 1:numel(rot_angle) for ii = 1:numel(rot_angle)
rotcomp = gtMathsRotationMatrixComp(rot_axis(ii, :)', 'col'); rotcomp = gtMathsRotationMatrixComp(rot_axis(ii, :)', 'col');
rot_tensor = rot_tensor * gtMathsRotationTensor(rot_angle(ii), rotcomp); rot_tensor = gtMathsRotationTensor(rot_angle(ii), rotcomp) * rot_tensor;
% rot_tensor = rot_tensor * gtMathsRotationTensor(rot_angle(ii), rotcomp);
end end
else else
rot_tensor = rot_tensor_angle; rot_tensor = rot_tensor_angle;
...@@ -19,19 +20,20 @@ function vol = gtRotateVolume(vol, rot_tensor_angle, rot_axis) ...@@ -19,19 +20,20 @@ function vol = gtRotateVolume(vol, rot_tensor_angle, rot_axis)
T1(4, 1:3) = -vol_center; T1(4, 1:3) = -vol_center;
T2 = eye(4); T2 = eye(4);
T2(1:3, 1:3) = rot_tensor'; T2(1:3, 1:3) = rot_tensor;
% T2(1:3, 1:3) = rot_tensor';
T3 = eye(4); T3 = eye(4);
T3(4, 1:3) = +vol_center; T3(4, 1:3) = +vol_center;
T = T1 * T2 * T3; T = T1 * T2 * T3;
tform = affine3d(T); % tform = affine3d(T);
vol = imwarp(vol, tform, 'OutputView', imref3d(size(vol))); % vol = imwarp(vol, tform, 'OutputView', imref3d(size(vol)));
% Old version. NOTE that rot_tensor should be un-transposed if this % Old version. NOTE that rot_tensor should be un-transposed if this
% version was to be used. % version was to be used.
% tform = maketform('affine', T); tform = maketform('affine', T);
% R = makeresampler('linear', 'fill'); R = makeresampler('linear', 'fill');
% vol = tformarray(vol, tform, R, [1 2 3], [1 2 3], vol_size, [], 0); vol = tformarray(vol, tform, R, [1 2 3], [1 2 3], vol_size, [], 0);
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment