Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 @@ -383,7 +383,8 @@ def align_single_block(single_block_data, 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 @@ -235,7 +235,12 @@ def apply_transform_to_coordinates(
ndims = transform.shape[-1]
if 'mode' not in kwargs.keys(): kwargs['mode'] = 'nearest'
interp = lambda x: map_coordinates(x, coordinates, **kwargs)
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])
coordinates = coordinates.transpose() * spacing + dX
if origin is not None: coordinates += origin

Expand Down