suyashkumar / dicom

⚡High Performance DICOM Medical Image Parser in Go.
MIT License
933 stars 136 forks source link

Add option to not hold entire dataset in memory at once #257

Open suyashkumar opened 1 year ago

suyashkumar commented 1 year ago

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.

suyashkumar commented 1 year ago

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

suyashkumar commented 1 year ago

267 has a draft of this!