@@ -89,9 +89,8 @@ def _pack_rgba(rgba):
8989 out : ndarray, shape (n, )
9090 Annotation values for each colour.
9191 """
92- # ctab :: n x 4
9392 bitshifts = 2 ** np .array ([[0 ], [8 ], [16 ], [24 ]], dtype = rgba .dtype )
94- return rgba .dot (bitshifts ). squeeze ()
93+ return rgba .dot (bitshifts )
9594
9695
9796def read_geometry (filepath , read_metadata = False , read_stamp = False ):
@@ -402,7 +401,7 @@ def read_annot(filepath, orig_ids=False):
402401 ctab [idx , :4 ] = np .fromfile (fobj , dt , 4 )
403402
404403 # generate annotation values for each LUT entry
405- ctab [:, 4 ] = _pack_rgba (ctab [:, :4 ])
404+ ctab [:, [ 4 ] ] = _pack_rgba (ctab [:, :4 ])
406405
407406 # make sure names are strings, not bytes
408407 names = [n .decode ('ascii' ) for n in names ]
@@ -450,8 +449,7 @@ def write_string(s):
450449
451450 # Generate annotation values for each ctab entry
452451 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 ])))
455453 elif not np .array_equal (ctab [:, 4 ], _pack_rgba (ctab [:, :4 ])):
456454 warnings .warn ('Annotation values in {} will be incorrect' .format (
457455 filepath ))
0 commit comments