Skip to content

Commit fbeeea0

Browse files
authored
Merge pull request #40 from HumanBrainProject/fixes_for_upstream_updates
Fixes for upstream updates of NumPy and Nibabel
2 parents 52b6a5b + be36eef commit fbeeea0

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/neuroglancer_scripts/_compressed_segmentation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def _encode_channel(chunk_channel, block_size):
7979
(lookup_table, encoded_values) = np.unique(
8080
block, return_inverse=True, return_counts=False)
8181
bits = number_of_encoding_bits(len(lookup_table))
82+
encoded_values = encoded_values.ravel() # Numpy 2.0 compat
8283

8384
# Write look-up table to the buffer (or re-use another one)
8485
lut_bytes = lookup_table.astype(block.dtype).tobytes()

src/neuroglancer_scripts/volume_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def nibabel_image_to_info(img,
127127
}}""".format(num_channels=shape[3] if len(shape) >= 4 else 1,
128128
data_type=guessed_dtype,
129129
size=list(shape[:3]),
130-
resolution=[vs * 1000000 for vs in voxel_sizes[:3]])
130+
resolution=[float(vs * 1_000_000) for vs in voxel_sizes[:3]])
131131

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

0 commit comments

Comments
 (0)