Skip to content

Commit

Permalink
Merge 78899a6 into b61972e
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlSjostrand committed Feb 14, 2019
2 parents b61972e + 78899a6 commit 4d173de
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/scala/se/nimsa/dicom/streams/DicomFlows.scala
Expand Up @@ -372,7 +372,7 @@ object DicomFlows {
override def onSequenceDelimitation(part: SequenceDelimitationPart): List[DicomPart] =
super.onSequenceDelimitation(part) ::: (
if (part.bytes.isEmpty)
SequenceDelimitationPart(part.bigEndian, itemDelimitation(part.bigEndian)) :: Nil
SequenceDelimitationPart(part.bigEndian, sequenceDelimitation(part.bigEndian)) :: Nil
else
Nil)

Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/se/nimsa/dicom/streams/ModifyFlow.scala
Expand Up @@ -19,10 +19,9 @@ package se.nimsa.dicom.streams
import akka.NotUsed
import akka.stream.scaladsl.Flow
import akka.util.ByteString
import se.nimsa.dicom.data.isFileMetaInformation
import se.nimsa.dicom.data.DicomParts._
import se.nimsa.dicom.data.TagPath.{EmptyTagPath, TagPathTag}
import se.nimsa.dicom.data.{Dictionary, TagPath, VR}
import se.nimsa.dicom.data.{Dictionary, TagPath, VR, isFileMetaInformation}

object ModifyFlow {

Expand Down
19 changes: 19 additions & 0 deletions src/test/scala/se/nimsa/dicom/streams/ModifyFlowTest.scala
Expand Up @@ -430,4 +430,23 @@ class ModifyFlowTest extends TestKit(ActorSystem("ModifyFlowSpec")) with FlatSpe
.expectValueChunk(mikeBytes)
.expectDicomComplete()
}

it should "not emit sequence and item delimiters for data with explicit length sequences and items" in {
val bytes = patientNameJohnDoe() ++
sequence(Tag.DerivationCodeSequence, 24) ++
item(16) ++ studyDate()

val source = Source.single(bytes)
.via(parseFlow)
.via(modifyFlow())

source.runWith(TestSink.probe[DicomPart])
.expectHeader(Tag.PatientName)
.expectValueChunk()
.expectSequence(Tag.DerivationCodeSequence, 24)
.expectItem(1, 16)
.expectHeader(Tag.StudyDate)
.expectValueChunk()
.expectDicomComplete()
}
}

0 comments on commit 4d173de

Please sign in to comment.