From 70d0190650fb9d4d9302a84cdc56cd7ec83fd328 Mon Sep 17 00:00:00 2001 From: eigenvivek Date: Thu, 12 Dec 2024 17:15:27 -0500 Subject: [PATCH] Allow setting of reverse_x_axis and n_subsamples --- diffdrr/drr.py | 8 +++++--- notebooks/api/00_drr.ipynb | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/diffdrr/drr.py b/diffdrr/drr.py index c02778d83..8e5a8ac92 100644 --- a/diffdrr/drr.py +++ b/diffdrr/drr.py @@ -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( @@ -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 diff --git a/notebooks/api/00_drr.ipynb b/notebooks/api/00_drr.ipynb index 95da3da1e..f3ad9083c 100644 --- a/notebooks/api/00_drr.ipynb +++ b/notebooks/api/00_drr.ipynb @@ -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", @@ -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)" ] },