Skip to content

Commit

Permalink
Allow setting of reverse_x_axis and n_subsamples
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenvivek committed Dec 12, 2024
1 parent b94b38e commit 70d0190
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions diffdrr/drr.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ def set_intrinsics_(
dely: float = None,
x0: float = None,
y0: float = None,
n_subsample: int = None,
reverse_x_axis: bool = None,
):
"""Set new intrinsic parameters (inplace)."""
self.detector = Detector(
Expand All @@ -222,9 +224,9 @@ def set_intrinsics_(
dely if dely is not None else self.detector.dely,
x0 if x0 is not None else self.detector.x0,
y0 if y0 is not None else self.detector.y0,
n_subsample=self.detector.n_subsample,
reverse_x_axis=self.detector.reverse_x_axis,
reorient=self.subject.reorient,
self.subject.reorient,
n_subsample if n_subsample is not None else self.detector.n_subsample,
reverse_x_axis if reverse_x_axis is not None else self.detector.reverse_x_axis,
).to(self.density)

# %% ../notebooks/api/00_drr.ipynb 12
Expand Down
8 changes: 5 additions & 3 deletions notebooks/api/00_drr.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@
" dely: float = None,\n",
" x0: float = None,\n",
" y0: float = None,\n",
" n_subsample: int = None,\n",
" reverse_x_axis: bool = None,\n",
"):\n",
" \"\"\"Set new intrinsic parameters (inplace).\"\"\"\n",
" self.detector = Detector(\n",
Expand All @@ -349,9 +351,9 @@
" dely if dely is not None else self.detector.dely,\n",
" x0 if x0 is not None else self.detector.x0,\n",
" y0 if y0 is not None else self.detector.y0,\n",
" n_subsample=self.detector.n_subsample,\n",
" reverse_x_axis=self.detector.reverse_x_axis,\n",
" reorient=self.subject.reorient,\n",
" self.subject.reorient,\n",
" n_subsample if n_subsample is not None else self.detector.n_subsample,\n",
" reverse_x_axis if reverse_x_axis is not None else self.detector.reverse_x_axis,\n",
" ).to(self.density)"
]
},
Expand Down

0 comments on commit 70d0190

Please sign in to comment.