File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -137,13 +137,12 @@ def read(csa_str):
137
137
continue
138
138
item = nt_str (up_str .read (item_len ))
139
139
if converter :
140
- if vm == 0 :
141
- # we may have fewer real items than are given in
142
- # n_items, but we don't know how many - assume that
143
- # we've reached the end when we hit an empty item
144
- if item_len == 0 :
145
- n_values = item_no
146
- continue
140
+ # we may have fewer real items than are given in
141
+ # n_items, but we don't know how many - assume that
142
+ # we've reached the end when we hit an empty item
143
+ if item_len == 0 :
144
+ n_values = item_no
145
+ continue
147
146
item = converter (item )
148
147
items .append (item )
149
148
# go to 4 byte boundary
Original file line number Diff line number Diff line change 1
1
""" Testing Siemens CSA header reader
2
2
"""
3
3
from os .path import join as pjoin
4
+ import gzip
4
5
5
6
import numpy as np
6
7
17
18
18
19
CSA2_B0 = open (pjoin (IO_DATA_PATH , 'csa2_b0.bin' ), 'rb' ).read ()
19
20
CSA2_B1000 = open (pjoin (IO_DATA_PATH , 'csa2_b1000.bin' ), 'rb' ).read ()
21
+ CSA2_0len = gzip .open (pjoin (IO_DATA_PATH , 'csa2_zero_len.bin.gz' ), 'rb' ).read ()
20
22
21
23
22
24
@dicom_test
@@ -44,6 +46,15 @@ def test_csas0():
44
46
assert_equal (b_value ['items' ], [1000 ])
45
47
46
48
49
+ def test_csa_len0 ():
50
+ # We did get a failure for item with item_len of 0 - gh issue #92
51
+ csa_info = csa .read (CSA2_0len )
52
+ assert_equal (csa_info ['type' ], 2 )
53
+ assert_equal (csa_info ['n_tags' ], 44 )
54
+ tags = csa_info ['tags' ]
55
+ assert_equal (len (tags ), 44 )
56
+
57
+
47
58
def test_csa_params ():
48
59
for csa_str in (CSA2_B0 , CSA2_B1000 ):
49
60
csa_info = csa .read (csa_str )
You can’t perform that action at this time.
0 commit comments