Skip to content

Commit

Permalink
fix dtype issue in complex data insertion (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
alisterburt authored Nov 6, 2024
1 parent db93033 commit ce53e8e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/torch_image_lerp/linear_interpolation_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ def insert_into_image_3d(
data, coordinates = data[inside], coordinates[inside]

# calculate and cache floor and ceil of coordinates for each data point being inserted
_c = torch.empty(size=(data.shape[0], 2, 3), dtype=torch.long, device=image.device)
_c = torch.empty(size=(data.shape[0], 2, 3), dtype=torch.int64, device=image.device)
_c[:, 0] = torch.floor(coordinates) # for lower corners
_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=image.dtype, device=image.device) # (b, 2, zyx)
_w = torch.empty(size=(data.shape[0], 2, 3), dtype=torch.float64, 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 ce53e8e

Please sign in to comment.