@@ -89,9 +89,8 @@ def _pack_rgba(rgba):
89
89
out : ndarray, shape (n, )
90
90
Annotation values for each colour.
91
91
"""
92
- # ctab :: n x 4
93
92
bitshifts = 2 ** np .array ([[0 ], [8 ], [16 ], [24 ]], dtype = rgba .dtype )
94
- return rgba .dot (bitshifts ). squeeze ()
93
+ return rgba .dot (bitshifts )
95
94
96
95
97
96
def read_geometry (filepath , read_metadata = False , read_stamp = False ):
@@ -402,7 +401,7 @@ def read_annot(filepath, orig_ids=False):
402
401
ctab [idx , :4 ] = np .fromfile (fobj , dt , 4 )
403
402
404
403
# generate annotation values for each LUT entry
405
- ctab [:, 4 ] = _pack_rgba (ctab [:, :4 ])
404
+ ctab [:, [ 4 ] ] = _pack_rgba (ctab [:, :4 ])
406
405
407
406
# make sure names are strings, not bytes
408
407
names = [n .decode ('ascii' ) for n in names ]
@@ -450,8 +449,7 @@ def write_string(s):
450
449
451
450
# Generate annotation values for each ctab entry
452
451
if fill_ctab :
453
- ctab = np .hstack ((ctab [:, :4 ],
454
- _pack_rgba (ctab [:, :4 ]).reshape (- 1 , 1 )))
452
+ ctab = np .hstack ((ctab [:, :4 ], _pack_rgba (ctab [:, :4 ])))
455
453
elif not np .array_equal (ctab [:, 4 ], _pack_rgba (ctab [:, :4 ])):
456
454
warnings .warn ('Annotation values in {} will be incorrect' .format (
457
455
filepath ))
0 commit comments