suyashkumar/dicom

Add option to not hold entire dataset in memory at once

Opened this issue · 2 comments

Some dataset items must be held in memory as context to read future tags/values properly. But, we can have an option where only the essential tags are held in memory, and if you're using incremental parsing (Parser.Next()) you can process things 1 element at a time if appropriate for your use case.

For example for a pipeline you could do something like

var elem *dicom.Element
var err error
for err != dicom.EndOfDICOM {
    elem, err = parser.Next()
    newElem := doSomeProcessing(elem)
    writer.WriteElement(elem)
}

and possibly don't have to hold the all of the DICOMs elements in memory at one time

#267 has a draft of this!