How to move a 3D volume in 6D (3 Translations and 3 Rotations)

50 views (last 30 days)
Hello everyone,
I am simulating a CT volume that includes a couple of different structures using the "createSyntheticSkullCT" function. After that, I generate X-ray projections from the CT volume.
My goal is to move this CT volume in 6D, which includes translation in millimeters (X, Y, Z) and rotation in degrees (roll, pitch, yaw). To achieve this, I defined a function called "applyRigidTransform3D" in code 1 and "rigidTransform6D" in code 2 for the 6D movements, but I am not sure if this function is working correctly.
I would greatly appreciate any insights or suggestions regarding this code. Is my simulation realistic? If not, which parts contain errors? I would also welcome any recommended validation or sanity checks.
I have attached the MATLAB codes (Code1.m and Code2.m) below for reference.
Thank you!
  1 Comment
Catalytic
Catalytic on 24 Dec 2025 at 18:18
Edited: Catalytic on 24 Dec 2025 at 18:18
To achieve this, I defined a function called "applyRigidTransform3D" in code 1 and "rigidTransform6D" in code 2 for the 6D movements, but I am not sure if this function is working correctly.
Your posting style is unlikely to get responses because -
(1) You give us the entirety of your code even though your question is only about one specific part of the code, here applyRigidTransform3D. This forces readers to wade through unnecessary sections to get to the relevant part, which they are unlikely to do.
(2) You have presented no demonstration or test to show what makes you unsure whether the code is working.

Sign in to comment.

Accepted Answer

Matt J
Matt J on 24 Dec 2025 at 20:16
I defined a function called "applyRigidTransform3D" in code 1 and "rigidTransform6D" in code 2 for the 6D movements
It shouldn't be necessary to implement your own functions. These things already exist in Matlab in the form of imwarp and rigidtform3d.
  2 Comments
payam samadi
payam samadi on 27 Dec 2025 at 10:08
Edited: payam samadi on 31 Dec 2025 at 12:39
Thank you.
I checked the functions imwarp and rigidtform3d and applied them to my data, but I encountered an issue.
For example, when I applied the following translation:
```matlab translation = [100, 0, 0]; % y, z, x % Translation in mm [LR, AP, SI] ```
and plotted the 3D moved CT to compare it with the original CT volume, it appears that no translation was applied!
Do you have any idea for this reasons?
Matt J
Matt J on 31 Dec 2025 at 13:16
Edited: Matt J on 31 Dec 2025 at 13:21
It's because you are using the default OutputView setting. Instead, you want,
tform = rigidtform3d(rotation,translation);
sameAsInput = affineOutputView(size(CT_volume),tform,"BoundsStyle","SameAsInput");
CT_moved = imwarp(CT_volume,tform,OutputView=sameAsInput);
volshow(CT_moved);

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!