Skip to content

Commit

Permalink
fix complex valued insertion without breaking simple real space inser…
Browse files Browse the repository at this point in the history
…tion... (#15)
  • Loading branch information
alisterburt authored Nov 7, 2024
1 parent 1979ef2 commit 6a5d1b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/torch_image_lerp/linear_interpolation_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def insert_into_image_3d(
_c[:, 1] = torch.ceil(coordinates) # for upper corners

# calculate linear interpolation weights for each data point being inserted
_w = torch.empty(size=(data.shape[0], 2, 3), dtype=torch.float64, device=image.device) # (b, 2, zyx)
w_dtype = torch.float64 if image.is_complex() else image.dtype
_w = torch.empty(size=(data.shape[0], 2, 3), dtype=w_dtype, device=image.device) # (b, 2, zyx)
_w[:, 1] = coordinates - _c[:, 0] # upper corner weights
_w[:, 0] = 1 - _w[:, 1] # lower corner weights

Expand Down

0 comments on commit 6a5d1b5

Please sign in to comment.