Skip to content

Commit

Permalink
Update for diffdrr v0.4.3 (#8)
Browse files Browse the repository at this point in the history
* Sync with DiffDRR dev branch

* Ensure det=1 for poses

* Update README.md
  • Loading branch information
eigenvivek authored Jul 11, 2024
1 parent f49aaaf commit e54c222
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 123 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ drr = DRR(
deepfluoro.delx * subsample,
x0=deepfluoro.x0,
y0=deepfluoro.y0,
reverse_x_axis=False,
)
transform = Transforms(deepfluoro.height // subsample)

Expand Down Expand Up @@ -140,8 +141,9 @@ drr = DRR(
delx * subsample,
width // subsample,
dely * subsample,
x0=x0,
x0=-x0,
y0=y0,
reverse_x_axis=False,
)
transform = Transforms(height // subsample, width // subsample)

Expand Down
20 changes: 10 additions & 10 deletions diffdrrdata/deepfluoro.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(
self.flip_z = RigidTransform(
torch.tensor(
[
[0, -1, 0, 0],
[0, 1, 0, 0],
[1, 0, 0, 0],
[0, 0, -1, 0],
[0, 0, 0, 1],
Expand Down Expand Up @@ -141,15 +141,6 @@ def parse_volume(subject, bone_attenuation_multiplier):
volume = ScalarImage(tensor=volume, affine=affine)
labelmap = LabelMap(tensor=mask, affine=affine)

# Package the subject
subject = read(
volume=volume,
labelmap=labelmap,
bone_attenuation_multiplier=bone_attenuation_multiplier,
label_def=defns,
fiducials=fiducials,
)

# Move the fiducials's isocenter to the origin in world coordinates
isocenter = volume.get_center()
anatomical2world = RigidTransform(
Expand All @@ -164,6 +155,15 @@ def parse_volume(subject, bone_attenuation_multiplier):
)
)

# Package the subject
subject = read(
volume=volume,
labelmap=labelmap,
bone_attenuation_multiplier=bone_attenuation_multiplier,
label_def=defns,
fiducials=fiducials,
)

return subject, anatomical2world


Expand Down
19 changes: 11 additions & 8 deletions diffdrrdata/ljubljana.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(
self.flip_z = RigidTransform(
torch.tensor(
[
[0, -1, 0, 0],
[0, 1, 0, 0],
[1, 0, 0, 0],
[0, 0, -1, 0],
[0, 0, 0, 1],
Expand Down Expand Up @@ -89,13 +89,7 @@ def parse_volume(f, subject_id):

volume = ScalarImage(tensor=volume, affine=affine)
fiducials = torch.from_numpy(subject["points"][:]).unsqueeze(0)
subject = read(
volume=volume,
labelmap=None,
bone_attenuation_multiplier=1.0,
fiducials=fiducials,
orientation="AP",
)

# Move the Subject's isocenter to the origin in world coordinates
isocenter = volume.get_center()
anatomical2world = RigidTransform(
Expand All @@ -110,6 +104,15 @@ def parse_volume(f, subject_id):
)
)

# Package the subject
subject = read(
volume=volume,
labelmap=None,
bone_attenuation_multiplier=1.0,
fiducials=fiducials,
orientation="AP",
)

return subject, anatomical2world

# %% ../notebooks/01_ljubljana.ipynb 7
Expand Down
Binary file modified index_files/figure-commonmark/cell-2-output-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified index_files/figure-commonmark/cell-3-output-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
141 changes: 74 additions & 67 deletions notebooks/00_deepfluoro.ipynb

Large diffs are not rendered by default.

82 changes: 50 additions & 32 deletions notebooks/01_ljubljana.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions notebooks/deepfluoro_camera_poses.html

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions notebooks/index.ipynb

Large diffs are not rendered by default.

0 comments on commit e54c222

Please sign in to comment.