Skip to content

Commit 7b36bbc

Browse files
authored
Add degrees option to forward model (#397)
1 parent 7700058 commit 7b36bbc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

diffdrr/drr.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,20 @@ def forward(
160160
convention: str = None, # If parameterization is Euler angles, specify convention
161161
calibration: RigidTransform = None, # Optional calibration matrix with the detector's intrinsic parameters
162162
mask_to_channels: bool = False, # If True, structures from the CT mask are rendered in separate channels
163+
degrees: bool = False, # If parameterization is Euler angles, use degrees instead of radians
163164
**kwargs, # Passed to the renderer
164165
):
165166
"""Generate DRR with rotational and translational parameters."""
166167
# Initialize the camera pose
167168
if parameterization is None:
168169
pose = args[0]
169170
else:
170-
pose = convert(*args, parameterization=parameterization, convention=convention)
171+
pose = convert(
172+
*args,
173+
parameterization=parameterization,
174+
convention=convention,
175+
degrees=degrees,
176+
)
171177

172178
# Create the source / target points and render the image
173179
source, target = self.detector(pose, calibration)

notebooks/api/00_drr.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,15 @@
279279
" convention: str = None, # If parameterization is Euler angles, specify convention\n",
280280
" calibration: RigidTransform = None, # Optional calibration matrix with the detector's intrinsic parameters\n",
281281
" mask_to_channels: bool = False, # If True, structures from the CT mask are rendered in separate channels\n",
282+
" degrees: bool = False, # If parameterization is Euler angles, use degrees instead of radians\n",
282283
" **kwargs, # Passed to the renderer\n",
283284
"):\n",
284285
" \"\"\"Generate DRR with rotational and translational parameters.\"\"\"\n",
285286
" # Initialize the camera pose\n",
286287
" if parameterization is None:\n",
287288
" pose = args[0]\n",
288289
" else:\n",
289-
" pose = convert(*args, parameterization=parameterization, convention=convention)\n",
290+
" pose = convert(*args, parameterization=parameterization, convention=convention, degrees=degrees)\n",
290291
"\n",
291292
" # Create the source / target points and render the image\n",
292293
" source, target = self.detector(pose, calibration)\n",

0 commit comments

Comments
 (0)