diff --git a/5_reconstruction/GtAssembleVol3D.m b/5_reconstruction/GtAssembleVol3D.m index 94dfbfdac73a946093610845c7ccef17374eeaa8..c140376d65172460302c2040352ec1d431046b14 100644 --- a/5_reconstruction/GtAssembleVol3D.m +++ b/5_reconstruction/GtAssembleVol3D.m @@ -530,7 +530,8 @@ classdef GtAssembleVol3D < handle for ii = 1:numel(rot_angles) rot_axis = obj.localPar.rotation_axes(ii, :)'; 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 diff --git a/zUtil_Imaging/gtRotateVolume.m b/zUtil_Imaging/gtRotateVolume.m index ff5e1102dccd1034aef26536f2be5bcdfb414a15..6ee369e1291fe23dc3b814e3a6b3361b46975415 100644 --- a/zUtil_Imaging/gtRotateVolume.m +++ b/zUtil_Imaging/gtRotateVolume.m @@ -7,7 +7,8 @@ function vol = gtRotateVolume(vol, rot_tensor_angle, rot_axis) rot_tensor = eye(3); for ii = 1:numel(rot_angle) 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 else rot_tensor = rot_tensor_angle; @@ -19,19 +20,20 @@ function vol = gtRotateVolume(vol, rot_tensor_angle, rot_axis) T1(4, 1:3) = -vol_center; 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(4, 1:3) = +vol_center; T = T1 * T2 * T3; - tform = affine3d(T); - vol = imwarp(vol, tform, 'OutputView', imref3d(size(vol))); +% tform = affine3d(T); +% vol = imwarp(vol, tform, 'OutputView', imref3d(size(vol))); % 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'); -% vol = tformarray(vol, tform, R, [1 2 3], [1 2 3], vol_size, [], 0); + tform = maketform('affine', T); + R = makeresampler('linear', 'fill'); + vol = tformarray(vol, tform, R, [1 2 3], [1 2 3], vol_size, [], 0); end