-
Notifications
You must be signed in to change notification settings - Fork 264
Open
Labels
Description
nibabel/nibabel/nicom/csareader.py
Lines 121 to 132 in b46efa3
# CSA1 specific length modifier | |
if tag_no == 1: | |
tag0_n_items = n_items | |
if n_items > MAX_CSA_ITEMS: | |
raise CSAReadError('Expected <= {0} tags, got {1}'.format( | |
MAX_CSA_ITEMS, n_items)) | |
items = [] | |
for item_no in range(n_items): | |
x0, x1, x2, x3 = up_str.unpack('4i') | |
ptr = up_str.ptr | |
if hdr_type == 1: # CSA1 - odd length calculation | |
item_len = x0 - tag0_n_items |
I think the definition of tag0_n_items
might be a incorrect. The docs (that describe the SPM implementation) say to use the n_items
of the first tag, which here corresponds to the condition tag_no == 0
, not 1. (Feels like a slip while porting 1-indexed MATLAB code). This would make the value calculated on L132 wrong for every item in every tag.
There are no test files with a CSA1 header, and I don't have any, so I can't confirm this.