Skip to content

Commit 8d7d2e4

Browse files
fix: uint64 handling in single voxel accesses
1 parent bd55451 commit 8d7d2e4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/compressed_segmentation.pyx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,9 @@ class CompressedSegmentationArray:
416416
gpt = xyz // self.block_size
417417
grid_size = self.grid_size
418418

419-
if self.binary[0] != 1:
419+
channel_offset = int.from_bytes(self.binary[:4], 'little')
420+
421+
if channel_offset != 1:
420422
raise DecodeError(
421423
"Only single channel is currently supported in this function."
422424
)
@@ -449,7 +451,7 @@ class CompressedSegmentationArray:
449451
cdef uint64_t table_entry_size = np.dtype(self.dtype).itemsize // 4
450452
cdef uint64_t val = data[tbl_off + bitval * table_entry_size]
451453
if table_entry_size > 1:
452-
val = val | (data[tbl_off + bitval * table_entry_size + 1] << 32)
454+
val = val | (<uint64_t>(data[tbl_off + bitval * table_entry_size + 1]) << 32)
453455

454456
return val
455457

0 commit comments

Comments
 (0)