Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bigstream/piecewise_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ def align_single_block(indices, static_transform_list):
missing_weights[region] += weights[neighbor_region]

# rebalance the weights
weights = weights / (1 - missing_weights)
with np.errstate(divide='ignore', invalid='ignore'):
weights = weights / (1 - missing_weights)
weights[np.isnan(weights)] = 0. # edges of blocks are 0/0
weights = weights.astype(np.float32)

Expand Down
7 changes: 6 additions & 1 deletion bigstream/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,12 @@ def apply_transform_to_coordinates(
# interpolate position field at coordinates, reformat, return
ndims = transform.shape[-1]
interp = lambda x: map_coordinates(x, coordinates, mode='nearest')
dX = np.array([interp(transform[..., i]) for i in range(ndims)]).transpose()
dX = []
for i in range(ndims):
if transform[..., i]:
dX.append(interp(transform[..., i]))
else:
dx.append(interp([0])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have a typo here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks

coordinates = coordinates.transpose() * spacing + dX
if origin is not None: coordinates += origin

Expand Down