Skip to content

Commit

Permalink
nested sequence item parsing to fix issue with IconImageSequence (#80)
Browse files Browse the repository at this point in the history
When parsing a DICOM file with IconImageSequence, the parser stumbles over the PixelData inside the sequence, because of calling pixeldata_parse with the root DICOMData as an argument. Using the item as the DICOMData argument in reading the items elements solves this.
  • Loading branch information
vsaase authored Mar 30, 2021
1 parent 155ccec commit bce33b1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/DICOM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -398,16 +398,21 @@ function sequence_parse(st, sz, dcm)
end

function sequence_item(st::IO, sz, dcm)
item = Dict{Tuple{UInt16,UInt16},Any}()
item = DICOMData(
Dict{Tuple{UInt16,UInt16},Any}(),
dcm.endian,
dcm.isexplicit,
dcm.vr
)
endpos = position(st) + sz
while position(st) < endpos
(gelt, data, vr) = read_element(st, dcm)
(gelt, data, vr) = read_element(st, item)
if isequal(gelt, (0xFFFE, 0xE00D))
break
end
item[gelt] = data
end
return DICOMData(item, dcm.endian, dcm.isexplicit, dcm.vr)
return item
end

# always little-endian, "encapsulated" iff sz==0xffffffff
Expand Down

0 comments on commit bce33b1

Please sign in to comment.