Comments (3)
Hi @charlesalec, thanks for bringing this to my attention. This is due to an issue with diffdrr.pose.RigidTransform.convert
.
diffdrr.drr.DRR
and diffdrr.registration.Registration
assume that, given a rotation R
and a translation t
, the camera pose is pose = t.compose(R)
. Written as a matrix, this looks like [R | Rt]
. If you look at a CV textbook like Hartley and Zisserman, they explain that this represents a camera center Rt
and a camera orientation R
.
In contrast, diffdrr.pose.RigidTransform.convert
assumes that the camera pose is pose = [R | t]
. Therefore, when it converts a pose into its underlying parameters, it turns your R
into Euler angles and returns your t
without modification.
[R | t]
is the old convention in DiffDRR and I am pretty sure I will make [R | Rt]
the new convention going forward (since it directly models how C-arms behave). Thanks for catching this piece of legacy code - will add it to the list of fixes for v0.4.0.
For now, here's a hack that should get you what you need:
# pose : diffdrr.pose.RigidTransform that we want to convert into `R` and `t`
rot, rotxyz = pose.convert("euler_angles", "ZXY")
R = convert(rot, torch.zeros_like(rot), parameterization="euler_angles", convention="ZXY")
xyz = R.inverse()(rotxyz.unsqueeze(0))[0]
reg = Registration(
drr,
rot,
xyz,
parameterization="euler_angles",
convention="ZXY",
)
from diffdrr.
Aha yes, I see it now. You're right, that did indeed fix it. Thanks for the explanation, that wasn't obvious to me at all that they behaved differently.
Much appreciated!
from diffdrr.
No problem! I'll keep this open until a fix is merged.
from diffdrr.
Related Issues (20)
- bigger field of view HOT 3
- Add geometry tutorial
- Issue with orientations != RAS HOT 2
- Make `mask_to_channels` compatible with `renderer="trilinear"`
- Implement new SO(3) parameterization
- Application of external matrices in real X-ray HOT 5
- DRR.perspective_projection function HOT 3
- Implement simpler API for optimizing intrinsic parameters
- Questions about perspective projection HOT 2
- Hotfix calibration docs
- Switch to Apache license
- Add DICOM X-ray parser
- Extrinsic passed to the DRR module HOT 7
- Advice on higher dimensional representations for optimization HOT 2
- Add reconstruction tutorial
- Cannot run the example of diffdrr HOT 2
- Let `diffdrr.renderer.Siddon` take a different source for every target
- bug in perspective_projection
- Transform diffdrr coordinate system to other C-arm coordinate system HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diffdrr.