Skip to content

Commit a960b92

Browse files
authored
Merge pull request #690 from isolovey-robarts/max_csa_items
Siemens CSA Reader: Increase maximum number of items
2 parents ad26878 + 8c90a20 commit a960b92

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

nibabel/nicom/csareader.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
'IS': int, # integer string
1919
}
2020

21-
MAX_CSA_ITEMS = 199
21+
MAX_CSA_ITEMS = 1000
2222

2323

2424
class CSAError(Exception):
15.7 KB
Binary file not shown.
-3.22 KB
Binary file not shown.

nibabel/nicom/tests/test_csareader.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
CSA2_B1000 = open(pjoin(IO_DATA_PATH, 'csa2_b1000.bin'), 'rb').read()
2222
CSA2_0len = gzip.open(pjoin(IO_DATA_PATH, 'csa2_zero_len.bin.gz'), 'rb').read()
2323
CSA_STR_valid = open(pjoin(IO_DATA_PATH, 'csa_str_valid.bin'), 'rb').read()
24-
CSA_STR_200n_items = open(pjoin(IO_DATA_PATH, 'csa_str_200n_items.bin'), 'rb').read()
24+
CSA_STR_1001n_items = open(pjoin(IO_DATA_PATH, 'csa_str_1001n_items.bin'), 'rb').read()
2525

2626

2727
@dicom_test
@@ -70,15 +70,15 @@ def test_csa_len0():
7070

7171
def test_csa_nitem():
7272
# testing csa.read's ability to raise an error when n_items >= 200
73-
assert_raises(csa.CSAReadError, csa.read, CSA_STR_200n_items)
74-
# OK when < 200
73+
assert_raises(csa.CSAReadError, csa.read, CSA_STR_1001n_items)
74+
# OK when < 1000
7575
csa_info = csa.read(CSA_STR_valid)
7676
assert_equal(len(csa_info['tags']), 1)
7777
# OK after changing module global
7878
n_items_thresh = csa.MAX_CSA_ITEMS
7979
try:
80-
csa.MAX_CSA_ITEMS = 1000
81-
csa_info = csa.read(CSA_STR_200n_items)
80+
csa.MAX_CSA_ITEMS = 2000
81+
csa_info = csa.read(CSA_STR_1001n_items)
8282
assert_equal(len(csa_info['tags']), 1)
8383
finally:
8484
csa.MAX_CSA_ITEMS = n_items_thresh

0 commit comments

Comments
 (0)