Closed GoogleCodeExporter closed 8 years ago
Thanks for this detailed issue entry. In dicom.ReadSequence, the logic seems
right
for either a zero length sequence or for a delimited sequence with nothing in
it. Can
you direct me to an example file or a hex dump of the region of the sequence?
Original comment by darcymason@gmail.com
on 25 Nov 2008 at 4:46
assuming you are using gmail.. sent you a file.
Original comment by brandon....@gmail.com
on 9 Dec 2008 at 8:06
The sequence has a single item in it, but that item is empty (zero length). The
code
didn't expect a zero-length dataset so a comparison to bytes-read < 0 never
triggered, and thus everything after was attached to the sequence.
I'm not quite sure of the best way to parse this, whether to consider the
sequence
empty or to have a single (empty) item in it. I picked the latter for now and
there
is a simple fix for this which will be in the next commit (but other code needs
to be
fixed up first):
In dataset.py, function ReadDataset(),
After
ds = Dataset()
Insert the following two lines
if bytelength == 0:
return ds
Then in ReadSequence():
Change
if not dataset: # None is returned if get to Sequence Delimiter
to
if dataset is None: # None is returned if get to Sequence Delimiter
Without the change in ReadSequence it will still work but will report the
sequence as
having zero items.
Original comment by darcymason@gmail.com
on 10 Dec 2008 at 4:24
Unit test code added in r75.
Original comment by darcymason@gmail.com
on 12 Jan 2009 at 4:40
Original issue reported on code.google.com by
brandon....@gmail.com
on 24 Nov 2008 at 7:40