@@ -81,24 +81,24 @@ def _read_volume_info(fobj):
81
81
return volume_info
82
82
83
83
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.
86
86
87
87
Used by :func:`read_annot` and :func:`write_annot` to generate
88
88
"annotation values" for a Freesurfer ``.annot`` file.
89
89
90
90
Parameters
91
91
----------
92
- rgba : ndarray, shape (n, 4 )
93
- RGBA colors
92
+ rgb : ndarray, shape (n, 3 )
93
+ RGB colors
94
94
95
95
Returns
96
96
-------
97
97
out : ndarray, shape (n, 1)
98
98
Annotation values for each color.
99
99
"""
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 )
102
102
103
103
104
104
def read_geometry (filepath , read_metadata = False , read_stamp = False ):
@@ -384,7 +384,7 @@ def read_annot(filepath, orig_ids=False):
384
384
ctab , names = _read_annot_ctab_new_format (fobj , - n_entries )
385
385
386
386
# generate annotation values for each LUT entry
387
- ctab [:, [4 ]] = _pack_rgba (ctab [:, :4 ])
387
+ ctab [:, [4 ]] = _pack_rgb (ctab [:, :3 ])
388
388
389
389
if not orig_ids :
390
390
ord = np .argsort (ctab [:, - 1 ])
@@ -523,8 +523,8 @@ def write_string(s):
523
523
524
524
# Generate annotation values for each ctab entry
525
525
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 ])):
528
528
warnings .warn ('Annotation values in {} will be incorrect' .format (
529
529
filepath ))
530
530
0 commit comments