arcadelab / deepdrr

Code for "DeepDRR: A Catalyst for Machine Learning in Fluoroscopy-guided Procedures". https://arxiv.org/abs/1803.08606
GNU General Public License v3.0
209 stars 60 forks source link

Support for Faceup/Facedown for volume create from HU #60

Closed junjun1023 closed 1 year ago

junjun1023 commented 3 years ago

I get the hu_matrix from pydicom then create volume with Volume.from_hu and trying to get projection with PA view. Because the anatomical_coordinate_system for Volume.from_hu does not implement RAS, I can only get projection on axial plane. The raised error show NotImplementedError("conversion from RAS (not hard, look at LPS example)" ).

The rotation matrix of LPS is

rotation = [
    [spacing[0], 0, 0],
    [0, 0, spacing[2]],
    [0, -spacing[1], 0],
]

I know the difference between LPS and RAS is only the opposite direction of axis. However, I tried to add negative symbol -, but I still can't get PA view projection.

Could you please give me some hint to modify it?

benjamindkilleen commented 3 years ago

You would pass a custom argument to the world_from_anatomical transform, thus rotating the volume with respect to world. The faceup() method is just a convenience method that modifies this transform with a rotation. You can see its source code for an example of how to do construct the rotation.