@@ -81,24 +81,24 @@ def _read_volume_info(fobj):
8181 return volume_info
8282
8383
84- def _pack_rgba ( rgba ):
85- """Pack an RGBA sequence into a single integer.
84+ def _pack_rgb ( rgb ):
85+ """Pack an RGB sequence into a single integer.
8686
8787 Used by :func:`read_annot` and :func:`write_annot` to generate
8888 "annotation values" for a Freesurfer ``.annot`` file.
8989
9090 Parameters
9191 ----------
92- rgba : ndarray, shape (n, 4 )
93- RGBA colors
92+ rgb : ndarray, shape (n, 3 )
93+ RGB colors
9494
9595 Returns
9696 -------
9797 out : ndarray, shape (n, 1)
9898 Annotation values for each color.
9999 """
100- bitshifts = 2 ** np .array ([[0 ], [8 ], [16 ], [ 24 ]] , dtype = rgba .dtype )
101- return rgba .dot (bitshifts )
100+ bitshifts = 2 ** np .array ([[0 ], [8 ], [16 ]] , dtype = rgb .dtype )
101+ return rgb .dot (bitshifts )
102102
103103
104104def read_geometry (filepath , read_metadata = False , read_stamp = False ):
@@ -384,7 +384,7 @@ def read_annot(filepath, orig_ids=False):
384384 ctab , names = _read_annot_ctab_new_format (fobj , - n_entries )
385385
386386 # generate annotation values for each LUT entry
387- ctab [:, [4 ]] = _pack_rgba (ctab [:, :4 ])
387+ ctab [:, [4 ]] = _pack_rgb (ctab [:, :3 ])
388388
389389 if not orig_ids :
390390 ord = np .argsort (ctab [:, - 1 ])
@@ -523,8 +523,8 @@ def write_string(s):
523523
524524 # Generate annotation values for each ctab entry
525525 if fill_ctab :
526- ctab = np .hstack ((ctab [:, :4 ], _pack_rgba (ctab [:, :4 ])))
527- elif not np .array_equal (ctab [:, [4 ]], _pack_rgba (ctab [:, :4 ])):
526+ ctab = np .hstack ((ctab [:, :4 ], _pack_rgb (ctab [:, :3 ])))
527+ elif not np .array_equal (ctab [:, [4 ]], _pack_rgb (ctab [:, :3 ])):
528528 warnings .warn ('Annotation values in {} will be incorrect' .format (
529529 filepath ))
530530
0 commit comments