Skip to content

Commit

Permalink
Merge pull request #40 from HumanBrainProject/fixes_for_upstream_updates
Browse files Browse the repository at this point in the history
Fixes for upstream updates of NumPy and Nibabel
  • Loading branch information
ylep authored Jul 2, 2024
2 parents 52b6a5b + be36eef commit fbeeea0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/neuroglancer_scripts/_compressed_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def _encode_channel(chunk_channel, block_size):
(lookup_table, encoded_values) = np.unique(
block, return_inverse=True, return_counts=False)
bits = number_of_encoding_bits(len(lookup_table))
encoded_values = encoded_values.ravel() # Numpy 2.0 compat

# Write look-up table to the buffer (or re-use another one)
lut_bytes = lookup_table.astype(block.dtype).tobytes()
Expand Down
2 changes: 1 addition & 1 deletion src/neuroglancer_scripts/volume_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def nibabel_image_to_info(img,
}}""".format(num_channels=shape[3] if len(shape) >= 4 else 1,
data_type=guessed_dtype,
size=list(shape[:3]),
resolution=[vs * 1000000 for vs in voxel_sizes[:3]])
resolution=[float(vs * 1_000_000) for vs in voxel_sizes[:3]])

info = json.loads(formatted_info) # ensure well-formed JSON

Expand Down

0 comments on commit fbeeea0

Please sign in to comment.